It is necessary to fasten the payment gateway Robokassa to the landing page. All settings are made in the system. Then I created a html page with the form, I passed the fields to the buyerβs Mile and sent it to the handler, made according to the platform template (robocash boxes). I try to make payment real in 1 ruble, everything passes ok. The money comes in, the redirection to the right page in the success.php file is configured, but the letter does not go to the buyer by mail with a link to the purchase. Tell me what cant. I tried using session to transfer the received data in variables to the file result, but it does not work, I tried to connect the handler file to result and also did not help. Here is the result code
<? // ΡΠ΅Π³ΠΈΡΡΡΠ°ΡΠΈΠΎΠ½Π½Π°Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ (ΠΏΠ°ΡΠΎΠ»Ρ #2) // registration info (password #2) $mrh_pass2 = "ΠΏΠ°ΡΡ2"; //ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ° ΡΠ΅ΠΊΡΡΠ΅Π³ΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ //current date $tm=getdate(time()+9*3600); $date="$tm[year]-$tm[mon]-$tm[mday] $tm[hours]:$tm[minutes]:$tm[seconds]"; // ΡΡΠ΅Π½ΠΈΠ΅ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠΎΠ² // read parameters $out_summ = $_REQUEST["OutSum"]; $inv_id = $_REQUEST["InvId"]; $shpa_item = $_REQUEST["Shpa_item"]; $crc = $_REQUEST["SignatureValue"]; $shpb_mulo = $_POST['Shpb_mulo']; // ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ $shpc_names = $_POST['Shpc_names']; // ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ $shpd_url = $_REQUEST["Shpd_url"]; $crc = strtoupper($crc); $my_crc = strtoupper(md5("$out_summ:$inv_id:$mrh_pass2:Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url")); // ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° ΠΊΠΎΡΡΠ΅ΠΊΡΠ½ΠΎΡΡΠΈ ΠΏΠΎΠ΄ΠΏΠΈΡΠΈ // check signature if ($my_crc != $crc) { //require 'http://mysaita.ru/lend/action.php'; echo "OK$InvId\n"; //if($_SERVER['REQUEST_METHOD'] == 'POST') { //$shpc_names = $_POST['Shpc_names']; //$shpb_mulo = $_POST['Shpb_mulo']; //session_start(); //$shpb_mulo = $_SESION['Shpb_mulo']; //mail("tstas2004@bk.ru", "ΠΠΎΠΊΡΠΏΠΊΠ°", "ΠΠΎΡ Π²Π°ΠΌ ΡΡΡΠ»ΠΊΠ° Π½Π° ΠΏΠΎΠΊΡΠΏΠΊΡ: https://yadi.sk/d/pk9V9ood3QheoA"); } exit(); } else { echo "bad sign\n"; exit(); } // Π·Π°ΠΏΠΈΡΡ Π² ΡΠ°ΠΉΠ» ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΠΈ ΠΎ ΠΏΡΠΎΠ²Π΅Π΄Π΅Π½Π½ΠΎΠΉ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΈ // save order info to file $f=@fopen("order.txt","a+") or die("error"); fputs($f,"order_num :$inv_id;Summ :$out_summ;Date :$date\n"); fclose($f); ?>
Here is the handler code
<? session_start(); $_SESSION['b'] = "A ΠΠ΅Π½Ρ Π·Π°Π΄Π°Π»ΠΈ Π½Π° action.php"; $_SESSION['c'] = "A ΠΠ΅Π½Ρ Π’ΠΠΠΠΠΠΠ Π·Π°Π΄Π°Π»ΠΈ Π½Π° action.php"; if(!empty($_POST["shpc_names"]) && !empty($_POST["Shpb_mulo"])){ // Π΅ΡΠ»ΠΈ Π±ΡΠ» ΠΏΠΎΡΡ $shpc_names = trim(htmlspecialchars(strip_tags(base64_encode(urlencode($_POST["shpc_names"]))))); // ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ Ρ ΡΠΎΡΠΌΡ $shpb_mulo = trim(htmlspecialchars(strip_tags(base64_encode(urlencode($_POST["Shpb_mulo"]))))); // ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ Ρ ΡΠΎΡΠΌΡ } if($_SERVER['REQUEST_METHOD'] == 'POST') { $shpc_names = $_POST['Shpc_names']; $shpb_mulo = $_POST['Shpb_mulo']; //mail($shpb_mulo, "ΠΠΎΠΊΡΠΏΠΊΠ°", "ΠΠΎΡ Π²Π°ΠΌ ΡΡΡΠ»ΠΊΠ° Π½Π° ΠΏΠΎΠΊΡΠΏΠΊΡ: https://yadi.sk/d/pk9V9ood3QheoA"); $_SESION['S'] = $shpb_mulo; //header("Location: /success.php"); } //$_SESION['Shpb_mulo'] = $shpb_mulo; // 1. // ΠΠΏΠ»Π°ΡΠ° Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΡΡΠΌΠΌΡ Ρ Π²ΡΠ±ΠΎΡΠΎΠΌ Π²Π°Π»ΡΡΡ Π½Π° ΡΠ°ΠΉΡΠ΅ ΠΌΠ΅ΡΡΠ°Π½ΡΠ° // Payment of the set sum with a choice of currency on merchant site // ΡΠ΅Π³ΠΈΡΡΡΠ°ΡΠΈΠΎΠ½Π½Π°Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ (Π»ΠΎΠ³ΠΈΠ½, ΠΏΠ°ΡΠΎΠ»Ρ #1) // registration info (login, password #1) $mrh_login = "mysaitaru"; $mrh_pass1 = "b1SvoA5gI1zaLaaKau95"; // Π½ΠΎΠΌΠ΅Ρ Π·Π°ΠΊΠ°Π·Π° // number of order $inv_id = "0"; // ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ Π·Π°ΠΊΠ°Π·Π° // order description $inv_desc = "Universal Landing"; // ΡΡΠΌΠΌΠ° Π·Π°ΠΊΠ°Π·Π° // sum of order $out_summ = "0.85"; // ΡΠΈΠΏ ΡΠΎΠ²Π°ΡΠ° // code of goods $shpa_item = "1"; // ΠΠ΄ΡΠ΅Ρ ΡΠ»Π΅ΠΊΡΡΠΎΠ½Π½ΠΎΠΉ ΠΏΠΎΡΡΡ ΠΏΠΎΠΊΡΠΏΠ°ΡΠ΅Π»Ρ // E-mail //$shpb_mulo = $_POST['Shpb_mulo']; $shpb_mulo = $_SESION['Shpb_mulo']; $shpc_names = $_POST['shpc_names']; $shpd_url = "bit.ly/2CzDpSE"; // ΡΡΠ»ΠΊΠ° Π½Π° ΡΠΎΠ²Π°Ρ // ΠΏΡΠ΅Π΄Π»Π°Π³Π°Π΅ΠΌΠ°Ρ Π²Π°Π»ΡΡΠ° ΠΏΠ»Π°ΡΠ΅ΠΆΠ° // default payment e-currency $in_curr = ""; // ΡΠ·ΡΠΊ // language $culture = "ru"; // ΠΊΠΎΠ΄ΠΈΡΠΎΠ²ΠΊΠ° // encoding $encoding = "utf-8"; // ΡΠΎΡΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΏΠΎΠ΄ΠΏΠΈΡΠΈ // generate signature $crc = md5("$mrh_login:$out_summ:$inv_id:$mrh_pass1:Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url"); // ΠΠ΅ΡΠ΅Π½Π°ΠΏΡΠ°Π²Π»ΡΠ΅ΠΌ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ Π½Π° ΡΡΡΠ°Π½ΠΈΡΡ ΠΎΠΏΠ»Π°ΡΡ header("Refresh: 5; https://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin=$mrh_login&OutSum=$out_summ&InvId=$inv_id&IncCurrLabel=$in_curr". "&Desc=$inv_desc&SignatureValue=$crc&Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url". "&Culture=$culture&Encoding=$encoding"); echo 'Π§Π΅ΡΠ΅Π· 5 ΡΠ΅ΠΊΡΠ½Π΄ Π²Ρ Π±ΡΠ΄Π΅ΡΠ΅ ΠΏΠ΅ΡΠ΅Π½Π°ΠΏΡΠ°Π²Π»Π΅Π½Ρ Π½Π° ΡΡΡΠ°Π½ΠΈΡΡ ΠΎΠΏΠ»Π°ΡΡ'; //require 'http://mysaita.ru/lend/action.php'; //$shpb_mulo = $_POST['Shpb_mulo']; //Header("Location: http://mysaita.ru/lend/success.php?get=$shpb_mulo"); ?>
Here is the code for success.php
<? session_start(); // ΡΠ΅Π³ΠΈΡΡΡΠ°ΡΠΈΠΎΠ½Π½Π°Ρ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ (ΠΏΠ°ΡΠΎΠ»Ρ #1) // registration info (password #1) $mrh_pass1 = "ΠΏΠ°ΡΡ1"; // ΡΡΠ΅Π½ΠΈΠ΅ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠΎΠ² // read parameters $out_summ = $_REQUEST["OutSum"]; $inv_id = $_REQUEST["InvId"]; $shpa_item = $_REQUEST["Shpa_item"]; $crc = $_REQUEST["SignatureValue"]; $shpb_mulo = $_POST['Shpb_mulo']; // Π΅ΡΠ»ΠΈ Π½ΡΠΆΠ½ΠΎ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ $shpc_names = $_POST['Shpc_names']; // Π΅ΡΠ»ΠΈ Π½ΡΠΆΠ½ΠΎ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ $shpd_url = $_REQUEST["Shpd_url"]; // Π΅ΡΠ»ΠΈ Π½ΡΠΆΠ½ΠΎ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ $crc = strtoupper($crc); $my_crc = strtoupper(md5("$out_summ:$inv_id:$mrh_pass1:Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url")); // ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° ΠΊΠΎΡΡΠ΅ΠΊΡΠ½ΠΎΡΡΠΈ ΠΏΠΎΠ΄ΠΏΠΈΡΠΈ // check signature if ($my_crc != $crc) { header('Refresh: 5; url=http://mysaita.ru/lend/11/index.html'); echo 'Π§Π΅ΡΠ΅Π· 5 ΡΠ΅ΠΊΡΠ½Π΄ Π²Ρ Π±ΡΠ΄Π΅ΡΠ΅ ΠΏΠ΅ΡΠ΅Π½Π°ΠΏΡΠ°Π²Π»Π΅Π½Ρ Π½Π° Π³Π»Π°Π²Π½ΡΡ ΡΡΡΠ°Π½ΠΈΡΡ ΡΠ°ΠΉΡΠ°'; //require 'http://mysaita.ru/lend/action.php'; //if($_SERVER['REQUEST_METHOD'] == 'POST') { // $shpc_names = $_POST['Shpc_names']; //$shpb_mulo = $_POST['Shpb_mulo']; //mail($shpb_mulo, "ΠΠΎΠΊΡΠΏΠΊΠ°", "ΠΠΎΡ Π²Π°ΠΌ ΡΡΡΠ»ΠΊΠ° Π½Π° ΠΏΠΎΠΊΡΠΏΠΊΡ: https://yadi.sk/d/pk9V9ood3QheoA"); //} echo "OK$InvId\n"; // session_start(); require 'http://mysaita.ru/lend/11/action.php'; $shpb_mulo = $_SESION['S']; //$_SESION['Shpb_mulo'] = $shpb_mulo; //$get=$_GET[get]; echo '<pre>'; var_dump($shpb_mulo); echo '</pre>'; mail($shpb_mulo, "ΠΠΎΠΊΡΠΏΠΊΠ°", "ΠΠΎΡ Π²Π°ΠΌ ΡΡΡΠ»ΠΊΠ° Π½Π° ΠΏΠΎΠΊΡΠΏΠΊΡ: https://yadi.sk/d/pk9V9ood3QheoA"); // ΠΎΡΠΊΡΡΠ²Π°Π΅ΠΌ ΡΠ΅ΡΡΠΈΡ // session_start(); echo $_SESSION['a']; echo $_SESSION['b']; echo $_SESSION['c']; echo $_SESSION['S']; echo $_SESSION['d']; //} exit(); } else { echo "bad sign\n"; exit(); } // ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° Π½Π°Π»ΠΈΡΠΈΡ Π½ΠΎΠΌΠ΅ΡΠ° ΡΡΠ΅ΡΠ° Π² ΠΈΡΡΠΎΡΠΈΠΈ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ // check of number of the order info in history of operations $f=@fopen("order.txt","r+") or die("error"); while(!feof($f)) { $str=fgets($f); $str_exp = explode(";", $str); if ($str_exp[0]=="order_num :$inv_id") { echo "ΠΠΏΠ΅ΡΠ°ΡΠΈΡ ΠΏΡΠΎΡΠ»Π° ΡΡΠΏΠ΅ΡΠ½ΠΎ\n"; echo "Operation of payment is successfully completed\n"; } } fclose($f); ?>
As a test, I launched two sessions in the handler, it displays them on the success.php page, and the value of the variable from (customer mail) does not substitute. If I send directly from stock, then the mail goes away. If I put my mail address as a variable, the letter also leaves. I inserted the direct address into result, sending does not work, the direct address only works in success.php, although according to the documentation, sending the letter needs to be packed into result. In success.php, the connection to the action.php handler is triggered, but the variable never catches. I tried to display var_dump before the mail function. Displays NULL. Can someone tell me what the problem is. I will be grateful.