function LoginPage_Login($dataConnection) { $username = trim($_POST["username"]); $password = trim($_POST["password"]); if (empty($username)) { throw new Exception("You must enter an username."); } if (empty($password)) { throw new Exception("You must enter a password."); } $userId = VerifyUser($dataConnection, $username, $password); return RefreshOrCreateSession($dataConnection, $userId); }
function CouponCodeAndVerifyUser($couponCode, $email) { $resp = ""; $couponResp = ""; $res = ""; try { $couponResp = CheckCouponCode($couponCode); if ($couponResp == "1") { // coupon is correct and it exists. $resp = "1"; // verify the user email here if (VerifyUser($email, "1") == "1") { $res = "1"; } else { $res = "0"; // error condition of user not verified. } } else { if ($couponResp == "2") { $resp = "2"; } else { if ($couponResp == "3") { $resp = "3"; } else { $resp = "-1"; } } } echo $res . " ~ " . $resp; } catch (Exception $e) { $resp = "-1"; echo $resp; } }