Jump to content
  • 0

[REQUEST]SCRIPT


Question

Posted

 

Here is the script for http://2pay.pro/!But for some reason it does not wanna work!

Can somebody look at this code,and see if something is wrong!

It is not coded by me,i found it on some forum!

If somebody could get this working it would really help many users of this forum to have good donation system!

As they have over 60 payment options!

----------------------------------------------------------------------------------------------------------------------------

<?php

 

//

//

 

 

header( 'Content-type: text/xml' );

//Ип адреса, с которых будет приходить запрос. Для защиты.

$check_ip[]="82.146.40.60";

$check_ip[]="188.120.245.101";

$check_ip[]="188.120.245.102";

    $date=date("d.m.y");

//======================================настройки============================================

// Секретный ключ

$secret_key = "your-secret-key";

// Переменные для подключения к базе данных, впишите те, которые использовали при установке базы данных

$server='localhost';

$user='user';

$pass='password';

$db='l2jdb';

//===========================================================================================

    $flag = $_REQUEST['command'];

    $md5 = $_REQUEST['md5'];

 

// Идентификатор платежа

$v1 = $_REQUEST['v1'];

 

 

if( isset($_REQUEST['id']) ) $id=$_REQUEST['id']; else $id=0;

$kod=1;

 

// Проверка ип

if (in_array($_SERVER['REMOTE_ADDR'], $check_ip)) {

 

// Подключение к базе данных

mysql_connect($server, $user, $pass) or die("Can't connect to database");

mysql_select_db($db) or die("Can't select database ".$db);

 

// Если статус запрос

if( ($flag == 'check') && ($md5 == md5($flag.$v1.$secret_key)) ) {

// Поиск персонажа

$sql=mysql_query("SELECT * FROM `account` WHERE `username`='".$v1."' LIMIT 0, 1");

$rows = mysql_num_rows($sql);

if ($rows > 0) {

$kod=0;

$desc='Character exists';

} else {

$kod=1;

$desc='Character not found';

}

} else {

  // Если команда на платеж

if( ($flag == 'pay') && ($md5 == md5($flag.$v1.$id.$secret_key)) )  {

 

$sql=mysql_query("SELECT * FROM `2pay_payment` WHERE `id`='".$id."'");

$rows = mysql_num_rows($sql);

                // Если платеж был проведен ранее

if ($rows > 0)

{

$kod=0;

$desc='Payment was send earlier';

} else

{  // Иначе пытаемся провести платеж

 

$item_count=$_REQUEST['sum']; // Количество монет для зачисления, полученное в запросе

 

$sql=mysql_query("SELECT * FROM `account` WHERE `username`='".$v1."' LIMIT 0, 1");

$character=mysql_fetch_array($sql);

$account_ref=$character['account_name'];

 

                    // Если персонаж найден

if(mysql_num_rows($sql)==1) {

// Добавляем персонажу количество купленных монет

$sql=mysql_query("INSERT INTO `your_table` (`owner_id`,`item_id`,`count`,`enchant_level`,`flags`,`payment_status`, `description`) VALUES ('".$character['obj_Id']."','".$item."','".$item_count."','0','0','0', '2pay date ".$date." ".$v1."')") or die(mysql_error());

// Указываем таблицу для даты, суммы, и айди платежа ее я залил вместе со скриптом

$sql=mysql_query("INSERT INTO `2pay_payment` (`count`,`date`,`id`) VALUES ('".$_REQUEST['sum']."','".$date."','".$_REQUEST['id']."')");

 

 

$kod=0;

    $desc="ok";

} else

{

$kod=2;

    $desc="Character not found";

}

}

} else

{  // // Обработка исключения: если не совпал md5 или неизвестный запрос

$kod=2;

$desc="Unknown request or account not found";

}

}

} else { $desc="Parametrs or IP is not correct"; }

// Ответ

    if ($flag == 'status') {$html="<?xml version=\"1.0\" encoding=\"windows-1251\"?><response><result>".$kod."</result></response>"; } else

    {$html="<?xml version=\"1.0\" encoding=\"windows-1251\"?><response><id>".$id."</id><sum>".$_REQUEST['sum']."</sum><result>".$kod."</result><comment>".$desc."</comment></response>"; }

