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.

    0