-
Notifications
You must be signed in to change notification settings - Fork 0
/
loginAuto.php
29 lines (29 loc) · 1.04 KB
/
loginAuto.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
<?php
$servername="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$dbName="project"; // Database name
// Create connection
$conn = new mysqli($servername, $username, $password, $dbName);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Define $myusername and $mypassword
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql = "SELECT username, password FROM admin WHERE username='$myusername' and
password='$mypassword'";
$result = $conn->query($sql);
// Mysql_num_row is counting table row
if ($result->num_rows > 0)
{
//redirect to file "adminMenu.php"
header("location:adminMenu.php");
}
else
{
echo "<p>Wrong Username or Password. Please try again.";
}
$conn->close();
?>