forked from Mahezha/LoginSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
38 lines (31 loc) · 982 Bytes
/
process.php
File metadata and controls
38 lines (31 loc) · 982 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
<?php
/**
* Created by PhpStorm.
* User: Maheshi
* Date: 4/19/2019
* Time: 5:40 PM
*/
//include("connection.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);
//mysql_connect("localhost", "root","");
//mysql_select_db("login");
//OpenCon();
$con = mysqli_connect("localhost", "root", "", "login");
if(mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con, "select * from users where username = '$username' and password = '$password'")
or die("Failed to query database".mysqli_connect_error());
$row = mysqli_fetch_array($result);
if($row['username'] == $username && $row['password'] == $password){
echo "Login Success!!! Welcome ".$row['username'];
}else{
echo "Failed to login!";
}
mysqli_close($con);
?>