Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- <meta name="author" content="Jason" />
- <link href="css/style.css" type="text/css" rel="stylesheet" media="all" />
- </head>
- <body>
- <br /><br />
- <div class="wrapper">
- <strong style="color: #FFF; text-transform: uppercase; text-shadow: 1px 1px #121e23;">
- <a href="index.php" style="color: #FFF; text-decoration: none;">Blogster - Version 1.0</a>
- </strong>
- <div class="content_box">
- <?php
- /**
- * @author Jason
- * @copyright 2011
- * @copyright Blogster
- * @version 1.0
- */
- require 'config/config.php';
- if ( isset( $_POST['submit'] ) )
- {
- $username = stripslashes( str_replace( '\\r\\n', "\r\n", mysql_real_escape_string( nl2br( $_POST['username'] ) ) ) );
- $password = md5( stripslashes( str_replace( '\\r\\n', "\r\n", mysql_real_escape_string( nl2br( $_POST['password'] ) ) ) ) );
- $re_password = md5( stripslashes( str_replace( '\\r\\n', "\r\n", mysql_real_escape_string( nl2br( $_POST['repassword'] ) ) ) ) );
- $error = array();
- $username_check = mysql_query(" SELECT * FROM `members` WHERE `username` = '{$username}' ");
- // Error list and check
- if ( empty( $username ) || empty( $password ) || empty( $re_password ) )
- {
- $error[] = "<div class='error'><center>You are missing a field(s).</center></div><br />";
- }
- if ( mysql_num_rows( $username_check ) > 0 )
- {
- $error[] = "<div class='error'><center>Username is taken.</center></div><br />";
- }
- if ( strlen( $username ) > 20 )
- {
- $error[] = "<div class='error'><center>Username is too long.</center></div><br />";
- }
- if ( $password != $re_password )
- {
- $error[] = "<div class='error'><center>Passwords do not match.</center></div><br />";
- }
- if ( strlen( $password ) > 40 || strlen( $password ) < 5 )
- {
- $error[] = "<div class='error'><center>Password is too long or short.</center></div><br />";
- }
- foreach ( $error as $error_msg )
- {
- echo $error_msg;
- }
- // Insert data into database
- if ( strlen( $error_msg ) == 0 )
- {
- $create_account = mysql_query(" INSERT INTO `members` VALUES('' , 'Member' , '{$username}' , '{$password}' , 'Blogger' , 'images/default_avatar.png' ) ");
- echo "
- <div class='success'><center>
- <meta http-equiv='refresh' content='1; url=index.php'>
- Account registered!
- </center></div><br />
- ";
- }
- }
- ?>
- <center>
- <form method="POST" action="" name="register">
- <label for="username">Username:</label><br />
- <input type="text" name="username" class="text_box" value=""/><br />
- <label for="password">Password:</label><br />
- <input type="password" name="password" class="text_box" value=""/><br />
- <label for="repassword">Repeat-Password:</label><br />
- <input type="password" name="repassword" class="text_box" value=""/><br /><br />
- <input type="submit" name="submit" value="Sign in"/>
- </form>
- </center>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement