-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.php
37 lines (24 loc) · 805 Bytes
/
log.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
<?php session_start();
include 'db.php';
if(isset($_POST['uid']) && $_POST['uid']!=""){
$uid=$_POST['uid'];
$pwd=$_POST['pwd'];
$sql="SELECT * FROM USERS WHERE uid='".$uid."' AND pwd='".$pwd."'";
//$result=$conn->query($sql);
$result = mysqli_query($conn,$sql);
//var_dump($result);
$rows = mysqli_num_rows($result);
// get number of rows returned
if ($rows) {
while ($row = mysqli_fetch_array($result)) {
//echo 'ID: ' . $row['id'] . '<br>';
//echo 'Full Names: ' . $row['first'] . ' '.$row['last'].'<br>';
$_SESSION['id']= $row['id'];
$_SESSION['name']=$row['first'] . ' '.$row['last'];
header("Location:index.php");
}
} else{
header("Location:login.php?loginerror=true");
}
}
?>