-
Notifications
You must be signed in to change notification settings - Fork 0
/
welcome.php
45 lines (42 loc) · 1.12 KB
/
welcome.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
<!DOCTYPE html>
<html>
<body>
<?php
//values from form
$username=$_POST["uname"];
$password=$_POST["pass"];
//prevention of sql injuction
$username=stripcslashes($username);
$password=stripcslashes($password);
$username=mysql_real_escape_string($username);
$password=mysql_real_escape_string($password);
//connection to database
mysql_connect('localhost','root','');
mysql_select_db('sba');
//query
$qu=mysql_query("select * from user where Username='$username' and Password='$password'") or die("Failed to Connect to Database").mysql_error();
$result=mysql_fetch_array($qu);
echo isset($username);
if(!empty($username) && !empty($password)){
if ($result['Username']==$username && $result['Password']==$password) {
session_start();
$_SESSION["member"]=$username;
echo "Login Successful";
?>
<script type="text/javascript">location.href = 'user.php';</script>
<?php
} else {
echo "Invalid Username Or Password";
}
}
else{
?>
<script type="text/javascript">
alert("Can not null");
location.href = 'index.php';
</script>
<?php
}
?>
</body>
</html>