Authenticate.php
<html>
<body bgcolor="lightblue">
<center>
<?php
$uname = $_POST['u1'];
$pass = $_POST['p1'];
$sql = "SELECT * FROM registers WHERE uname='$uname' and pass='$pass'";
$link = mysqli_connect("localhost", "root", "", "cseb_db");
if ($link === false) {
die("error couldnot connect" . mysqli_connect_error());
}
if (mysqli_query($link, $sql)) {
if (mysqli_affected_rows($link) != 0) {
echo mysqli_affected_rows($link) . "successfully loged in found";
//while($out=mysqli_fetch_array($result))
//{
//echo "<tr><td>".$out['uname']."</td><td>".$out['pass']."</td><td>".$out['email']."</td><td>".$out['mobile']."</td></tr>";
//}
} else {
echo "Username and Password was not matched" . mysqli_error($link);
}
}
mysqli_close($link);
?>
Regdb.php
<?php
$uname = $_POST['u1'];
$pass = $_POST['p1'];
$email = $_POST['e1'];
$mobile = $_POST['m1'];
$sql = "insert into registers values('$uname','$pass','$email','$mobile')";
$link = mysqli_connect("localhost", "root", "", "cseb_db");
// Check connection
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
if (mysqli_query($link, $sql)) {
if (mysqli_affected_rows($link) != 0) {
echo "data registered successfully";
} else {
echo "Data cannot be inserted" . mysqli_error($link);
}
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
mysqli_close($link);
?>
Regform.html
<html>
<body bgcolor="lightblue">
<center>
<h1>Online Registration form</h1>
<hr>
<hr>
<form method="POST" action="regdb.php">
<table border="1" bgcolor="green">
<tr>
<td>Username</td>
<td><input type="text" name="u1"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="p1"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="e1"></td>
</tr>
<tr>
<td>MobileNo</td>
<td><input type="text" name="m1"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="submit">
</tr>
</table>
</body>
</html>
Userlog.html
<html>
<body bgcolor="lightblue">
<center>
<h1>Online Registration form</h1>
<hr>
<hr>
<form method="POST" action="regdb.php">
<table border="1" bgcolor="green">
<tr>
<td>Username</td>
<td><input type="text" name="u1"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="p1"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="e1"></td>
</tr>
<tr>
<td>MobileNo</td>
<td><input type="text" name="m1"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="submit">
</tr>
</table>
</body>
</html>