Jump to content

caslas

New Members
  • Posts

    3
  • Joined

  • Last visited

caslas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Good day, I have a pin/token system stored in mysql database for online registration, I also have an online payment system that accepts debit cards. I need a code so as to automatically show a pin to a user who has made payment and also an sms/email carrying the pin/token. i have a payment page that verifies cards and debits the user called verify.php with code <?php /** * Verify SimplePay transaction */ $private_key = 'test_pr_demo'; // put here your private key // Retrieve data returned in payment gateway callback $token = $_POST["sp_token"]; $amount = $_POST["sp_amount"]; $amount_currency = $_POST["sp_currency"]; $sp_status = $_POST["sp_status"]; $transaction_id = $_POST["transaction_id"]; // we don't really need this here, is just an example $data = array( 'token' => $token, 'amount' => $amount, 'amount_currency' => $amount_currency ); $data_string = json_encode($data); // Call to charge/verify a payment $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://checkout.simplepay.ng/v2/payments/card/charge/'); curl_setopt($ch, CURLOPT_USERPWD, $private_key . ':'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string) )); $curl_response = curl_exec($ch); $curl_response = preg_split("/\r\n\r\n/", $curl_response); $response_content = $curl_response[1]; $json_response = json_decode(chop($response_content), TRUE); print_r($json_response); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($response_code == '200') { // even is http status code is 200 we still need to check transaction had issues or not if ($json_response['response_code'] == '20000') { // card was successfully charged header('Location: success.html'); } else { // failed to charge the card header('Location: failed.html'); } } else if ($sp_status == 'true') { // even though it failed the call to card charge, card payment was already processed header('Location: success.html'); } else { // failed to charge the card header('Location: failed.html'); } ?> and after, it redirects to success.html. My pins are stored in a database. thank you.
  2. Pls i need your help.i have a pxroject that am working on..i dont know if u can help me with the one time password.thus so that if a student tried to access his/her result,he needs to enter a pin and his/her id number...and he can only use the pin 5 times..here is my script..am not that mfamiliar with php..thank u.. and again,i dont know if its possible that i will just give out password to different student inform of a pin.so that any student can log in with any pin from the database..and automatically recognises the students id with pin together..like an e pin..thanks and also the tables to create in my sql db... include('admin/connection.php'); include('sanitise.php'); $student_id = sanitise($_POST['student_id']); $password = sanitise($_POST['password']); $qry = mysql_query("SELECT * FROM register_staff WHERE student_id = '$student_id' AND password = '$password'"); $count = mysql_num_rows($qry); if($count==1) { session_start(); $_SESSION['student_id'] = $student_id; header('Location: student/index.php'); } else { echo "Invalid ID number or Username"; } ?>
  3. Pls i need your help.i have a pxroject that am working on..i dont know if u can help me with the one time password.thus so that if a student tried to access his/her result,he needs to enter a pin and his/her id number...and he can only use the pin 5 times..here is my script..am not that mfamiliar with php..thank u.. and again,i dont know if its possible that i will just give out password to different student inform of a pin.so that any student can log in with any pin from the database..and automatically recognises the students id with pin together..like an e pin..thanks and also the tables to create in my sql db... include('admin/connection.php'); include('sanitise.php'); $student_id = sanitise($_POST['student_id']); $password = sanitise($_POST['password']); $qry = mysql_query("SELECT * FROM register_staff WHERE student_id = '$student_id' AND password = '$password'"); $count = mysql_num_rows($qry); if($count==1) $RemoveRS__query=sprintf("DELETE FROM register_staff WHERE username='%s' AND password='%s' LIMIT 1", get_magic_quotes_gpc()? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc()? $password : addslashes($password)); mysql_query($RemoveRS__query, $rsLogin.php) or die(mysql_error()); { session_start(); $_SESSION['student_id'] = $student_id; header('Location: student/index.php'); } else { echo "Invalid ID number or Username"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.