-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempindex.php
More file actions
64 lines (38 loc) · 1.51 KB
/
tempindex.php
File metadata and controls
64 lines (38 loc) · 1.51 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
include "config.php";
session_start();
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== "vote" ||$_SESSION['loggedin'] === "CE" ||$_SESSION['loggedin'] === "EC"||$_SESSION['loggedin'] === "IT"|| $_SESSION['loggedin']==="dean" || $_SESSION['loggedin']==="adm" ){
header("location: error.php");
exit;
}
$stmt1="SELECT start_time FROM admins WHERE Branch='Dean' ";
$stmt2="SELECT end_time FROM admins WHERE Branch='Dean' ";
$pstmt1 = mysqli_prepare($link, $stmt1);
mysqli_stmt_execute($pstmt1);
$presult1 = mysqli_stmt_get_result($pstmt1);
$pstmt2 = mysqli_prepare($link, $stmt2);
mysqli_stmt_execute($pstmt2);
$presult2 = mysqli_stmt_get_result($pstmt2);
if ((mysqli_num_rows($presult1) && (mysqli_num_rows($presult2)) > 0)){
$row1 = mysqli_fetch_assoc($presult1);
$row2 = mysqli_fetch_assoc($presult2);
$start_time=$row1['start_time'];
$end_time=$row2['end_time'];
$current_time=time();
if ($current_time >= $start_time && $current_time <= $end_time) {
$_SESSION['loggedin']="trialindex";
header("location:trialindex.php");
}else if($start_time==0){
$_SESSION['loggedin']="before";
header("location:beforetime.php");
}
else if($current_time<=$start_time){
$_SESSION['loggedin']="before";
header("location:beforetime.php");
}
else if($current_time >= $end_time){
$_SESSION['loggedin']="result";
header("location:resultcount.php");
}
}
?>