-
Notifications
You must be signed in to change notification settings - Fork 0
/
facultycheck.php
39 lines (38 loc) · 921 Bytes
/
facultycheck.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
<?php
session_start();
$fusername=$_POST['fusername'];
$fpassword=$_POST['fpassword'];
$conn=mysql_connect("localhost","root","") or die("Could not connect!");
mysql_select_db("dbms") or die("Could not find db");
$query=mysql_query("SELECT * FROM facultyprofile WHERE fusername='$fusername'");
$numrows=mysql_num_rows($query);
if($numrows!=0){
while($row=mysql_fetch_assoc($query)){
$dbpassword=$row['fpassword'];
}
if($fpassword==$dbpassword){
$_SESSION['fusername']=$fusername;
header("Location: facultyhome.php");
exit();
}
else
{
?>
<script type="text/javascript">
alert("Incorrect password");
window.location.href="facultylogin.php";
</script>
<?php
}
}
else
{
?>
<script type="text/javascript">
alert("Invalid user");
window.location.href="facultylogin.php";
</script>
<?php
}
mysql_close($conn);
?>