-
Notifications
You must be signed in to change notification settings - Fork 0
/
login_fac.php~
executable file
·62 lines (45 loc) · 1.38 KB
/
login_fac.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
51
52
53
54
55
56
57
58
59
60
61
62
<?php
error_reporting(E_ALL);
ini_set("display_errors",'1');
ini_set('include_path', '/var/www/html/admin/');
require_once "recaptchalib.php";
$secret = "6Lc0uxwTAAAAAAId2HHpRjlqOFuAX2WUdmPxJ34D";
$response = null;
// check secret key
$reCaptcha = new ReCaptcha($secret);
if ($_POST["g-recaptcha-response"]) {
$response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
define('HOST','localhost');
define('USER','root');
define('PASS','root');
define('DB','Question_Paper_Generator');
session_start();
$con = mysqli_connect(HOST,USER,PASS,DB);
$username = $_POST['uname'];
$password =md5($_POST['password']);
var_dump($password);
$sql = "select * from Teacher where '$username'=Teacher_ID and '$password'=Password";
$res = mysqli_query($con,$sql);
$check = mysqli_fetch_array($res);
if(isset($check)){
echo "<script>>console.log('done')</script>";
}
if(isset($check)and $response != null && $response->success){
$date=date("Y/m/d");
$time=date("h:i:sa");
$type='Faculty';
$sql2 = "insert into Login_History values('$date','$time','$username','$type')" ;
mysqli_query($con,$sql2);
echo 'success';
$_SESSION['username']=$username;
echo "<script>self.location='faculty/facultydash.php'</script>";
}else{
echo "<script>alert('Failed!');</script>";
echo "<script>self.location='login_fac.html'</script>";
}
mysqli_close($con);
?>