-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
40 lines (34 loc) · 976 Bytes
/
process.php
File metadata and controls
40 lines (34 loc) · 976 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
38
39
40
<?php
session_start();
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "users";
//$name='sds';
//$pass=12345;
$name=$_POST["name"];
$pass=$_POST["password"];
$conn = new mysqli($servername, $username, $password, $dbname);
mysqli_query($conn,"SET NAMES 'utf8'");
if(!$conn)
{
echo "not connected";
}
else
{
$query="SELECT * from users where username='$name' AND password ='$pass'";
$result=mysqli_query($conn,$query);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$_SESSION["username"]=$row["username"];
$_SESSION["userid"]=$row["id"];
// echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
header('Location: home.php');
//echo "Login sucess ,Welcome" ,$row['username']; echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
}
} else {
echo "0 results";
}
}
?>