0% found this document useful (0 votes)
13 views5 pages

Long-Scripting Question

The document contains an HTML form for user registration, requiring fields such as full name, email, username, and password. It also includes a PHP script (conn.php) that processes the form submission, validating the input and inserting the data into a MySQL database. The script checks for specific conditions like character limits and format validations for the email and username before executing the database insertion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Long-Scripting Question

The document contains an HTML form for user registration, requiring fields such as full name, email, username, and password. It also includes a PHP script (conn.php) that processes the form submission, validating the input and inserting the data into a MySQL database. The script checks for specific conditions like character limits and format validations for the email and username before executing the database insertion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Answer: Clientinterface.

php
<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>web</title>

<style>

fieldset{heigt: 50%; width: 30%;}

</style>

</head>

<body>
<fieldset>

<legend><strong>Register</strong></legend>

<form action="[Link]" method="post">

*requiredfields<br>

Your Full Name*:<br>

<input type="text" name="n1" required>

<br><br>

Email Address*:<br>

<input type="email" name="n2" required>

<br><br>

User Name*:<br>

<input type="text" name="n3" required>

<br><br>

Password*:<br>

<input type="text" name="n4" required><br><br>

<input type="submit" name="n5" value="Submit">

</form>

</fieldset>

</body>

</html>
[Link]

<?php

if(isset($_POST['n5']))

$name=$_POST['n1'];

$email=$_POST['n2'];

$user=$_POST['n3'];

$password=$_POST['n4'];

$host="localhost";

$servername="root";

$serverpassword="";

$dbname="System";

$conn=mysqli_connect($host,$servername,$serverpassword,$dbname);

if($conn)

if(strlen($name)>=40)

echo "Your full name will be less than 40 charcters"."<br>";

if(!preg_match('/^([a-z]+[0-9]*)@([a-z]+)\.[a-z]{2,5}$/', $email))

{
echo"Please Enter Valid Email Address"."<br>";

if(!preg_match('/^[A-Z]{6}+[0-9]{4}+[A-Z]{1}$/', $user))

echo"Invalid User Name:"."<br>";

if(strlen($password)<=8)

echo" Invalid Password:Password must be more than 8 characters";

else{

$sql="insert into
Record(Full_Name,Email,User_Name,Password)values('$name',
'$email','$user','$password')";

$result=mysqli_query($conn,$sql);

if($result) {

echo "Inserted Sucessifully";

}
else

die(mysqli_error($conn));

mysqli_close($conn);

?>

You might also like