echo $html;

?>

5 answers to this question

Recommended Posts

  • 0
Posted

<?php

 

//

//

 

 

header( 'Content-type: text/xml' );

//IP ADDRESS WHICH WILL SEND REQUEST.FOR SECURITY REASON

$check_ip[]="82.146.40.60";

$check_ip[]="188.120.245.101";

$check_ip[]="188.120.245.102";

    $date=date("d.m.y");

//======================================SETUP============================================

// SECRET KEY

$secret_key = "&f:GI1+v0[|IX%Y?#L.DXg+|i]?N!zXe";

// MYSQL DETAILS

$server='localhost';

$user='user';

$pass='password';

$db='l2jdb';

//===========================================================================================

    $flag = $_REQUEST['command'];

    $md5 = $_REQUEST['md5'];

 

// PAYMENT IDENTICIFATION KEY

$v1 = $_REQUEST['v1'];

 

 

if( isset($_REQUEST['id']) ) $id=$_REQUEST['id']; else $id=0;

$kod=1;

 

// IP CHEK

if (in_array($_SERVER['REMOTE_ADDR'], $check_ip)) {

 

// CONNECTING TO DATABASE

mysql_connect($server, $user, $pass) or die("Can't connect to database");

mysql_select_db($db) or die("Can't select database ".$db);

 

// IF REQUEST STATUS

if( ($flag == 'check') && ($md5 == md5($flag.$v1.$secret_key)) ) {

// FINDING CHARACTER

$sql=mysql_query("SELECT * FROM `account` WHERE `username`='".$v1."' LIMIT 0, 1");

$rows = mysql_num_rows($sql);

if ($rows > 0) {

$kod=0;

$desc='Character exists';

} else {

$kod=1;

$desc='Character not found';

}

} else {

  // If command for payment

if( ($flag == 'pay') && ($md5 == md5($flag.$v1.$id.$secret_key)) )  {

 

$sql=mysql_query("SELECT * FROM `2pay_payment` WHERE `id`='".$id."'");

$rows = mysql_num_rows($sql);

                // If payment was made before

if ($rows > 0)

{

$kod=0;

$desc='Payment was send earlier';

} else

{  // Trying to make payemnt

 

$item_count=$_REQUEST['sum']; // Ammount of rewards

 

$sql=mysql_query("SELECT * FROM `account` WHERE `username`='".$v1."' LIMIT 0, 1");

$character=mysql_fetch_array($sql);

$account_ref=$character['account_name'];

 

                    // IF CHARACTER NOT FOUND

if(mysql_num_rows($sql)==1) {

// SENDING REWARD TO CHARACTER

$sql=mysql_query("INSERT INTO `your_table` (`owner_id`,`item_id`,`count`,`enchant_level`,`flags`,`payment_status`, `description`) VALUES ('".$character['obj_Id']."','".$item."','".$item_count."','0','0','0', '2pay date ".$date." ".$v1."')") or die(mysql_error());

// TABLE TO SHOW DATE/TIME/SUM of payment

$sql=mysql_query("INSERT INTO `2pay_payment` (`count`,`date`,`id`) VALUES ('".$_REQUEST['sum']."','".$date."','".$_REQUEST['id']."')");

 

 

$kod=0;

    $desc="ok";

} else

{

$kod=2;

    $desc="Character not found";

}

}

} else

{  // // Exception,if MD5 is wrong or wrong request was sent

$kod=2;

$desc="Unknown request or account not found";

}

}

} else { $desc="Parametrs or IP is not correct"; }

// Ответ

    if ($flag == 'status') {$html="<?xml version=\"1.0\" encoding=\"windows-1251\"?><response><result>".$kod."</result></response>"; } else

    {$html="<?xml version=\"1.0\" encoding=\"windows-1251\"?><response><id>".$id."</id><sum>".$_REQUEST['sum']."</sum><result>".$kod."</result><comment>".$desc."</comment></response>"; }

echo $html;

?>

 

----------------------------------------------------------------------------------------------------------------

Here it is with english comments!

