public function checkUserID() { if (!isset($_REQUEST['fieldValue']) || !isset($_REQUEST['fieldId'])) { return miscellaneous::Error(); } $validateValue = $_REQUEST['fieldValue']; $validateId = $_REQUEST['fieldId']; $validateError = "This username is already taken"; $validateSuccess = "This username is available"; /* RETURN VALUE */ $arrayToJs = array(); $arrayToJs[0] = $validateId; $exists = $this->model->checkExists($validateValue); if (!$exists) { // validate?? $arrayToJs[1] = true; // RETURN TRUE echo json_encode($arrayToJs); // RETURN ARRAY WITH success } else { for ($x = 0; $x < 1000000; $x++) { if ($x == 990000) { $arrayToJs[1] = false; echo json_encode($arrayToJs); // RETURN ARRAY WITH ERROR } } } }
public function profile() { $user = new Users(); if ($user->isLoggedIn()) { $this->view->render("user/profile/index"); } else { return miscellaneous::Error(); } }
public function run() { if (Input::exists('post')) { //check if form loaded propely if (Token::check(Input::get('token'))) { echo $this->model->process(); } else { return miscellaneous::Error(); } } else { return miscellaneous::Error(); } }
public static function ok() { if (!isset($_POST["recaptcha_challenge_field"]) || !isset($_POST["recaptcha_response_field"])) { return miscellaneous::Error(); } $privatekey = "6LeMXwoTAAAAAB5MWvqGnKivfvIuF_H4L4G0ysgV"; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { return true; } else { return false; } }
public function index() { if (!isset($_POST["recaptcha_challenge_field"]) || !isset($_POST["recaptcha_response_field"])) { return miscellaneous::Error(); } $privatekey = "6LeMXwoTAAAAAB5MWvqGnKivfvIuF_H4L4G0ysgV"; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly echo json_encode(false); } else { echo json_encode(true); } }
function __construct() { $url = $this->parseUrl(); //set home as our default controller $file = SITE_PATH . '/app/controllers/home_controller.php'; //if no url type then load home if (empty($url[0])) { require_once $file; $control = new home(); $control->index(); return FALSE; } //if controller not empty then check if it is a valid conroller $file = SITE_PATH . '/app/controllers/' . $url[0] . '_controller.php'; //if valid then include it if (file_exists($file)) { require_once $file; } else { return miscellaneous::Error(); } $name = $url[0]; //create an object of that controller $control = new $name(); //params array save the method and parameter of the controller class $params = []; //by default we set the methos as index $method = 'index'; //if method is set in url if (isset($url[1])) { //if it is index then skip it and show error if ($url[1] === 'index') { return miscellaneous::Error(); } else { if (method_exists($url[0], $url[1])) { //if method exists then set the method $method = $url[1]; unset($url[0]); unset($url[1]); $params = $url ? array_values($url) : []; } else { return miscellaneous::Error(); } } } //load the model required $control->loadModel($name); //finally call the method with paramters of that controller class call_user_func_array([$control, $method], $params); }
public function run() { //check if the run request from submition form if (Input::exists('post')) { //check if form loaded propely if (Token::check(Input::get('token'))) { if ($this->model->process()) { header("Location: " . SITE_URL); } else { Session::flush('error-login', 'Username or password is incorrrect!'); header("Location: " . SITE_URL . "/login"); } } else { return miscellaneous::Error(); } } else { return miscellaneous::Error(); } }
public function logout() { miscellaneous::deleteApplySeesion(); $this->model->logout(); }
exit; } $user = new Users(); if ($user->isLoggedIn()) { $location = SITE_URL; header('Location: ' . $location); exit; } else { if (Session::exists('resSuccess')) { echo miscellaneous::errorPopup(Session::flush('resSuccess'), "green"); } else { if (Session::exists('error-login')) { echo miscellaneous::errorPopup(Session::flush('error-login'), "red"); } else { if (Session::exists('signin-first')) { echo miscellaneous::errorPopup(Session::flush('signin-first'), "red"); } } } ?> <script type="text/javascript"> $(document).on('click','.pop-close',function(){ $(this).parent().remove(); }); jQuery(document).ready(function(){ jQuery("#logform").validationEngine(); $("#logform").bind("jqv.field.result", function(event, field, errorFound, prompText){ console.log(errorFound) })
public function index() { return miscellaneous::Error(); }
<?php $user = new Users(); if (!$user->isLoggedIn()) { Session::flush('signin-first', 'You need to log in to apply'); header('Location: ' . SITE_URL . '/login'); exit; } if (Session::exists('invalid-captcha')) { echo miscellaneous::errorPopup(Session::flush('invalid-captcha'), "red"); } $_SESSION['prev-page'] = '3'; ?> <script type="text/javascript"> /* jQuery(document).ready(function(){ $("#step3Form").validationEngine(); $("#step3Form").bind("jqv.field.result", function(event, field, errorFound, prompText){ console.log(errorFound) }); });*/ var RecaptchaOptions = { lang : 'en', theme : 'custom', custom_theme_widget: 'recaptcha_widget' };
<?php $user = new Users(); if (!$user->isLoggedIn()) { Session::flush('signin-first', 'You need to log in to apply'); header('Location: ' . SITE_URL . '/login'); exit; } if (Session::exists('not-eligible')) { echo miscellaneous::errorPopup(Session::flush('not-eligible'), "red"); } ?> <script type="text/javascript"> /*jQuery(document).ready(function(){ $("#step1Form").validationEngine(); $("#step1Form").bind("jqv.field.result", function(event, field, errorFound, prompText){ console.log(errorFound) }); });*/ </script> <form action="<?php echo SITE_URL; ?> /admissionform/step2" method="POST" id="step1Form" >
public function run() { //self::final_step(); if (Input::exists('post')) { //check if form loaded propely if (Token::check(Input::get('token'))) { //check captcha security if (captchaValidattion::ok()) { self::final_step(); $applyID = $this->model->process(); if ($applyID) { echo "Success..applyID = " . $applyID . '<br/>'; } else { echo "SORRY! Error apply..try again!"; } miscellaneous::deleteApplySeesion(); } else { Session::flush('invalid-captcha', Messages::invalidCaptcha()); Redirect::to(SITE_URL . '/admissionform/step2'); } } else { return miscellaneous::Error(); } } else { return miscellaneous::Error(); } }
<?php $user = new Users(); if ($user->isLoggedIn()) { $location = SITE_URL; header('Location: ' . $location); exit; } $admin = new admins(); if ($admin->isLoggedIn()) { $location = SITE_URL; header('Location: ' . $location . '/admin'); exit; } if (Session::exists('error-login')) { echo miscellaneous::errorPopup(Session::flush('error-login'), "red"); } ?> <div > <h3>Admin Login</h3> <form action="<?php echo SITE_URL; ?> /admin/loginProcess" id="logform" method="post" > <input type="text" name="name" placeholder="Username" class="validate[required] in-fl" /> <input type="password" name="password" placeholder="Password" class="validate[required] in-fl" /> <br/> <input type="hidden" name="token" value="<?php echo Token::generate();