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 loginProcess() { //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->login()) { header("Location: " . SITE_URL . '/admin'); } else { Session::flush('error-login', Messages::login_unsuccess()); header("Location: " . SITE_URL . "/admin/login"); } } else { return miscellaneous::Error(); } } else { return miscellaneous::Error(); } }
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 index() { return miscellaneous::Error(); }
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(); } }