forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changelograting.php
72 lines (56 loc) · 2.38 KB
/
changelograting.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
<?php
/* * *************************************************************************
./changelograting.php
-------------------
begin : March 20 2014
copyright : (C) 2004 The OpenCaching Group
@author triPPer - triPPer1971@wp.pl
* ************************************************************************* */
/* * *************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ************************************************************************* */
/* * **************************************************************************
Unicode Reminder メモ
remove a watch from the watchlist
* ************************************************************************** */
//prepare the templates and include all neccessary
require_once('./lib/common.inc.php');
//Preprocessing
if ($error == false) {
//cacheid
$log_id = 0;
if (isset($_REQUEST['logid'])) {
$log_id = intval($_REQUEST['logid']);
}
//user logged in?
if ($usr == false) {
tpl_redirect('login.php');
} else if (!isset($_REQUEST["logid"]) or ! isset($_REQUEST["target"]) or ! isset($_REQUEST["cacheid"]) or ! isset($_REQUEST["posY"])) {
tpl_redirect("index.php");
} else {
$nLogId = $_REQUEST["logid"];
$sTarget = $_REQUEST["target"];
$sCacheId = $_REQUEST["cacheid"];
$nPosY = $_REQUEST["posY"];
$query = "SELECT 1 FROM log_rating WHERE log_id =:1 and user_id=:2";
$dbc = new dataBase();
$dbc->multiVariableQuery($query, $nLogId, $usr["userid"]);
if ($dbc->rowCount() == 0) { //add
$cDT = new DateTime();
$currDate = $cDT->format('Y-m-d H:m:s');
$query = "INSERT INTO log_rating (log_id, user_id, date) VALUES( :1, :2, :3 )";
$dbc->multiVariableQuery($query, $nLogId, $usr["userid"], $currDate);
} else {
$query = "DELETE FROM log_rating WHERE log_id =:1 and user_id=:2";
$dbc->multiVariableQuery($query, $nLogId, $usr["userid"]);
}
}
$sTarget .= "?cacheid=" . $sCacheId . "&posY=" . $nPosY;
tpl_redirect($sTarget);
}
?>