Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.43 KB | None | 0 0
  1. <?php
  2. //*-----------------------------------------------------------------------------------------------------|
  3. //* REGISTRATION PAGE                                                                                   |
  4. //* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
  5. //*     Version:        v0.02 ALPHA                                                                     |
  6. //*     Last Updated:   22/02/2011                                                                      |
  7. //*     Author:         Nathan Heinrich                                                                 |
  8. //*-----------------------------------------------------------------------------------------------------|
  9. //* What is this?                                                                                       |
  10. //* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
  11. //*                                                                                                     |
  12. //*-----------------------------------------------------------------------------------------------------|
  13.  
  14.     // Connect to database and select the database
  15.     $con = mysql_connect("localhost","root","");
  16.     mysql_select_db("famenews", $con);
  17.    
  18.     // Supply the latest login date
  19.     $date = date("Y/m/d");
  20.  
  21.     // Username and password
  22.     $username= $_POST['username'];
  23.    
  24.     // PASSWORDS MD5 HASHED
  25.  
  26.     $password = md5($_POST['password']);
  27.     $rpassword = md5($_POST['rpassword']);
  28.    
  29.     // Dynamic user ID inserted into database
  30.     $accessid = 1;
  31.     mysql_select_db("school", $con);
  32.     $result = mysql_query("SELECT * FROM user ORDER BY userid DESC LIMIT 1");
  33.     while($row = mysql_fetch_array($result))
  34.     {
  35.         $id = $row['userid']+1;
  36.     }
  37.     $sql = ("INSERT INTO user (userid, username, password, lastlog, posts, accessid)
  38.     VALUES ('$id', '$username', '$password', '$date', '$posts', '$accessid')");
  39.    
  40. //*----------------------------------------------------------------------------------------------------
  41. //*                                         END OF CALIBRATION
  42. //*----------------------------------------------------------------------------------------------------
  43.  
  44. if ((isset($_POST['submit']) == true) and (strlen($username) < 3) || (strlen($username) > 15)) {
  45. echo "Your username must be between 3 and 15 characters in length.";
  46. }
  47. else if ((isset($_POST['submit']) == true) and ((strlen($password) < 3) || (strlen($password) > 32) || (strlen($rpassword) < 3) || (strlen($rpassword) > 32))) {
  48. echo "The password must be between 3 and 32 characters in length.";
  49. }
  50.  
  51. else if ((isset($_POST['submit']) == true) and ($password != $rpassword)) {
  52. echo "The passwords must be the same.";
  53. }
  54.  
  55. else if ((isset($_POST['submit']) == true) and (($username == $password) || ($username == $rpassword))) {
  56. echo "The username and password cannot be the same.";
  57. }
  58. else {
  59.     if (!$con)
  60.         {
  61.         die('Could not connect: ' . mysql_error());
  62.         }
  63.     if (isset($_POST['submit']) == true)
  64.         {
  65.         (!mysql_query($sql,$con));
  66.         {
  67.         die(' ' . mysql_error());
  68.         }
  69.  
  70.         }
  71.     if (isset($_POST['del']) == true)
  72.         {
  73.         $del = ("INSERT INTO cms (id, date, admin, news, title)
  74.         VALUES ('$id', '$date', '$_POST[admin]', '$_POST[news]', '$_POST[title]')");
  75.         }
  76.     echo '<form action="#" method="post">';
  77.     echo 'Username: <input type="username" name="username" />';
  78.     echo 'Password: <input type="password" name="password" />';
  79.     echo 'Repeat password: <input type="password" name="rpassword" />';
  80.     echo '<input type="submit" name="submit" />';
  81.     echo '</form>';
  82.       mysql_close($con);
  83.       }
  84.                  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement