-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_user.php
More file actions
40 lines (33 loc) · 1.06 KB
/
check_user.php
File metadata and controls
40 lines (33 loc) · 1.06 KB
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
include "db_connect.php";
$name = $_POST['name'];
$pwd = $_POST['pwd'];
$dbpwd = "";
$query = "SELECT `password` FROM `register_user` WHERE `username` = '$name' ";
$result = mysqli_query($conn, $query);
if($result){
if(mysqli_num_rows($result) > 0){
$row = mysqli_fetch_assoc($result);
$dbpwd = $dbpwd.$row['password'];
if(strcmp($dbpwd, $_POST['pwd'])){
$msg = "invalid password";
echo "<script language = 'javascript'>";
echo "alert('$msg');";
echo 'window.location="./login.php";';
echo "</script>";
}
else{
echo "<script language = 'javascript'>";
echo 'window.location="./home1.php?username='.$name.'";';
echo "</script>";
}
}
else{
$msg = "invalid user - plz sign up";
echo "<script language = 'javascript'>";
echo "alert('$msg');";
echo 'window.location="./signup.php";';
echo "</script>";
}
}
?>