-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.php
56 lines (44 loc) · 1.54 KB
/
main.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
<!DOCTYPE html>
<html>
<head>
<title>Main Page</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php
if(isset($_POST['username'])){
$user = $_POST["username"];
}else{
$user = '';
}
if(isset($_POST['password'])){
$pass = $_POST["password"];
}else{
$pass = '';
} ?>
<?php require("connection.php") ?>
<?php $sql_statement = " SELECT username ,Branch_name FROM admin WHERE username = '".$user."' AND password = '".$pass."' ";
$result = mysqli_query($sql_statement);
if(!$result){
$outputDisplay .= "<br><font color=red>mysqli No: ".mysqli_errno();
$outputDisplay .= "<br>mysqli Error: ".mysqli_error();
$outputDisplay .= "<br>SQL Statement: ".$sql_statement;
$outputDisplay .= "<br>mysqli Affected Rows: ".mysqli_affected_rows()."</font><br>";
}else{
$numresults = mysqli_num_rows($result);
if($numresults == 0){
echo "<script> alert(\"Invalid Username OR Password!!!\");window.location.href='index.php'</script>";
}else{
echo "<h1> Welcome " .ucfirst($user)."</h1>";
$row = mysqli_fetch_array($result);
$branch = $row['Branch_name'];
echo "<h2> Admin Branch : ".ucfirst($branch);
require("selectFromEmployee.php");
}
}
?>
<form action="index.php">
<input type="submit" value="Log Out"></input>
</form>
</body>
</html>