forked from sahilhbti/online-voting-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxyz.php
52 lines (44 loc) · 1.51 KB
/
xyz.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
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
$x = $_REQUEST['add'];
$y = $_REQUEST['vot'];
$z = $_REQUEST['acc'];
$conn = new mysqli("localhost","root","","election");
$sql = "SELECT COUNT(*) FROM bharat WHERE aadhar = '$x' AND vote_id = '$y' AND phone = '$z' AND done = 'false'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
{
$GLOBALS['check'] = $row["COUNT(*)"];
}
if ($check == '0') {
}
else
{
$apiKey = urlencode('IZq/OQ26W18-pBn3cKDVBj5j3MZQ3dTZHjdI8PIpqB');
// Message details
$numbers = array($z);
$sender = urlencode('TXTLCL');
$nu = rand(10000,19999);
$message = rawurlencode($nu);
$numbers = implode(',', $numbers);
// Prepare data for POST request
$data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
// Send the POST request with cURL
$ch = curl_init('https://api.textlocal.in/send/');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$sql = "UPDATE bharat SET otp='$nu' WHERE aadhar = '$x' AND vote_id = '$y' AND phone = '$z' AND done = 'false'";
$result = $conn->query($sql);
echo 1234;
}
?>
</body>
</html>