-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate.php
46 lines (44 loc) · 1.59 KB
/
validate.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
<?php
header('Content-Type: text/html; charset=UTF-8');
$username = "root";
$password = "";
$hostname = "localhost";
$count=0;
$db="proj";
$dbhandle = mysqli_connect($hostname, $username, $password,$db)
or die("Unable to connect to MySQL");
mysqli_query($dbhandle,"SET NAMES 'utf8'");
$studusr=$_POST['txtusername'];
$studpass=$_POST['txtpassword'];
$result = mysqli_query($dbhandle,"select * from student where sid='$studusr' and pwd='$studpass'");
while($row= mysqli_fetch_array($result))
{
session_start();
$_SESSION['sid']=$row['sid'];
echo $_SESSION['sid'];
header('Location: coding.php');
$count=1;
}
$result1 = mysqli_query($dbhandle,"select * from login_teacher where tname='$studusr' and pwd='$studpass'");
while($row= mysqli_fetch_array($result1))
{
session_start();
$_SESSION['tid']=$row['tid'];
echo $_SESSION['tid'];
header('Location: teacherhome.php');
$count=1;
}
$result2 = mysqli_query($dbhandle,"select * from admin where username='$studusr' and password='$studpass'");
while($row= mysqli_fetch_array($result2))
{
session_start();
$_SESSION['aid']=$row['aid'];
echo $_SESSION['aid'];
header('Location: adminhome.php');
$count=1;
}
if($count==0)
{
header('Location: index1.php');
}
?>