-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction_page.php
More file actions
51 lines (44 loc) · 1.08 KB
/
Copy pathaction_page.php
File metadata and controls
51 lines (44 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<head></head>
<body>
<form action="action_page.php" method="GET">
<input type="submit" value="Submit Survey">
</form>
</body>
</html>
<?php
$var = $_GET("TestUser1");
echo ($var);
?>
<?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!";
}
}
?>