· 5 years ago · Jun 28, 2020, 06:02 AM
1// Secret Key of your Paygol account
2$secret_key = "2bc75ddc-8457-11e7-b7cb-128b57940774";
3
4// Secret key validation
5if ($secret_key != $_GET['key']) {
6 echo "Validation error";
7 exit;
8}
9
10// Custom parameter
11$custom = $_GET['custom'];
12
13// Get price and currency. Price always has a decimal point and 2 decimals (e.g. 10.00 EUR, 9000.00 CLP).
14$frmprice = $_GET['frmprice'];
15$frmcurrency = $_GET['frmcurrency'];
16
17// Get points based on the price and currency.
18switch ($frmprice." ".$frmcurrency){
19
20 // Possible prices and their points. You can add as many as you want.
21 case "3.00 EUR": $points = 25; break;
22 case "5.00 EUR": $points = 50; break;
23 case "10.00 EUR": $points = 105; break;
24 case "50.00 EUR": $points = 600; break;
25 case "100.00 EUR": $points = 1350; break;
26
27 // If the price doesn't match any of the options above, stop script.
28 default: echo "Price validation failed";
29 exit;
30
31}
32
33// Replace this information with your database details
34$dbhost = ""; //Your database domain
35$dbuser = ""; //Database username
36$dbpassword = ""; //Database password
37$db = ""; //Database name
38
39// Connect to database
40$conn = mysqli_connect($dbhost, $dbuser, $dbpassword);
41
42// Select database
43mysqli_select_db($conn, $db);
44
45// Update points
46$sql = "UPDATE `accounts`
47 SET `premium_points` = `premium_points`+$points
48 WHERE `name` = '".mysqli_real_escape_string($conn, $custom)."'";
49mysqli_query($conn, $sql);
50
51// Close database connection
52mysqli_close($conn);
53
54?>