Código PHP:
<?php
// Main Settings - Edit this lines
$options = array (
'DBHost' => 'localhost',
'DBUser' => 'sa',
'DBPass' => '********',
'DBName' => '******',
'PasswordName' => 'pid',
'PasswordValue' => '*******',
'CashPerSMS' => '1000',
);
// Main Source - No edit required, do it just if you know
class sql {
// Constructor
function sql() {
global $options;
$this->connection = @mysql_connect($options['DBHost'],$options['DBUser'],$options['DBPass'])
OR die('MySQL Connection Error...');
mysql_select_db($options['DBName'])
OR die();
}
function query($query) {
$result = mysql_query($query,$this->connection) or die ('Error MySQL: '.mysql_error());
return $result;
}
function fetchrow($result) {
return mysql_fetch_row($result);
}
function fetcharray($result, $type = MYSQL_ASSOC) {
return mysql_fetch_array($result,$type);
}
function numrows($result) {
return mysql_num_rows($result);
}
function escapestr($string)
{
return mysql_escape_string($string);
}
function freeresult($result)
{
mysql_free_result($result);
}
} // Sql Class
if( isset($_GET['code']) && isset($_GET['login']) && isset($_GET['country']) && isset($_GET[$options['PasswordName']]) && $_GET[$options['PasswordName']] == $options['PasswordValue'] )
{
$mysql = new sql();
$login = $mysql->escapestr(trim($_GET['login']));
$code = $_GET['code'];
$country = $mysql->escapestr(trim($_GET['country']));
// Searching for the Account
$result = $mysql->query("SELECT `id`, `coins` FROM `account` WHERE `login` = '$login';");
$data = $mysql->fetcharray($result);
if (count($data) != 0) {
$puntos['VE'] = 4;
$puntos['AT'] = 7;
$puntos['SZ'] = 9;
$puntos['DE'] = 7;
$puntos['ES'] = 22;
$puntos['BE'] = 11;
$puntos['MX'] = 5;
$puntos['HO'] = 12;
$puntos['AR'] = 5;
$puntos['AU'] = 11;
$puntos['BO'] = 6;
$puntos['CH'] = 4;
$puntos['CO'] = 7; //etc etc!
$puntos['EC'] = 5;
$puntos['FR'] = 10;
$puntos['IR'] = 12;
$puntos['NO'] = 14;
$puntos['PE'] = 4;
$puntos['PT'] = 10;
$puntos['SE'] = 17;
$id = $data['id'];
$coins = $data['coins'];
// Update Account, adding Cash Points
$mysql->query("UPDATE `account` SET `coins` = `coins` + '" . $puntos[$country] . "' WHERE `id` = '$id'");
// Log Entry to the Database
$mysql->query("INSERT INTO `smslog` (`id`, `login`, `code`, `country`, `time`) VALUES ('$id', '$login', '$code', '$country', NOW())");
// Confirmation Message
// You can edit it but do not remove the first OK because it confirms to sepomo the SMS have been registered.
echo 'OK Gracias por tu aporte. Tus Coins pronto estaran disponibles. MT2 Guabina';
}
else
{
// Log Wrong SMS - Can be found with account_id = 0
$mysql->query("INSERT INTO `smslog` (`id`, `login`, `code`, `country`, `time`) VALUES ('0', '$login', '$code', '$country', NOW())");
echo 'Error!!!';
}
}
else echo 'Parametros erroneos';
?>