-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallow.php
86 lines (69 loc) · 1.78 KB
/
allow.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
include_once "db_connect.php";
// Start the session (DON'T FORGET!!)
session_start();
include_once "check_session.php";
include_once "meta.php";
include_once "header.php";
?>
<?php
$user = $_SESSION['simcal_username'];
$query = "SELECT * FROM share";
$result = mysql_query($query);
$exist = 0;
$act = 1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if (($row['activation'] == 0) && ($row['username'] == $user)){
$fname = $row['grant_access'];
$shareid = $row['sid'];
$exist = 1;
break;
}}
if ($exist = 1)
{
//mysql_select_db('simcaldb')or die('Error, cannot select mysql database');
$query = "UPDATE share SET activation = '$act'". "WHERE sid = '$shareid'";
mysql_query($query) or die('Error, insert share table failed');
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert share table failed');
}
$query = "SELECT * FROM share";
$result = mysql_query($query);
$exist = 0;
$act = 1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if (($row['activation'] == 0) && ($row['username'] == $user)){
$fname = $row['grant_access'];
$shareid = $row['sid'];
$exist = 1;
break;
}
}
if ($exist == 1)
{echo "<p>Do you allow ". $fname ." to see your personal calendar?</p>";
?>
<script>
function allow(){
document.form1.action="allow.php";
document.form1.submit();
}
function reject(){
document.form1.action="reject.php";
document.form1.submit();
}
</script>
<form name="form1">
<input type="button" name="btn1" value="Allow" onclick="allow();">
<input type="button" name="btn2" value="Reject" onclick="reject();">
</form>
<?php
}
else
{
echo '<script type="text/javascript">';
echo "\n<!--\n";
echo "\twindow.location = 'userpanel.php';\n";
echo "\n--></script>\n";
}
include "footer.php";
?>