-
Notifications
You must be signed in to change notification settings - Fork 0
/
signin.php
52 lines (42 loc) · 1.05 KB
/
signin.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
$name = $_POST['name'];
$pass = $_POST['pass'];
if (!empty($name) ||!empty($pass) )
{
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "it-4";
// Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()){
die('Connect Error ('. mysqli_connect_errno() .') '
. mysqli_connect_error());
}
else{
// $SELECT = "SELECT email From register Where email = ? Limit 1";
$INSERT = "INSERT Into loginn (name ,pass )values(?,?)";
$s="select name,pass from register where name='$name' &&pass='$pass'";
$result= mysqli_query($conn,$s);
$num=mysqli_num_rows($result);
if($num==1)
{
$stmt = $conn->prepare($INSERT);
$stmt->bind_param("ss", $name,$pass);
$stmt->execute();
echo"Login Success";
header("location:home.html");
}
else
{
echo"Login Failure";
header("location:index.html");
}
}
}
else
{
echo "All field are required";
die();
}
?>