forked from SAAR-IITP/SAAR-IITP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
26 lines (22 loc) · 1022 Bytes
/
login.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
<?php
session_start();
include('connection.php');
$error="";
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$myusername = mysqli_real_escape_string($dbc,$_POST['email']);
$mypassword = mysqli_real_escape_string($dbc,$_POST['password']);
$sql = "SELECT college_id FROM user WHERE email = '$myusername' and password = '$mypassword'";
$result = mysqli_query($dbc,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if($count == 1) {
$_SESSION['login_user'] = $myusername;
$_SESSION['loggedin'] = true;
header("location: portal.php");
}else {
$_SESSION['loginfail'] = true;
header("location: index.php");
}
}
?>