-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthenticate-admin.php
More file actions
36 lines (30 loc) · 839 Bytes
/
Copy pathauthenticate-admin.php
File metadata and controls
36 lines (30 loc) · 839 Bytes
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
<?php
session_start();
$myHost = "localhost";
$myUserName = "root";
$myPassword = "";
$myDataBaseName = "bc2i";
$con = mysqli_connect("$myHost", "$myUserName", "$myPassword", "$myDataBaseName");
if( !$con )
{
include("error.html");
// die("Connection object not created: ".mysqli_error($con));
}
if( mysqli_connect_errno() )
{
die("Connect failed: ".mysqli_connect_errno()." : ". mysqli_connect_error());
}
$id = $_POST['adminid'];
$pass = $_POST['password'];
$query="SELECT * FROM `admin` WHERE `adminid`='$id' AND `password`='$pass'";
$result=mysqli_query($con,$query);
$rowcount=mysqli_num_rows($result);
if($rowcount!=0)
{ $_SESSION['adminid'] = $id;
header('Location: ./admin-dashboard.php');
}
else
{
header('Location:./admin-login.php?authentication=false');
}
?>