Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php namespace Listener;
- require('PaypalIPN.php');
- use PaypalIPN;
- $ipn = new PaypalIPN();
- // Use the sandbox endpoint during testing.
- $ipn->useSandbox();
- $verified = $ipn->verifyIPN();
- if ($verified) {
- ////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////TEST PDF/////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////////////
- use \setasign\Fpdi;
- // require_once('fpdf/fpdf.php');
- // require_once('fpdi2/src/autoload.php');
- require_once('fpdf181/fpdf.php');
- require_once('fpdf181/fpdi/autoload.php');
- // initiate FPDI
- $pdf = new Fpdi\Fpdi();
- // add a page
- $pdf->AddPage();
- // set the source file
- $pdf->setSourceFile("templatedoc.pdf");
- // import page 1
- $tplIdx = $pdf->importPage(1);
- // use the imported page and place it at point 10,10 with a width of 100 mm
- $pdf->useImportedPage($tplIdx, 10, 10, 100);
- // now write some text above the imported page
- $pdf->SetFont('Helvetica');
- $pdf->SetTextColor(255, 0, 0);
- $pdf->SetXY(30, 30);
- $pdf->Write(0, 'This is just a simple text');
- // $pdf->Output();
- $dir = "/pdf/";
- $file = 'test.pdf';
- $dir_file = $dir.$file;
- $pdf->Output($dir_file,'F');
- ////////////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////MAIL DE CONFIRMATION A L'ACHETEUR///////////////////////////
- ////////////////////////////////////////////////////////////////////////////////////////
- $mail_From = "From: Equipe du Gala de l'IUT de Troyes <gala.iuttroyes2018@gmail.com>\r\n";
- $mail_From .= "MIME-Version: 1.0\r\n";
- $mail_From .= "Content-Type: text/html; charset=UTF-8\r\n";
- $mail_To = $_POST['payer_email'];
- $mail_Subject = "Confirmation de paiement";
- $message = '<html><body>';
- $message .= '
- <table style="width: 1355px; border-color: #080707;" border="10">
- <tbody>
- <tr style="border-color: #0d0b0b;">
- <td style="width: 1920px; background-color: #6b6969; text-align: center;"><img class="aligncenter wp-image-365" src="http://gala-etudiants.iut-troyes.univ-reims.fr/wp-content/uploads/2018/02/blanc-sans-fond.png" alt="" width="394" height="238" /></td>
- </tr>
- </tbody>
- </table>
- <p> </p>
- <p><span style="font-size: 20px;"><strong>Cher '.$_POST['first_name'].' '.$_POST['last_name'].',</strong></span></p>
- <p>Votre commande a bien été prise en compte et vous recevrez sous 48 heures votre billet par mail.<br />N'oubliez-pas de vous munir d'une carte d'identité et du billet imprimé lors de votre entrée au Gala sinon nous serons obligé de vous refuser!</p>
- <p>Pour plus d'informations concernant le Gala, n'hésitez pas à vous rendre aux liens suivants ci ce n'est déjà fait:</p>
- <ul>
- <li>Accès: <a href="http://gala-etudiants.iut-troyes.univ-reims.fr/acces/">http://gala-etudiants.iut-troyes.univ-reims.fr/acces/</a></li>
- <li>Entrée: <a href="http://gala-etudiants.iut-troyes.univ-reims.fr/entree/">http://gala-etudiants.iut-troyes.univ-reims.fr/entree/</a></li>
- <li>Artistes: <a href="http://gala-etudiants.iut-troyes.univ-reims.fr/artistes/">http://gala-etudiants.iut-troyes.univ-reims.fr/artistes/</a></li>
- </ul>
- <p>Si vous avez des questions, n'hésitez pas à nous envoyer un mail: Cliquez <a href="mailto:gala.iuttroyes2018@gmail.com">ICI</a></p>
- <p>Rendez-vous le 31 mars!</p>
- <p> - L'Equipe de l'edition 2018 du Gala de l'IUT de Troyes</p>
- <hr />
- <p><strong>Reçu de Commande Numéro: </strong>'.$_POST['receipt_ID'].'</p>
- <p> </p>
- <table style="width: 408px;">
- <tbody>
- <tr>
- <td style="width: 267px;">Nom</td>
- <td style="width: 149px;">'.$_POST['last_name'].'</td>
- </tr>
- <tr>
- <td style="width: 267px;">Prénom</td>
- <td style="width: 149px;">'.$_POST['first_name'].'</td>
- </tr>
- <tr>
- <td style="width: 267px;">Numéro de Commande</td>
- <td style="width: 149px;">'.$_POST['txn_id'].'</td>
- </tr>
- <tr>
- <td style="width: 267px;">Produit</td>
- <td style="width: 149px;">'.$_POST['item_name1'].'</td>
- </tr>
- <tr>
- <td style="width: 267px;">Quantité </td>
- <td style="width: 149px;">'.$_POST['quantity'].'</td>
- </tr>
- <tr>
- <td style="width: 267px;"> </td>
- <td style="width: 149px;"> </td>
- </tr>
- <tr>
- <td style="width: 267px;">Total</td>
- <td style="width: 149px;">'.$_POST['mc_gross'].'</td>
- </tr>
- </tbody>
- </table>
- ';
- $message .= '</body></html>';
- mail($mail_To, $mail_Subject, $message, $mail_From);
- /////////////////////////////////////////////////////////////////////////
- /////////////////INSCRIPTION DANS BDD DES INFOS POUR LOGS////////////////
- /////////////////////////////////////////////////////////////////////////
- $servername = "xxxx";
- $username = "xxxx";
- $password = "xxxx";
- $dbname = "xxxx";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $sql = "INSERT INTO xxxx (nom, prenom, email, numcommande, numrecu, produit, quantite, heureprocess)
- VALUES (
- '".$_POST['last_name']."',
- '".$_POST['first_name']."',
- '".$_POST['payer_email']."',
- '".$_POST['txn_id']."',
- '".$_POST['receipt_ID']."',
- '".$_POST['item_name1']."',
- '".$_POST['quantity']."',
- '".$_POST['payment_date']."'
- )";
- if (mysqli_query($conn, $sql)) {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . mysqli_error($conn);
- }
- mysqli_close($conn);
- }
- // Reply with an empty 200 response to indicate to paypal the IPN was received correctly.
- header("HTTP/1.1 200 OK");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement