These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | $config = parse_ini_file('config/config.ini.php'); |
||
4 | if(!isset($_GET['pw']) || $config['pw'] != $_GET['pw']) |
||
5 | { |
||
6 | error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php'); |
||
7 | $respone = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php',"success" => false); |
||
8 | echo json_encode($response); |
||
9 | |||
10 | die(); |
||
11 | } |
||
12 | |||
13 | include 'php/jodel-web.php'; |
||
14 | |||
15 | if(isset($_GET['solution']) && isset($_GET['key']) && isset($_POST['deviceUid'])) |
||
16 | { |
||
17 | $jodelAccount = new JodelAccount($_POST['deviceUid']); |
||
18 | $response = array("success" => $jodelAccount->verifyCaptcha()); |
||
19 | echo json_encode($response); |
||
20 | die(); |
||
21 | } |
||
22 | |||
23 | $message = ""; |
||
24 | $success = true; |
||
25 | $token = ""; |
||
26 | if(isset($_POST['vote']) && isset($_POST['postId'])) |
||
27 | { |
||
28 | $i = 0; |
||
29 | $result = $db->query("SELECT access_token, device_uid FROM accounts WHERE device_uid NOT IN (SELECT device_uid FROM votes WHERE postId = '" . $_POST['postId'] . "')"); |
||
30 | |||
31 | if($result->num_rows > 0) |
||
32 | { |
||
33 | $row = $result->fetch_assoc(); |
||
34 | $accessToken = $row['access_token']; |
||
35 | $deviceUid = $row['device_uid']; |
||
36 | |||
37 | $jodelAccount = new JodelAccount($deviceUid); |
||
38 | |||
39 | if(!$jodelAccount->isAccountVerified()) |
||
40 | { |
||
41 | $view = new View(); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
42 | $message = "This account is not verified. Please verify this account first."; |
||
43 | $captcha = $view->getCaptcha($accessToken); |
||
44 | $success = false; |
||
45 | } |
||
46 | else |
||
47 | { |
||
48 | $jodelAccount->votePostId($_POST['postId'], $_POST['vote']); |
||
49 | } |
||
50 | } |
||
51 | else |
||
52 | { |
||
53 | $message = 'There is no account available for this jodel. Please create at least one new account to vote this jodel.'; |
||
54 | $success = false; |
||
55 | } |
||
56 | } |
||
57 | |||
58 | if (isset($captcha)) |
||
59 | { |
||
60 | $response = array("success" => $success, "message" => $message, "captcha" => $captcha, "deviceUid" => $deviceUid); |
||
61 | } |
||
62 | else |
||
63 | { |
||
64 | $response = array("success" => $success, "message" => $message); |
||
65 | } |
||
66 | echo json_encode($response); |
||
67 | ?> |