Advertisement
Jodyone

register

Apr 13th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2.  
  3.     //configuration
  4.     require("../includes/config.php");
  5.    
  6.     // if form was submitted
  7.     if ($_SERVER["REQUEST_METHOD"] == "POST")
  8.     {
  9.         //TODO
  10.         if (empty($_POST["username"]))
  11.         {
  12.             apologize("You must provide your username.");
  13.         }
  14.         else if (empty($_POST["password"]))
  15.         {
  16.             apologize("You must provide your password.");
  17.         }
  18.         else if ($_POST["password"] != $_POST["confirmation"])
  19.         {
  20.               apologize("Invalid username and/or password.");
  21.         }
  22.  
  23.        else if (query("INSERT INTO users (username, hash, cash) VALUES(?, ?, 10000.00)", $POST["username"],crypt($_POST["password"]) === false )
  24.         {
  25.             render("register_form.php", ["title" => "Register"]);
  26.         }
  27.        
  28.     }
  29.     else
  30.     {
  31.         //else render form
  32.         render("register_form.php", ["title" => "Register"]);
  33.     }
  34.    
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement