Advertisement
Guest User

Untitled

a guest
Jan 31st, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.06 KB | None | 0 0
  1. register.php:
  2.  
  3. <?php
  4. require_once 'connect.php';
  5. if(!empty($_POST)) {
  6.     if(isset($_POST['username'], $_POST['password'], $_POST['desc'])) {
  7.         $username = $_POST['username'];
  8.         $password = $_POST['password'];
  9.  
  10.         if(!empty($username) && !empty($password)) {
  11.             $insert = $db->prepare("INSERT INTO 'user' ('name', 'pass') VALUES (?, ?)");
  12.             $insert->bind_param('ss', $username, $password);
  13.         }
  14.     }
  15. }
  16. ?>
  17. <html>
  18.     <head>
  19.         <?php
  20.         require_once 'style.php';
  21.         ?>
  22.         <title>si | Registering an Account</title>
  23.     </head>
  24.     <body>
  25.         <?php
  26.         require_once 'header.php';
  27.         ?>
  28.         <div id="page">
  29.             <h2>Register an Account on Si</h2>
  30.             <form action="" method="post">
  31.                 <input type="text" name="username" placeholder="Username" autocomplete="off">
  32.                 <input type="password" name="password" placeholder="Password" autocomplete="off">
  33.                 <button>Register</button>
  34.             </form>
  35.         </div>
  36.     </body>
  37. </html>
  38.  
  39. connect.php:
  40. <?php
  41. $db = new mysqli('127.0.0.1', 'root', '');
  42. if($db->connect_errno) {
  43.     echo "<p id='gotem'>Something has gone wrong.Tell J to fix it.</p>";
  44. }
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement