function submit_paypal_post() { global $dbh, $postvar, $getvar, $instance; echo "<form action=" . $this->paypal_url . " method='post' name='frm'>"; foreach ($this->fields as $a => $b) { if ($a == "amount") { if ($b == "0") { $user_data = $dbh->select("users", array("id", "=", $_SESSION['cuser'])); $signup_date = date("m-d-Y", $user_data['signup']); if ($signup_date == date("m-d-Y")) { $noemail = "1"; } invoice::set_paid($getvar['iid'], $noemail); main::redirect("../client/?page=invoices"); exit; } } echo "<input type='hidden' name='" . $a . "' value='" . $b . "'>"; } echo '</form> <script language="JavaScript"> document.frm.submit(); </script>'; exit; }
} if ($getvar['invoiceID']) { require_once "../includes/paypal/paypal.class.php"; $paypal = new paypal_class(); if ($dbh->config("paypalmode") == "sandbox") { $paypal->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } else { $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; } if ($paypal->validate_ipn()) { $user_data = $dbh->select("users", array("id", "=", $_SESSION['cuser'])); $signup_date = date("m-d-Y", $user_data['signup']); if ($signup_date == date("m-d-Y")) { $noemail = "1"; } invoice::set_paid($getvar['invoiceID'], $noemail); main::errors("Your invoice has been paid!"); } else { main::errors("Your invoice hasn't been paid!"); } } } elseif ($_SESSION['clogged']) { if (!$getvar['page']) { $getvar['page'] = "home"; } elseif ($getvar['page'] == "logout") { session_destroy(); main::redirect("./"); } if (!$dbh->config("cenabled")) { define("SUB", "Disabled"); define("INFO", SUB);