Файл: Source/inc/sms/example.php
Строк: 67
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
require_once (realpath(dirname(__FILE__)."/../")."/auth/config.php");
//set true if you want to use script for billing reports
//first you need to enable them in your account
$billing_reports_enabled = false;
// check that the request comes from Fortumo server
if(!in_array($_SERVER['REMOTE_ADDR'],
array('79.125.125.1', '79.125.5.205',
'79.125.5.95', '54.72.6.126', '54.72.6.27', '54.72.6.17', '54.72.6.23'))) {
header("HTTP/1.0 403 Forbidden");
die("Error: Unknown IP");
}
// check the signature
$secret = 'f2bd30790afb5360cf15ceeb1f79db27'; // insert your secret between ''
if(empty($secret) || !check_signature($_GET, $secret)) {
header("HTTP/1.0 404 Not Found");
die("Error: Invalid signature");
}
$sender = $_GET['sender'];
$message = $_GET['message'];
$message_id = $_GET['message_id'];
$keyword = $_GET['keyword'];
$price = $_GET['price'];
$sms_text=$_REQUEST['message'];
$username = str_replace("TXT PLAY4","",$sms_text);// edit you TXT
//unique id
//hint:use message_id to log your messages
//additional parameters: country, price, currency, operator, keyword, shortcode
// do something with $sender and $message
$reply = "
tekstsms: $message<br />
username: $username<br />
keyword: $keyword<br />
price: $price<br />
";
$result = mysql_query("SELECT * FROM vn_users WHERE user='{$username}'") or die(mysql_error());
$row = mysql_fetch_array($result);
$id_user = $row['id'];
$date = time();
$points = 300 + $row['points']; //edit you points (now is 300)
mysql_query("UPDATE vn_users SET points='$points' WHERE user='$username'") or die(mysql_error());
mysql_query("INSERT INTO `vn_sms` (
`id` ,
`userid` ,
`code` ,
`sms` ,
`points` ,
`date` ,
`ip`
)
VALUES (
NULL , '$id_user', '$sms_text', '$sms_text', '$points', '$date', '$ip'
)") or die(mysql_error());
echo "Successfully been added points to your account.";
if($billing_reports_enabled
&& preg_match("/Failed/i", $_GET['status'])
&& preg_match("/MT/i", $_GET['billing_type'])) {
// find message by $_GET['message_id'] and suspend it
}
function check_signature($params_array, $secret) {
ksort($params_array);
$str = '';
foreach ($params_array as $k=>$v) {
if($k != 'sig') {
$str .= "$k=$v";
}
}
$str .= $secret;
$signature = md5($str);
return ($params_array['sig'] == $signature);
}
?>