Location: PHPKode > projects > Backend code/CMS for blizzle.com > v1.x/createaccount.php
<?
// INCLUDES all neccessary page building functions
require "functions.php";

// THIS IS JUST A SIMPLE FORM THAT POSTS TO ITSELF TO SAVE THE DATA.
global $here;
if ($username) {
$username = stripNick($username);

$query = "SELECT Count(*) FROM users WHERE userName = '$username';";
$result = mysql_query ($query, $link) or die (mysql_error());
list($num) = mysql_fetch_row($result);
if ($num > 0) {
$retval = rtError(0,"This username already exists.  Please choose another username.");
} elseif ($password != $password2) {
$retval = rtError(1,"Passwords do not match.  Please re-type both passwords.");
} elseif ((empty($username)) || (empty($password)) || (empty($password2))) {
$retval = rtError(3,"Not all fields have been filled.  Please fill in missing fields.");
} else {

$query = "INSERT INTO users (userName, userPassword, userStatus, registerdate) VALUES('$username',MD5('$password'),'+',NOW());";
$result = mysql_query ($query, $link) or die (mysql_error());

$frmUsername = $username;
$frmUserpassword = $password;
chkLogin();

$retval = createItem("Account created successfully!",date("Y-m-d H:i:s"),"Well hello there $frmUsername.<br>Your account was created successfully.<p>Now what do you want to do?<ul><li>[http://blizzle.com/modifyaccount.php]Modify my profile[/]<li>[http://blizzle.com/wizard.php]Post something[/]<li>[http://blizzle.com/]Go home[/]</ul><p>Or I suppose you could just chill here.",null,"blizzle","admin","blizzle",null,null,null,null,null);
createPage($retval);

//header("Location: modifyaccount.php?function=newaccount&PHPSESSID=$PHPSESSID"); 

}



} else {


$retval = $retval."<table width=100% border=0><tr><form method=post action=\"$here\"><td colspan=2><strong><i>Create Account</i></strong></td></tr>";
$retval = $retval."<tr><td colspan=2>Please enter a username below, this will be your displayed name throughout blizzle.  It will be appended with a '+' to designate that you are an account holder.  No other accounts can be registered in this name.  Somebody may post with your nickname when unregistered, but they will not have the '+' prefix.</td></tr>";
$retval = $retval."<tr><td><strong>username:<br>(alpha-numeric, underscore, and dash only)</strong></td><td width=100%><input type=text name=username></td></tr>";
$retval = $retval."<tr><td colspan=2><hr width=100 height=1 color=black></td></tr>";
$retval = $retval."<tr><td colspan=2>Your password should be unique to you and not easily guessed.  Please enter it twice below for verification.</td></tr>";
$retval = $retval."<tr><td><strong>password:</strong></td><td width=100%><input type=password name=password></td></tr>";
$retval = $retval."<tr><td><strong>again:</strong></td><td width=100%><input type=password name=password2></td></tr>";
$retval = $retval."<tr><td colspan=2><hr width=100 height=1 color=black></td></tr>";
$retval = $retval."<tr><td colspan=2>On the following page you will have the option to add additional information to your account.  This may be used in various ways in the future to personalize blizzle.  This information will never be sold or shared with a commercial company.</td></tr>";
$retval = $retval."<tr><td colspan=2><hr width=100 height=1 color=black></td></tr>";
$retval = $retval."<tr><td colspan=2><i>YES!</i> I've filled this form out completely and would like to blizzle baby!<br><center><input type=submit name=\"Create Account\" value=\"Create Account\"></td></tr></form></table>";
$retval = createItem("Create New Account",date("Y-m-d H:i:s"),$retval,null,"blizzle","admin","blizzle",null,null,null,null,null);

}
if ($retval) {
createPage($retval);
}

function rtError($num,$desc) {

global $username;

$retval = "<font color=red>$desc</font><br>";
$retval = $retval."<table width=100% border=0><tr><form method=post action=\"$here\"><td colspan=2><strong><i>Create Account</i></strong></td></tr>";
$retval = $retval."<tr><td colspan=2>Please enter a username below, this will be your displayed name throughout blizzle.  It will be appended with a '+' to designate that you are an account holder.  No other accounts can be registered in this name.  Somebody may post with your nickname when unregistered, but they will not have the '+' prefix.</td></tr>";
$retval = $retval."<tr><td><strong>username:<br>(alpha-numeric only)</strong></td><td width=100%><input type=text name=username value=\"$username\"></td></tr>";
$retval = $retval."<tr><td colspan=2><hr width=100 height=1 color=black></td></tr>";
$retval = $retval."<tr><td colspan=2>Your password should be unique to you and not easily guessed.  Please enter it twice below for verification.</td></tr>";
$retval = $retval."<tr><td><strong>password:</strong></td><td width=100%><input type=password name=password></td></tr>";
$retval = $retval."<tr><td><strong>again:</strong></td><td width=100%><input type=password name=password2></td></tr>";
$retval = $retval."<tr><td colspan=2><hr width=100 height=1 color=black></td></tr>";
$retval = $retval."<tr><td colspan=2>On the following page you will have the option to add additional information to your account.  This may be used in various ways in the future to personalize blizzle.  This information will never be sold or shared with a commercial company.</td></tr>";
$retval = $retval."<tr><td colspan=2><hr width=100 height=1 color=black></td></tr>";
$retval = $retval."<tr><td colspan=2><i>YES!</i> I've filled this form out completely and would like to blizzle baby!<br><center><input type=submit name=\"Create Account\" value=\"Create Account\"></td></tr></form></table>";
$retval = createItem("Create New Account",date("Y-m-d H:i:s"),$retval,null,"blizzle","admin","blizzle",null,null,null,null,null);

return $retval;
}
?>
Return current item: Backend code/CMS for blizzle.com