-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessadmin.php
More file actions
37 lines (30 loc) · 921 Bytes
/
processadmin.php
File metadata and controls
37 lines (30 loc) · 921 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
37
<?php
$username=$_POST['user'];
$password=$_POST['pass'];
/*
$username=stripcslashes($username);
$password=stripcslashes($password);
$username=mysql_real_escape_string($username);
$password=mysql_real_escape_string($password);
*/
$db_username = 'root';
$db_password = '';
$db_name = 'users';
$db_host = 'localhost';
//connect to MySql
$mysqli = new mysqli($db_host, $db_username, $db_password,$db_name);
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
$sql = "select * from admin where name='$username' and password='$password'";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
header('Location: admin.html');
}
} else {
header('Location: loginfail.html');
}
$mysqli->close();
?>