Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //*-----------------------------------------------------------------------------------------------------|
- //* REGISTRATION PAGE |
- //* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
- //* Version: v0.02 ALPHA |
- //* Last Updated: 22/02/2011 |
- //* Author: Nathan Heinrich |
- //*-----------------------------------------------------------------------------------------------------|
- //* What is this? |
- //* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
- //* |
- //*-----------------------------------------------------------------------------------------------------|
- // Connect to database and select the database
- $con = mysql_connect("localhost","root","");
- mysql_select_db("famenews", $con);
- // Supply the latest login date
- $date = date("Y/m/d");
- // Username and password
- $username= $_POST['username'];
- // PASSWORDS MD5 HASHED
- $password = md5($_POST['password']);
- $rpassword = md5($_POST['rpassword']);
- // Dynamic user ID inserted into database
- $accessid = 1;
- mysql_select_db("school", $con);
- $result = mysql_query("SELECT * FROM user ORDER BY userid DESC LIMIT 1");
- while($row = mysql_fetch_array($result))
- {
- $id = $row['userid']+1;
- }
- $sql = ("INSERT INTO user (userid, username, password, lastlog, posts, accessid)
- VALUES ('$id', '$username', '$password', '$date', '$posts', '$accessid')");
- //*----------------------------------------------------------------------------------------------------
- //* END OF CALIBRATION
- //*----------------------------------------------------------------------------------------------------
- if ((isset($_POST['submit']) == true) and (strlen($username) < 3) || (strlen($username) > 15)) {
- echo "Your username must be between 3 and 15 characters in length.";
- }
- else if ((isset($_POST['submit']) == true) and ((strlen($password) < 3) || (strlen($password) > 32) || (strlen($rpassword) < 3) || (strlen($rpassword) > 32))) {
- echo "The password must be between 3 and 32 characters in length.";
- }
- else if ((isset($_POST['submit']) == true) and ($password != $rpassword)) {
- echo "The passwords must be the same.";
- }
- else if ((isset($_POST['submit']) == true) and (($username == $password) || ($username == $rpassword))) {
- echo "The username and password cannot be the same.";
- }
- else {
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- if (isset($_POST['submit']) == true)
- {
- (!mysql_query($sql,$con));
- {
- die(' ' . mysql_error());
- }
- }
- if (isset($_POST['del']) == true)
- {
- $del = ("INSERT INTO cms (id, date, admin, news, title)
- VALUES ('$id', '$date', '$_POST[admin]', '$_POST[news]', '$_POST[title]')");
- }
- echo '<form action="#" method="post">';
- echo 'Username: <input type="username" name="username" />';
- echo 'Password: <input type="password" name="password" />';
- echo 'Repeat password: <input type="password" name="rpassword" />';
- echo '<input type="submit" name="submit" />';
- echo '</form>';
- mysql_close($con);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement