-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
33 lines (33 loc) · 644 Bytes
/
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
<?php
$server='localhost';
$user='root';
$pwd='';
$db='analyzerdb';
$conn=mysqli_connect($server,$user,$pwd,$db);
if(!$conn)
{
die("Error ".mysqli_connect_error());
}
if(isset($_POST['loginbutton']))
{
$username=$_POST['admin-name'];
$password=$_POST['admin-pass'];
if($username=='admin' && $password=='12345')
{
session_start();
$_SESSION['admin-name']=$username;
header('Location:admin.php');
}
else
{
echo "<script type='text/javascript'>alert('Invalid Credentials');</script>";
}
}
if(isset($_POST['logout']))
{
session_start();
unset($_SESSION['admin-name']);
session_destroy();
header('Location:index.php');
}
?>