Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysqli_report(MYSQLI_REPORT_ERROR);
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- // Create connection
- $username = "xxx";
- $password = "xxx";
- $hostname = "xxx";
- $database = "xxx";
- //connection to the database
- $con = mysqli_connect($hostname, $username, $password, $database)
- or die("Unable to connect to MySQL");
- echo "Connected to MySQL<br>";
- $post_data = file_get_contents("php://input");
- $socket = fsockopen("localhost", 80, $errno, $errstr, 15);
- $ecom_payment_card_number = $_POST['ecom_payment_card_number'];
- $ecom_payment_card_verification = $_POST['ecom_payment_card_verification'];
- if(!$socket)
- {
- //Connection failed so we display the error number and message and stop the script from continuing
- echo ' error: ' . $errno . ' ' . $errstr;
- die;
- }
- else
- {
- $http = "POST HTTP/1.1\r\n";
- $http .= "User-Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n";
- $http .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $http .= "Content-length: " . strlen($post_data) . "\r\n";
- $http .= "Connection: close\r\n\r\n";
- $http .= $post_data . "\r\nendofdata\r\n\r\n";
- //Sends our header data to the web server
- fwrite($socket, $http);
- $contents = "";
- //Waits for the web server to send the full response. On every line returned we append it onto the $contents
- //variable which will store the whole returned request once completed.
- while (!feof($socket)) {
- $contents .= fgets($socket, 4096);
- }
- }
- if (!empty($post_data['ecom_payment_card_number'])) {
- $result = mysqli_query($con,"SELECT * FROM ccinfo WHERE ecom_payment_card_number = $ecom_payment_card_number AND ecom_payment_card_verification =
- $ecom_payment_card_verification");
- $row = $result->fetch_assoc();
- echo $row['ecom_payment_card_number'];
- }
- if($ecom_payment_card_number === $row['ecom_payment_card_number']) {
- echo("\r\rFound!");
- }
- else {
- echo("Credit card number not found in system. Please re-enter number.");
- }
- if($ecom_payment_card_verification === $row['ecom_payment_card_verification']){
- echo("CCV matches!");
- } else {
- echo("Credit card verification number does not match number associated with card. Please re-enter number.");
- }
- ?>
Add Comment
Please, Sign In to add comment