Advertisement
Guest User

Untitled

a guest
Apr 1st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. __________MAIN_PAGE__________
  2.  
  3. require 'general.php';
  4.  
  5. function login(){
  6.     $bCaptchaCorrect = checkCaptch($_POST['captchaInput']);
  7.     if(!$bCaptchaCorrect){
  8.         die("Captcha is wrong");
  9.     }
  10.     $sUser = $_POST['nameInput'];
  11.     $sPass = $_POST['passInput'];
  12.     $bLoginCorrect = false;
  13.     /*
  14.     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  15.     YOU WILL NOW ONLY BE HERE IF THE CAPTCHA WAS SUCCESSFUL
  16.     Check username and password in database, using valuable CPU and memory resources.
  17.     if everything works out then $bLoginCorrect = true;
  18.     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  19.     */
  20.     if($bLoginCorrect){
  21.         /*
  22.         Yey login!
  23.         Go to to user section
  24.         */
  25.     }
  26.     else{
  27.         die("Username/Password is wrong");
  28.     }
  29. }
  30.  
  31. login();
  32.    
  33. __________GENERAL_PAGE__________(general.php)
  34.  
  35. $sCaptcha = getCurrentCaptcha();
  36.  
  37. function checkCaptch(){
  38.     if($_POST['captchaInput'] == $sCaptcha){
  39.         /*
  40.         Set all cookies/db entries/whatever to show captcha entered correctly.
  41.         However you are doing it right now, no changes are needed.
  42.         */
  43.         return true;
  44.     }
  45.     else{
  46.         return false;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement