Advertisement
Guest User

index.php

a guest
Apr 7th, 2014
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <?php
  2. include 'connect.php';
  3. define('salt','7hPqMO(m=F+!!L6(#Yhp-CdF, &Q}+cIrA;c@wcP(E--V<qRmq!v*aSnM;H=4cD0');
  4.  
  5.  
  6. if(isset($_POST['username']) && isset($_POST['fullname']) && isset($_POST['email']) && isset($_POST['password'])) {
  7.     $username = mysql_real_escape_string($_POST['username']);
  8.     $fullname = mysql_real_escape_string($_POST['fullname']);
  9.     $email = mysql_real_escape_string($_POST['email']);
  10.     $password = mysql_real_escape_string($_POST['password']);
  11.     $encryptedPassword = hash( 'whirlpool',salt.$password );
  12.      
  13.     $sql="INSERT INTO `users` (username, fullname, email, password)
  14.     VALUES
  15.     ('$username', '$fullname','$email','$encryptedPassword')";
  16.      
  17.     if(!mysql_query($sql,$connection)) {
  18.         die('Error: ' . mysql_error());
  19.     } else {
  20.         mysql_close($connection);
  21.         header('Location: login.php?redirectedFromRegister=1');
  22.     }
  23. }
  24. ?>
  25.  
  26. <html>
  27.     <body>
  28.         <form action="index.php" method="post">
  29.             <h1>REGISTER</h1><hr/>
  30.            
  31.             Email:    <input type="text" name="email"/><br/>
  32.             Full Name:<input type="text" name="fullname"/><br/>
  33.             Username: <input type="text" name="username"/><br/>
  34.             Password: <input type="password" name="password"/><br/>
  35.            
  36.             <input type="submit" value="REGISTER"/>
  37.         </form>
  38.     </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement