forked from lite-david/BITStrade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
62 lines (40 loc) · 1003 Bytes
/
login.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
session_start();
if(isset($_POST['login']))
{
function validate($a)
{
$a=trim($a);
$a=strip_tags($a);
$a=mysql_real_escape_string($a);
return $a;
}
$nick=validate($_POST['nick']);
$password=validate($_POST['password']);
if($nick && $password)
{
$connect= mysql_connect("127.0.0.1","root","") or die("cannot connect");
mysql_select_db("bitstrade");
$login=mysql_query("SELECT * FROM users WHERE nick='$nick'");
while($log=mysql_fetch_assoc($login))
{
$dbnick = $log['nick'];
$dbpassword = $log['password'];
}
if( $nick==$dbnick && $password==$dbpassword )
{
$_SESSION['nick'] = $dbnick;
$_SESSION['password'] = $dbpassword;
header("location:members.php");
}
else
{
header("location:index.php? notify= incorrect nick and password combination");
}
}
else
{
header("location:index.php? notify=Please fill both the fields");
}
}
?>