Created
December 7, 2018 13:11
-
-
Save Lavz/4a2456a5ff7c59d9d4672a1e3176ebde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<?php | |
// Database connection parameters. | |
$servername = "localhost"; | |
$username = "root"; | |
$password = ""; | |
$dbname = "SampleDB"; | |
$user=$_POST['uname']; | |
$pass=$_POST['psw']; | |
#echo $user.$pass; | |
$con=mysql_connect('localhost','root','') or die(mysql_error()); | |
mysql_select_db('SampleDB') or die("cannot select DB"); | |
#echo $con; | |
$query=mysql_query("SELECT * FROM sampletable WHERE username='".$user."' AND password='".$pass."'"); | |
$numrows=mysql_num_rows($query); | |
#echo $numrows; | |
if($numrows!=0) | |
{ | |
while($row=mysql_fetch_assoc($query)) | |
{ | |
$dbusername=$row['username']; | |
$dbpassword=$row['password']; | |
} | |
#echo $dbusername.$dbpassword; | |
if($user == $dbusername && $pass == $dbpassword) | |
{ | |
echo "Valid User .. Successfully Logged In !!"; | |
} else { | |
echo "Invalid Username or password!"; | |
} | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how can i use it ??