-
Notifications
You must be signed in to change notification settings - Fork 1
/
process.php
60 lines (39 loc) · 1.37 KB
/
process.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
<?php
////////////////////////////////////////////
// safe code //
////////////////////////////////////////////
// $mysqli = new mysqli("server", "username", "password", "database_name");
// // TODO - Check that connection was successful.
// $unsafe_variable = $_POST["user-input"];
// $stmt = $mysqli->prepare("INSERT INTO table (column) VALUES (?)");
// // TODO check that $stmt creation succeeded
// // "s" means the database expects a string
// $stmt->bind_param("s", $unsafe_variable);
// $stmt->execute();
// $stmt->close();
// $mysqli->close();
////////////////////////////////////////////
// safe code //
////////////////////////////////////////////
error_reporting( E_ALL );
require_once 'connect.php';
//Fetching Values from URL
$usrid = $_POST['usrid'];
$topid = $_POST['topid'];
$cstat = $_POST['cstat'];
if (isset($cstat)) {
if ($cstat=='ON') {
$sql = "UPDATE `task_reg` SET `payment`='1' WHERE (`top_id`='".$topid."' AND `use_id`='".$usrid."') ";
}elseif ($cstat=='OFF') {
$sql = "UPDATE `task_reg` SET `payment`='0' WHERE (`top_id`='".$topid."' AND `use_id`='".$usrid."') ";
}
if(mysqli_query($link,$sql)){
echo "Working good ".$sql;
}else {
echo "error";
echo $sql." ". mysqli_error($link);
}
}
// clossing connection
mysqli_close($link);
?>