-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
36 lines (32 loc) · 885 Bytes
/
index.php
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
<?php
session_start();
if(isset($_GET['logout']))
unset($_SESSION['userid']);
if(isset($_SESSION['userid']))
echo '<meta http-equiv="Refresh" content="0;http://localhost/cart/user.php" />';
mysql_connect('localhost','root','root');
mysql_select_db('osc') or die(mysql_error());
$tq="";
if(isset($_POST["submit"]))
{
$uid=$_POST["username"];
$password=$_POST["pass"];
$query="select * from users where uid='$uid' and password='$password'";
$tq.=$query;
if(mysql_num_rows(mysql_query($query)))
{
$_SESSION['userid']=$uid;
echo '<meta http-equiv="Refresh" content="0;http://localhost/cart/user.php" />';
}
else
echo "Sorry the Username and Password do not Match .<br/>";
}
?>
<form method="post">
Username : <input type="text" name="username" /><br/>
Password : <input type="password" name="pass" /><br/>
<input type="submit" name="submit" value="Login" />
</form>
<?php
echo $tq;
?>