Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define("_VALID_PHP", true);
- function debugPP($string)
- {
- $file = "debug.txt";
- $open = fopen($file, "a");
- fwrite($open, $string);
- }
- if (isset($_POST['payment_status'])) {
- require_once('config.php');
- require_once('global.php');
- require_once('mail/PHPMailerAutoload.php');
- set_time_limit(0);
- function verifyTxnId($txn_id, $odb)
- {
- $sql = $odb->prepare("SELECT COUNT(id) FROM `payment_logs` WHERE tid = :tid LIMIT 1");
- $sql -> execute(array(":tid" => $txn_id));
- if ($sql -> fetchColumn(0) > 0)
- return false;
- else
- return true;
- }
- $req = 'cmd=_notify-validate';
- foreach ($_POST as $key => $value) {
- $value = urlencode(stripslashes($value));
- $req .= '&' . $key . '=' . $value;
- }
- $demo = false;
- $url = 'www.paypal.com';
- $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
- $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
- $fp = fsockopen($url, 80, $errno, $errstr, 30);
- $payment_status = $_POST['payment_status'];
- $receiver_email = $_POST['business'];
- list($membership_id, $user_id) = explode("_", $_POST['item_number']);
- $mc_gross = $_POST['mc_gross'];
- $txn_id = $_POST['txn_id'];
- debugPP("Selecting Price\n");
- $getxn_id = verifyTxnId($txn_id, $odb);
- $pricesql = $odb -> prepare("SELECT `price` FROM `packages` WHERE id = :id");
- $pricesql -> execute(array(":id" => (int)$membership_id));
- $price = $pricesql -> fetchColumn(0);
- debugPP("Selecting Client's PayPal Email\n");
- $pp_emailsql = $odb -> query("SELECT `paypal` FROM `settings` LIMIT 1");
- $pp_email = $pp_emailsql->fetchColumn(0);
- if (!$fp) {
- echo $errstr . ' (' . $errno . ')';
- } else {
- fputs($fp, $header . $req);
- debugPP("Phase 1\n");
- while (!feof($fp)) {
- $res = fgets($fp, 1024);
- debugPP("Phase 2\n");
- if (strcmp($res, "VERIFIED") == 0) {
- if (preg_match('/Completed/', $payment_status)) {
- debugPP("Phase 3\n");
- if($mc_gross == $price){
- debugPP("price check success!");
- $SQLGetUser = $odb -> prepare("SELECT `username` FROM `accounts` WHERE `id` = :id");
- $SQLGetUser -> execute(array(':id' => $user_id));
- $payerusername = $SQLGetUser -> fetchColumn(0);
- debugPP("Phase 6\n");
- $SQLGetUserInfo = $odb -> prepare("SELECT `username`,`email`,`rVPN`,`expire` FROM `accounts` WHERE `id` = :id LIMIT 1");
- $SQLGetUserInfo -> execute(array(':id' => $user_id));
- $userInfo = $SQLGetUserInfo -> fetch(PDO::FETCH_ASSOC);
- $userMail = $userInfo['email'];
- $userName = $userInfo['username'];
- $currpass = $userInfo['rVPN'];
- $currexpire = $userInfo['expire'];
- //GET PACKAGE DETAILS
- $SQLGetPackages = $odb -> prepare("SELECT * FROM `packages` WHERE `id` = :id LIMIT 1");
- $SQLGetPackages -> execute(array(':id' => $membership_id));
- $getInfo = $SQLGetPackages -> fetch(PDO::FETCH_ASSOC);
- $portforward = $getInfo['pfenabled'];
- $plength = $getInfo['length'];
- $unit = $getInfo['unit'];
- if ($currpass != 0 && $currexpire != 0) {
- $newExpire = strtotime("+{$plength} {$unit}", $currexpire);
- $update1 = $odb -> prepare("UPDATE `accounts` SET `expire` = :expire WHERE `id` = :id");
- $update1 -> execute(array(':expire' => $newExpire, ':id' => $user_id));
- $maildate = date("m-d-Y h:i:s A", $newExpire);
- //Mail VPN Information
- $mailcontent = 'Hello '.$userName.', <br><br> Your vpn account has been extended until <b>'.$maildate.'</b><br><br>Thank you!';
- $from = $gsetting -> getSiteMail($odb);
- $fromname = $gsetting -> getSiteTitle($odb);
- $mail = new PHPMailer;
- if ($rvpnmailer == 'php') {
- $mail->isSendmail();
- } else {
- $mail->isSMTP();
- $mail->SMTPSecure = $smtpauthtype;
- $mail->Host = $rshost;
- $mail->Port = $rsport;
- $mail->SMTPAuth = $smtpauthstat;
- $mail->Username = $rsuser;
- $mail->Password = $rspass;
- }
- $mail->setFrom($from, $fromname);
- $mail->addReplyTo($from, $fromname);
- $mail->addAddress($userMail, $userName);
- $mail->Subject = 'VPN Login Information';
- $mail->msgHTML($mailcontent);
- $mail->send();
- } else {
- $newExpire = strtotime("+{$plength} {$unit}");
- debugPP("Phase 7\n");
- $update1 = $odb -> prepare("UPDATE `accounts` SET `expire` = :expire WHERE `id` = :id");
- $update1 -> execute(array(':expire' => $newExpire, ':id' => $user_id));
- $update2 = $odb -> prepare("UPDATE `accounts` SET `pfoption` = :pfoption WHERE `id` = :id");
- $update2 -> execute(array(':pfoption' => $portforward, ':id' => $user_id));
- debugPP("Phase 8\n");
- $vpnPass = $rvpn -> genPass();
- //$update3 = $odb -> prepare("UPDATE `accounts` SET `rVPN` = :rvpn WHERE `id` = :id");
- //$update3 -> execute(array(':rvpn' => $vpnPass, ':id' => $user_id));
- debugPP("Phase 9\n");
- //Check if there an offline server and save action for it
- //$rvpn -> saveAction($odb, 'create', $user_id, $vpnPass, 0, 0);
- //debugPP("Phase 10\n");
- //Create VPN Account
- $rvpn -> createVPNAccount($rad, $user_id, $vpnPass, $encryptionKey);
- debugPP("Phase 11\n");
- //Mail VPN Information
- //$mailcontent = 'Hello, <br><br> Below you can find your vpn client login information: <br>Username: '.$user_id.'<br>Password: '.$vpnPass.'<br><br>Thank you!';
- $mailcontent = 'Hello '.$userName.',
- <br>
- PLEASE READ THIS EMAIL IN FULL AND PRINT IT FOR YOUR RECORDS
- <br>
- Thank you for your order! Your secure vpn account has now been setup and this email contains all the information you will need in order to begin using your account.
- <br>
- <u>New Account Information</u>
- <br>
- <strong>VPN Subscription Length:</strong> '.$length.' '.$unit.'<br>
- <strong>Expiration Date/Time:</strong> '.date('m/d/Y H:i:s', $newExpire).'<br>
- <u>VPN Login Details</u><br>
- <strong>VPN Username:</strong> '.$user_id.'<br>
- <strong>VPN Password:</strong> '.$vpnPass.'<br>
- <u>VPN Server Access Details:</u><br>
- All the resources you need to use our VPN network can be found on the Downloads tab right after you login to <a href="https://www.crypticvpn.com">CrypticVPN.com</a><br>
- <u>Windows Users (XP/Vista/7/8/10) :</u><br>
- Windows Users can use the CrypticVPN Client.<br>
- Once you download the CrypticVPN client, make sure you run it as Administrator by right clicking on it and selecting "Run as Administrator".
- <br>
- It may prompt you to install a new driver, click "Yes" and wait around 1 minute for it to finish downloading and installing OpenVPN.
- <br>
- Once that finishes close CrypticVPN and relaunch it and you should be able to use the client to connect to our servers.
- <br>
- If you do not want to use the CrypticVPN Client you can download the appropriate OpenVPN software <a href="https://openvpn.net/index.php/open-source/downloads.html">here</a> and use the config files from our website.
- <br><u>OSX (Mac) Users:</u>
- <br> Mac Users can download the TunnelBlick client from <a href="https://tunnelblick.net/downloads.html">here</a> and get the VPN config files from our website.
- <br><u>Linux Users:</u>
- <br>Linux users can install OpenVPN and use the Config files located on our website.
- <br><u>Smartphones/Other Devices:</u>
- <br> If you have a smartphone such as an iPhone or Android, you can install the official OpenVPN Client and use the config files located on our website.
- <br>
- Thank you for choosing CrypticVPN.
- <br>
- Best regards,
- <br>
- - CrypticVPN Staff';
- $from = $gsetting -> getSiteMail($odb);
- $fromname = $gsetting -> getSiteTitle($odb);
- debugPP("Phase 12\n");
- $mail = new PHPMailer;
- if ($rvpnmailer == 'php') {
- $mail->isSendmail();
- } else {
- $mail->isSMTP();
- $mail->SMTPSecure = $smtpauthtype;
- $mail->Host = $rshost;
- $mail->Port = $rsport;
- $mail->SMTPAuth = true;
- $mail->Username = $rsuser;
- $mail->Password = $rspass;
- }
- $mail->setFrom($from, $fromname);
- $mail->addReplyTo($from, $fromname);
- $mail->addAddress($userMail, $userName);
- $mail->Subject = 'VPN Login Information';
- $mail->msgHTML($mailcontent);
- $mail->send();
- }
- $data = array(
- ':tid' => $txn_id,
- ':plan' => $membership_id,
- ':proccessor' => 'Paypal',
- ':user' => $user_id,
- ':paid' => $mc_gross,
- );
- $odb -> setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
- $insertsql = $odb -> prepare("INSERT INTO `payment_logs` VALUES(NULL, :tid, :user, :proccessor, :paid, :plan, UNIX_TIMESTAMP())");
- $insertsql -> execute($data);
- debugPP("Phase 14\n");
- }
- }else{
- debugPP("Price Check Failed");
- }
- }
- }
- fclose($fp);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement