Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.04 KB | None | 0 0
  1. <?php session_start(); ?>
  2.  
  3. <html>
  4.  
  5.     <head>
  6.    
  7.         <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  8.         <meta name="author" content="Jason" />
  9.        
  10.         <link href="css/style.css" type="text/css" rel="stylesheet" media="all" />
  11.    
  12.     </head>
  13.  
  14. <body>
  15.  
  16. <br /><br />
  17. <div class="wrapper">
  18.  
  19. <strong style="color: #FFF; text-transform: uppercase; text-shadow: 1px 1px #121e23;">
  20. <a href="index.php" style="color: #FFF; text-decoration: none;">Blogster - Version 1.0</a>
  21. </strong>
  22.  
  23. <div class="content_box">
  24.  
  25. <?php
  26.  
  27. /**
  28.  * @author Jason
  29.  * @copyright 2011
  30.  * @copyright Blogster
  31.  * @version 1.0
  32.  */
  33.    
  34.     require 'config/config.php';
  35.    
  36.         if ( isset( $_POST['submit'] ) )
  37.         {
  38.            
  39.             $username = stripslashes( str_replace( '\\r\\n', "\r\n", mysql_real_escape_string( nl2br( $_POST['username'] ) ) ) );
  40.             $password = md5( stripslashes( str_replace( '\\r\\n', "\r\n", mysql_real_escape_string( nl2br( $_POST['password'] ) ) ) ) );
  41.             $re_password = md5( stripslashes( str_replace( '\\r\\n', "\r\n", mysql_real_escape_string( nl2br( $_POST['repassword'] ) ) ) ) );
  42.            
  43.             $error = array();
  44.            
  45.             $username_check = mysql_query(" SELECT * FROM `members` WHERE `username` = '{$username}' ");
  46.            
  47.                 // Error list and check
  48.            
  49.                 if ( empty( $username ) || empty( $password ) || empty( $re_password ) )
  50.                 {
  51.                         $error[] = "<div class='error'><center>You are missing a field(s).</center></div><br />";    
  52.                 }
  53.                 if ( mysql_num_rows( $username_check ) > 0 )
  54.                 {
  55.                         $error[] = "<div class='error'><center>Username is taken.</center></div><br />";                
  56.                 }
  57.                 if ( strlen( $username ) > 20 )
  58.                 {
  59.                         $error[] = "<div class='error'><center>Username is too long.</center></div><br />";    
  60.                 }
  61.                 if ( $password != $re_password )
  62.                 {
  63.                         $error[] = "<div class='error'><center>Passwords do not match.</center></div><br />";      
  64.                 }
  65.                 if ( strlen( $password ) > 40 || strlen( $password ) < 5 )
  66.                 {
  67.                         $error[] = "<div class='error'><center>Password is too long or short.</center></div><br />";      
  68.                 }
  69.                
  70.                 foreach ( $error as $error_msg )
  71.                 {
  72.                         echo $error_msg;
  73.                 }
  74.                    
  75.                     // Insert data into database
  76.                
  77.                     if ( strlen( $error_msg ) == 0 )
  78.                     {
  79.                        
  80.                         $create_account = mysql_query(" INSERT INTO `members` VALUES('' , 'Member' , '{$username}' , '{$password}' , 'Blogger' , 'images/default_avatar.png' ) ");
  81.                        
  82.                         echo "
  83.                            <div class='success'><center>
  84.                            <meta http-equiv='refresh' content='1; url=index.php'>
  85.                            Account registered!
  86.                            </center></div><br />
  87.                        ";
  88.                        
  89.                     }
  90.                
  91.         }
  92.        
  93. ?>
  94.     <center>
  95.  
  96.     <form method="POST" action="" name="register">
  97.    
  98.         <label for="username">Username:</label><br />
  99.             <input type="text" name="username" class="text_box" value=""/><br />
  100.         <label for="password">Password:</label><br />
  101.             <input type="password" name="password" class="text_box" value=""/><br />
  102.         <label for="repassword">Repeat-Password:</label><br />
  103.             <input type="password" name="repassword" class="text_box" value=""/><br /><br />
  104.             <input type="submit" name="submit" value="Sign in"/>
  105.    
  106.     </form>
  107.    
  108.     </center>
  109.    
  110. </div>
  111. </div>
  112. </body>
  113. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement