-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckToken.php
More file actions
52 lines (45 loc) · 1.08 KB
/
checkToken.php
File metadata and controls
52 lines (45 loc) · 1.08 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
<?php
// Start the session
session_start();
?>
<?php
//echo "Token Expire";
if(isset($_POST['token']))
{
$token=$_POST['token'];
$servername = "127.0.0.1";
$username = "root";
$password = "password";
$dbname = "shareDatabase";
// Create connection
$conn = new mysqli($servername, $username, $password,$dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
$sql = "SELECT * FROM `shareData` WHERE token = '$token'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$data= $row["jsonData"];
$myscope=$row["scope"];
$ed=$row["expiryDate"];
}
} else {
//echo "0 results";
}
mysqli_close($conn);
$_SESSION['scopeData']=$data;
date_default_timezone_set("Europe/London");
$today_date=date('Y-m-d');
if(strtotime($today_date) > strtotime($ed)){
header("Location: expireToken.html"); /* Redirect browser */
//echo "Token Expire";
// exit();
}
else{
header("Location: index.php?token=$token");
}
}
?>