This is automatic payment script,using system 2pay.pro!

Players pay money and get rewards!

But for some reason i can not get it to work!

It is really good payment system!

  • 0
Posted
<?php

// 
// 


   header( 'Content-type: text/xml' );
//IP ADDRESS WHICH WILL SEND REQUEST.FOR SECURITY REASON
   $check_ip[]="82.146.40.60";
   $check_ip[]="188.120.245.101";
   $check_ip[]="188.120.245.102";
    $date=date("d.m.y");
//======================================SETUP============================================
// SECRET KEY
   $secret_key = "&f:GI1+v0[|IX%Y?#L.DXg+|i]?N!zXe";
// MYSQL DETAILS
   $server='localhost';
   $user='user';
   $pass='password';
   $db='l2jdb';
//===========================================================================================
    $flag = $_REQUEST['command'];
    $md5 = $_REQUEST['md5'];

// PAYMENT IDENTICIFATION KEY
   $v1 = $_REQUEST['v1'];


   if( isset($_REQUEST['id']) ) $id=$_REQUEST['id']; else $id=0;
   $kod=1;

// IP CHEK
   if (in_array($_SERVER['REMOTE_ADDR'], $check_ip)) {

// CONNECTING TO DATABASE
   mysql_connect($server, $user, $pass) or die("Can't connect to database");
   mysql_select_db($db) or die("Can't select database ".$db);

      // IF REQUEST STATUS
      if( ($flag == 'check') && ($md5 == md5($flag.$v1.$secret_key)) ) {
         // FINDING CHARACTER
         $sql=mysql_query("SELECT * FROM `account` WHERE `username`='".$v1."' LIMIT 0, 1");
         $rows = mysql_num_rows($sql);
         if ($rows > 0) {
            $kod=0;
            $desc='Character exists';
         } else {
            $kod=1;
            $desc='Character not found';
         }
      } else {
         // If command for payment
         if( ($flag == 'pay') && ($md5 == md5($flag.$v1.$id.$secret_key)) )  {

            $sql=mysql_query("SELECT * FROM `2pay_payment` WHERE `id`='".$id."'");
            $rows = mysql_num_rows($sql);
                // If payment was made before
            if ($rows > 0)
            {
               $kod=0;
               $desc='Payment was send earlier';
            } else
            {   // Trying to make payemnt

               $item_count=$_REQUEST['sum']; // Ammount of rewards

               $sql=mysql_query("SELECT * FROM `account` WHERE `username`='".$v1."' LIMIT 0, 1");
               $character=mysql_fetch_array($sql);
               $account_ref=$character['account_name'];

                    // IF CHARACTER NOT FOUND
               if(mysql_num_rows($sql)==1) {
               // SENDING REWARD TO CHARACTER
                  $sql=mysql_query("INSERT INTO `your_table` (`owner_id`,`item_id`,`count`,`enchant_level`,`flags`,`payment_status`, `description`) VALUES ('".$character['obj_Id']."','".$item."','".$item_count."','0','0','0', '2pay date ".$date." ".$v1."')") or die(mysql_error());
               // TABLE TO SHOW DATE/TIME/SUM of payment
                  $sql=mysql_query("INSERT INTO `2pay_payment` (`count`,`date`,`id`) VALUES ('".$_REQUEST['sum']."','".$date."','".$_REQUEST['id']."')");


                  $kod=0;
                   $desc="ok";
               } else
               {
                  $kod=2;
                   $desc="Character not found";
               }
            }
         } else
         {   // // Exception,if MD5 is wrong or wrong request was sent
            $kod=2;
            $desc="Unknown request or account not found";
         }
      }
   } else {      $desc="Parametrs or IP is not correct";   }
// Ответ
    if ($flag == 'status') {$html="<?xml version=\"1.0\" encoding=\"windows-1251\"?><response><result>".$kod."</result></response>"; } else
    {$html="<?xml version=\"1.0\" encoding=\"windows-1251\"?><response><id>".$id."</id><sum>".$_REQUEST['sum']."</sum><result>".$kod."</result><comment>".$desc."</comment></response>"; }
   echo $html;
?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...