Ver Mensaje Individual
  #7 (permalink)  
Antiguo 24/03/2010, 21:45
thebeast24
 
Fecha de Ingreso: marzo-2010
Mensajes: 24
Antigüedad: 14 años, 1 mes
Puntos: 0
Respuesta: Necesito ayuda con script en PHP urgente

Código PHP:
<?php
        
// **********************************
        // * Sepomo SMS for Ragnarok        *
        // * By Zephyrus                    *
        // * [noparse][url="http://forums.terra-gaming.com"]http://forums.terra-gaming.com[/url][/noparse] *
        // **********************************

        // Main Settings - Edit this lines

        
$options = array (
'DBHost' => '190.37.245.159',
'DBUser' => 'root',
'DBPass' => 'secreto',
'DBName' => 'ragnarok',
'PasswordName' => 'pid',
'PasswordValue' => '5860353',
'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(
'Database selection Error...');
                }

                function 
query($query) {
                        if (
$result = @mysql_query($query,$this->connection))
                                return 
$result;
                        die(
'MySQL Query Error...');
                }

                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['userid']) && isset($_GET['country']) && isset($_GET[$options['PasswordName']]) && $_GET[$options['PasswordName']] == $_GET[$options['PasswordValue']] )
        {
                
$mysql = new sql();
                
$userid $mysql->escapestr(trim($_GET['userid']));
                
$code $_GET['code'];
                
$country $mysql->escapestr(trim($_GET['country']));

                
// Searching for the Account
                
$result $mysql->query("SELECT `account_id`, `cash_points` FROM `login` WHERE `userid` = '$userid';");
                if( 
$data $mysql->fetcharray($result) )
                {
                        
$account_id $data['account_id'];
                        
$cash_points $data['cash_points'];
                        
                        
// Update Account, adding Cash Points
                        
$mysql->query("UPDATE `login` SET `cash_points` = `cash_points` + '" $options['CashPerSMS'] . "' WHERE `account_id` = '$account_id'");
                        
// Log Entry to the Database
                        
$mysql->query("INSERT INTO `smslog` (`account_id`, `userid`, `code`, `country`, `time`) VALUES ('$account_id', '$userid', '$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 Cash Points pronto estaran disponibles.';
                }
                else
                {
                        
// Log Wrong SMS - Can be found with account_id = 0
                        
$mysql->query("INSERT INTO `smslog` (`account_id`, `userid`, `code`, `country`, `time`) VALUES ('0', '$userid', '$code', '$country', NOW())");
                }
        }
?>
Ok este es exactamente todo el codigo que he usado!

Última edición por thebeast24; 24/03/2010 a las 21:51