forked from Thisishowwedoit/2Moons-Revolution-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ivn.php
64 lines (45 loc) · 1.69 KB
/
ivn.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
<?php
#Example PHP Postback Script
// Your Database Connection Details
$host = 'localhost';
$db_name = '';
$db_user = '';
$db_password = '';
mysql_connect($host, $db_user, $db_password);
mysql_select_db($db_name);
function _VoteReward($userId, $userIp, $valid) {
//if(!$voted[0]) {
if($valid == 1) {
// Make userid safe to use in query
$userId = mysql_real_escape_string($userId);
$timer = time();
$timer += 12 * 60 * 60;
// Check if that user voted already
// Adjust this query to match your table, column names etc
//$voted = mysql_fetch_array(mysql_query("SELECT voted FROM vote_list WHERE user = '".$userId."'"));
//if(!$voted[0]) {
// User has not voted, grant him reward, for example points
mysql_query("UPDATE `uni1_users` SET `darkmatter` = `darkmatter` + '40000', v3 = '".$timer."' WHERE `id` = '".mysql_escape_string($userId)."';");
mysql_query("INSERT INTO uni1_votesystem_log VALUES ('".mysql_escape_string($userId)."','".$timer."','3', '1') ;");
//}
//else {
// Do whatever you want if he voted already. Maybe a log of false votes
// }
}
}
//-------------------------- Don't change anything below this! ----------------------------- //
$ipsWhitelist = array('78.46.67.100');
$userId = isset($_POST['userid']) ? $_POST['userid'] : null;
$userIp = isset($_POST['userip']) ? $_POST['userip'] : null;
$valid = isset($_POST['voted']) ? intval($_POST['voted']) : 0;
$result = false;
if (!empty($userId) && !empty($userIp)) {
_VoteReward($userId, $userIp, $valid);
$result = true;
}
if ($result) {
echo 'OK';
}
//Close Connection
mysql_close();
?>