$value) { error_log("[$key] = $value\r\n", 3, "log/robox.log"); } $oid=$_POST["InvId"]; error_log("uuid= ".$shp_uid."\r\n", 3, "log/robox.log"); error_log("itid= ".$shp_item."\r\n", 3, "log/robox.log"); error_log("itam= ".$out_summ."\r\n", 3, "log/robox.log"); $query="SELECT * FROM Tarifs WHERE Tarifs.COID='".$shp_item."'"; error_log("".$query."\r\n", 3, "log/robox.log"); $q2 = mysql_query($query,$conn); $rows2 = mysql_num_rows($q2); if($rows2>0) { $tarifName = mysql_result($q2, 0, 'Tarifs.Name'); $del_q = "DELETE FROM robox_trn WHERE ID='".$inv_id."' AND Owner='".$shp_uid."'"; mysql_query($del_q,$conn); $itprice=mysql_result($q2,0,"Tarifs.Price"); $query="INSERT INTO Payments (Owner,ID,Descript,Sum) VALUES ('".$shp_uid."','".$inv_id."','".$shp_item."','".$out_summ."')"; error_log("".$query."\r\n", 3, "log/robox.log"); mysql_query($query,$conn); $query="UPDATE Izdan SET Izdan.Tarif='".mysql_result($q2,0,"Tarifs.Name")."' WHERE Izdan.Num='".$shp_mid."'"; error_log("".$query."\r\n", 3, "log/robox.log"); mysql_query($query,$conn); $query="SELECT * FROM Izdan WHERE Izdan.Num='".$shp_mid."'"; error_log("".$query."\r\n", 3, "log/robox.log"); $q3 = mysql_query($query,$conn); $rows3 = mysql_num_rows($q3); if($rows3>0) { // $pos=stripos($shp_item,"_"); // $len=strlen($shp_item); // $ptil=substr($shp_item,$pos+1,$len-($pos+1)); $pos = explode('_', $shp_item); $ptil = explode('m', end($pos)); $OwnerUser = mysql_result($q3, 0, 'Izdan.Owner'); $namePublication = mysql_result($q3, 0, 'Izdan.Name'); $ptil_old = (strcmp(mysql_result($q3,0,"Izdan.PaidTill"),date('Y-m-d H:i:s'))>=0)?mysql_result($q3,0,"Izdan.PaidTill"):"now()"; $query="UPDATE Izdan SET Izdan.PaidTill=DATE_ADD(".$ptil_old.",INTERVAL ".$ptil[0]." MONTH) WHERE Izdan.Num='".$shp_mid."'"; error_log("".$query."\r\n", 3, "log/robox.log"); mysql_query($query,$conn); $AvailableNumberCount = mysql_result($q3, 0, 'Izdan.AvailableNumberCount'); $AvailableNumberCount += $ptil[0]; $query = "UPDATE Izdan SET Izdan.AvailableNumberCount = '$AvailableNumberCount' WHERE Izdan.Num='$shp_mid'"; error_log("".$query."\r\n", 3, "log/robox.log"); mysql_query($query,$conn); } $downl_old = (mysql_result($q3,0,"Izdan.Downloads") > 0)?mysql_result($q2,0,"Tarifs.MaxDownloads")+mysql_result($q3,0,"Izdan.Downloads"):mysql_result($q2,0,"Tarifs.MaxDownloads"); $query="UPDATE Izdan SET Izdan.Downloads='".$downl_old."' WHERE Izdan.Num='".$shp_mid."'"; error_log("".$query."\r\n", 3, "log/robox.log"); mysql_query($query,$conn); $OwnerUser = intval($OwnerUser); $query = "SELECT EMail FROM Users WHERE Users.Num = '$OwnerUser'"; $result = mysql_query($query); if( mysql_num_rows($result) > 0 ) $UserEmail = mysql_result($result, 0, 'Users.EMail'); $to = 'support@publishlike.com'; $subject = 'Оплата тарифа через сервис Робокасса'; $message = 'Номер транзакции: ' . $inv_id . "\n"; $message .= 'Емайл владельца публикации: ' . $UserEmail . "\n"; $message .= 'Название публикации: ' . $namePublication . "\n"; $message .= 'Тариф: ' . $tarifName . "\n"; $message .= 'Сумма оплаты: ' . $out_summ . "\n"; $header = "Content-Type: text/plain; charset=UTF-8" . "\r\n"; $header .= "From: " . "\r\n"; mail( $to, $subject, $message, $header ); } echo 'OK'.$inv_id; }else{ $del_q = "DELETE FROM robox_trn WHERE ID='".$inv_id."' AND Owner='".$shp_uid."'"; mysql_query($del_q,$conn); error_log("ERR: invalid signature", 3, "log/robox.log"); echo "ERR: invalid signature"; exit(); } } ?>