-
Notifications
You must be signed in to change notification settings - Fork 2
/
log.php
38 lines (29 loc) · 817 Bytes
/
log.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
<html>
<body>
<?php
session_start();
// Create connection
$conn = new mysqli('localhost','root','');
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "DB Connected successfully";
// this will select the Database sample_db
mysqli_select_db($conn,"student");
echo "\n DB is seleted as Test successfully";
$sql="SELECT * FROM signup WHERE usn='$_POST[id]' AND pass='$_POST[psd]'";
$_SESSION["usn"]=$_POST[id];
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0){
/* Redirect browser */
header("Location:promain.php");
}
else {
$message="USERNAME or PASSWORD are wrong";
echo"<script type='text/javascript'> { alert('$message');} window.location.replace('login.php');</script>";
}
mysqli_close($conn);
?>
</body>
</html>