salve a tutti, ho utilizzato l'ipn di paypal per il mio sito, avendo aggiornato il php da 5.3 a 5.5 non funziona più la funziona sqlsrv_query apposto di essa ho usato odbc_exec che dovrebbe funzionare, invece non aggiorna nulla al database, la connessione con odbc_connecct funziona tutto okay, ma il resto no potete aiutarmi perfavore?
Codice PHP:
<?php error_reporting(E_ALL); // Require the configuration file require_once('../config.php'); // The current time $time = date("F j, Y, g:i a");
// The database connection info //$connection_info = array("UID" => $DATABASE_USER, "PWD" => $DATABASE_PASS, "Database" => $USER_DATABASE); $conn = odbc_connect("Driver={SQL Server};Server=$DATABASE_HOST;Database=$USER_DATABASE",$DATABASE_USER,$DATABASE_PASS) or die('Database Connection Error!'); if(!$conn){ exit("Connection failed:".odbc_errormsg()); } // Connect to the server //$con = sqlsrv_connect($DATABASE_HOST, $connection_info);
if (!$conn) die ("failed"); // The e-mail of the user submitting the payment $payer_email = isset($_REQUEST['payer_email']) ? $_REQUEST['payer_email'] : die("Payer email value not set!"); // The email of the user receiving the payment $receiver_email = isset($_REQUEST['receiver_email']) ? $_REQUEST['receiver_email'] : die("Receiver email value not set!"); // The payment status $payment_status = isset($_REQUEST['payment_status']) ? $_REQUEST['payment_status'] : die("Payment status value not set!"); // The amount paid $amount_paid = isset($_REQUEST['mc_gross']) ? $_REQUEST['mc_gross'] : die("Amount paid value not set!"); // The tax paid $tax_paid = isset($_REQUEST['tax']) ? $_REQUEST['tax'] : die("Tax value not set!"); // Check if the payment status is completed, and the receiver email matches that in the configuration if ($payment_status == "Completed" && $receiver_email == $PAYMENT_EMAIL) { // The custom field set, to verify the correct details $custom_variable = isset($_REQUEST['custom']) ? $_REQUEST['custom'] : die("Custom value not set!");
// Split the field to an array $custom_array = explode(":", $custom_variable); // The User ID $user_id = $custom_array[0]; // The custom amount paid $custom_paid = $custom_array[1]; $insert_amountpay=odbc_exec($conn, "INSERT INTO PS_UserData.dbo.DonationTest (message, UserId) VALUES ('Amount paid: '$amount_paid', Custom paid: '$custom_paid ', Tax: ' $tax_paid '!', ' $user_id ')"); // Check if the product id exists if (isset($DONATION_VALUES[$custom_paid])) { // The entry $entry = $DONATION_VALUES[$custom_paid]; $insert_tax=odbc_exec($conn, "INSERT INTO PS_UserData.dbo.DonationTest (message) VALUES ('Tax paid: '$tax_paid'!')"); // Calculate the expected amount $expected_amount = ($tax_paid != 0 ? ($amount_paid + $tax_paid) : $amount_paid); // Check the price and amount paid match if ($custom_paid == $expected_amount) { $pagamento = odbc_exec($conn,"INSERT INTO PS_UserData.dbo.DonationTest (message, UserId) VALUES ('Points added: '$entry ' ! to', '$user_id')"); // The amount of points to give $points = $entry; // Check if the connection failed if (!$conn) die("Connection to the database failed!"); // The query $updatepoints = odbc_exec($conn, "UPDATE PS_UserData.dbo.Users_Master SET Point += '$points' WHERE UserId = '$user_id'"); // End the script die("Donation successful! '$points' has been added to: ' $user_id'"); } else { die("Request tempered! Mismatching payment amount!"); } } else { die("Value not found!"); } } odbc_close($conn);?>
fino quando c'era la funziona sqlsrv_query funzionava, effettuando questa modifica in odbc_exec non funziona più, usando il sandbox comunica con ipn e manda tutto il necessario, però alla verifica delle query non funziona.
Utilizzo php 5.5.36 ed sql server 2012
Grazie ancora