-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.php
More file actions
50 lines (49 loc) · 1.29 KB
/
Copy pathcheck.php
File metadata and controls
50 lines (49 loc) · 1.29 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
41
42
43
44
45
46
47
48
49
50
<?php
$host="localhost";
$user="root";
$password="";
$con=mysqli_connect($host,$user,$password);
$db=mysqli_select_db($con,"aau");
session_start();
$unm=$_POST["txtuname"];
$pwd=$_POST["txtupass"];
$cap=$_SESSION["capcode"];
if ($cap!=$_POST["txtucode"])
{
header("Location: myhome.php?err=3");
die();
}
$qry="select * from user where uname='$unm' and pass='$pwd'";
$rs=mysqli_query($con,$qry);
if (mysqli_num_rows($rs)==1)
{
$rec=mysqli_fetch_assoc($rs);
if($rec["utype"]=="TEACHER"){
session_start();
$_SESSION['uname'] = $rec["uname"];
$_SESSION['id'] = $rec["id"];
$_SESSION['pass'] = $rec["pass"];
$_SESSION['utype'] = $rec["utype"];
$_SESSION["location"]="teacher";
header("Location: tech.php"); die();}
if($rec["utype"]=="STUDENT"){
session_start();
$_SESSION['uname'] = $rec["uname"];
$_SESSION['id'] = $rec["id"];
$_SESSION['pass'] = $rec["pass"];
$_SESSION['utype'] = $rec["utype"];
$_SESSION["location"]="student";
header("Location: stud.php"); die();}
if($rec["utype"]=="admin"){
$_SESSION['uname'] = $rec["uname"];
$_SESSION['id'] = $rec["id"];
$_SESSION['pass'] = $rec["pass"];
$_SESSION['utype'] = $rec["utype"];
$_SESSION["location"]="admi";
header("Location: admi.php"); die();}
}
else
{
header("Location: myhome.php?err=1");
}
?>