-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
52 lines (52 loc) · 1.44 KB
/
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
<html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
require ("db.php");
if(isset($_POST['btn'])){
$mobile = $_POST['mobile'];
$pass = md5($_POST['password']);
if(empty($mobile)||empty($pass)){
$err = "Fill The Required Fields";
}
else{
$query="SELECT * FROM user WHERE mobile=$mobile AND password='$pass'";
$run = mysqli_query($conn,$query);
if(!$run){
die ("query not executing");
}
else if(mysqli_num_rows($run)>0){
session_start();
$_SESSION["login"]="1";
$row = mysqli_fetch_assoc($run);
$_SESSION['name'] = $row['name'];
$_SESSION['mobile'] = $row['mobile'];
echo "<script>window.location='profile.php'</script>";
}
else{
$err = "Invalid username/ password";
}
}
}
?>
<form action="" method="post">
<table cellspacing="9px" border="0px">
<tr>
<th>mobile no.:</th>
<td><input type="text" name="mobile"></td>
</tr>
<tr>
<th>Password:</th>
<td><input type="password" name="password"></td>
</tr>
<tr>
<th><input type="submit" name="btn" value="logIn"/></th>
</tr>
</table>
</form>
</body>
</html>