N
N
nsmilyk2019-09-20 16:20:12
PHP
nsmilyk, 2019-09-20 16:20:12

How to set up an entry in the database after paying through Yandex?

There is a site with https protocol, and configured https notifications, payment is made through custom. There is a handler file.

<?
$secret_key = '';


$post_str = $_POST['notification_type'] . '&'. $_POST['operation_id']. '&' . $_POST['amount'] . '&643&' . $_POST['datetime'] . '&'. $_POST['sender'] . '&' . $_POST['codepro'] . '&' . $secret_key. '&' .  $_POST['need-email'] ;

$sha1 = sha1( $post_str );

if( $sha1 != $_POST['sha1_hash'] )
{

  exit;
}




$dbc = mysqli_connect();

$username = $_POST['need-email'] ;
$sql = "INSERT INTO `signup` (username) VALUES ('$username')";
mysqli_query($dbc,$sql);




?>

The point here is to make an entry in the table with the email. But Alas .. The line is created, but the email is not registered. More than 5 purchases were made in the screenshot and all in the same spirit. What do you think could be the problem?
5d84d1d35aab7245783891.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2019-09-20
@DOG729

$dbc  = mysqli_connect($servername, $username, $password, $database);
$sql = "INSERT INTO signup (username) VALUES ('".$username?$username:'Упс кажется параметр пуст'."')";
if (mysqli_query($conn, $sql)) {
      //return
} else {
      echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($dbc);

K
kolu3310, 2021-09-13
@kolu3310

Doesn't add any data at all, I need to add urlsite, text, ip
<?
$secret_key = '';
$post_str = $_POST['notification_type'] . '&'. $_POST['operation_id']. '&' . $_POST['amount'] . '&643&' . $_POST['datetime'] . '&'. $_POST['sender'] . '&' . $_POST['codepro'] . '&' . $secret_key. '&' . $_POST['need-email'] ;
$sha1 = sha1( $post_str );
if( $sha1 != $_POST['sha1_hash'] )
{
exit;
}
include "admin/config/config.php";
$dbc = mysqli_connect();
$text = $_POST['need-email'] ;
$sql = "

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question