-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkLogin.php
50 lines (48 loc) · 1.19 KB
/
checkLogin.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
<?php
session_start();
include("connection.php");
include("class/user.php");
$user=new user;
$mail = $_REQUEST['inputEmail'];
$pass = $_REQUEST['inputPassword'];
echo $mail;
$p=$user->getbymail($mail);
$dem = mysqli_num_rows($p);
if($dem == 0)
{
echo "
<script language='javascript'>
alert('Accout doesn't exist');
</script>
";
header('location: index.php');
}
else
{
$sql_check2 = mysqli_query($link, "SELECT * FROM user WHERE mail = '$mail' AND pass = '$pass'");
$dem2 = mysqli_num_rows($sql_check2);
if($dem2 == 0)
{
echo "
<script language='javascript'>
alert('Wrong password');
</script>
";
header('location: index.php');
}
else
{
$row = mysqli_fetch_array($sql_check2);
$_SESSION['name']=$row['name'];
$_SESSION['avt']=$row['avatar'];
$_SESSION['mail']=$row['mail'];
$login=$user->online($_SESSION['mail']);
echo "
<script language='javascript'>
alert('Log in suscesfully');
</script>
";
header('location: homepre.php');
}
}
?>