Make a file called "config.php"
Paste this code inside it:
PHP Code:
<?php
define("DBHost", "localhost");
define("DBName", "your database");
define("DBUser", "your mysql user");
define("DBPass", "your mysql password");
class Database
{
protected $connection;
protected $database;
public function __construct()
{
echo $settings['DBUser'];
$this->connection = @mysql_connect(DBHost, DBUser, DBPass);
$this->database = @mysql_select_db(DBName);
}
Edit the following, DBName, DBUser, DBPass.
Below such in config.php add this code. You have nothing to edit there if you`re using it for 55xx version.
PHP Code:
//don`t edit anything below
function ProcRegister($Username, $Password, $Password2, $email)
{
if($Username != "" && $Password != "" && $Password2 != "" && $email != "")
{
if(strlen($Username) > 5 && strlen($Username) < 15)
{
if(eregi("^([0-9a-z])+$", $Username))
{
if(!$this->UsernameExists($Username))
{
if($Password == $Password2)
{
if(strlen($Password) > 6 && strlen($Password) < 20)
{
$regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"."\.([a-z]{2,}){1}$";
if(eregi($regex, $email))
{
$this->completeRegister($Username, $Password, $email);
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Please enter your E-mail address!</div></center></font>';
}
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Password should be 6-20 characters!</div></center>';
}
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Confirm Password should be 6-20 characters!</div></center>';
}
} else {
echo '<div style="padding:0px;line-height:19px;"><center>This account has been taken. Please a different username!</div></center>';
}
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Account ID should have only letters or/and numbers!</div></center>';
}
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Account ID should be 5-15 characters!</div></center>';
}
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Type in all of the Required fields</div></center>';
}
}
//here you edit
private function completeRegister($Username, $Password, $email)
{
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "INSERT INTO `accounts table` (`Username table`, `Password table`, `Email table`) VALUES ('$Username', '$Password', '$email')";
if($sql = mysql_query($sql, $this->connection))
{
echo '<center>Account was created successfully.
</center>
';
} else {
echo '<div style="padding:0px;line-height:19px;"><center>Unknown Error processing your requests. We are Sorry!</div></center>';
}
}
private function UsernameExists($Username)
{
$sql = "SELECT * FROM `accounts table` WHERE `Username table` = '$Username'";
$sql = @mysql_query($sql, $this->connection);
$sql = @mysql_num_rows($sql);
if($sql > 0)
{
return true;
} else {
return false;
}
}
}
$db = new Database();
?>
Then save the config.php to www or however is called your web directory.
Create a new file this one called however you want, for example (register.php or reg.php).
Place this code inside it:
HTML Code:
<?php
session_start();
@require_once("config.php");
if(!isset($_SESSION['user']))
{ $_SESSION['user'] = ""; }
if(!isset($_SESSION['email']))
{ $_SESSION['email'] = ""; }
if(isset($_POST['submit']))
{
$_SESSION['user'] = $_POST['user'];
$_SESSION['email'] = $_POST['email'];
$db->ProcRegister($_POST['user'], $_POST['pass'], $_POST['pass2'], $_POST['email']);
}
echo '<br/>
<form method="post" action="">
<h1>Register Account</h2>
<label for="rusername">USERNAME</label>
<input class="ffield" type="text" value="" placeholder="username" id="rusername" name="user" value="'.$_SESSION['user'].'" /><br/>
<label for="rpassword1">PASSWORD</label>
<input class="ffield" type="password" value="" placeholder="password" name="pass" value="" /><br/>
<label for="rpassword2">CONFIRM PASSWORD</label></div>
<input class="ffield" type="password" value="" placeholder="repeat password" name="pass2" value="" /><br/>
<label for="remail">EMAIL</label>
<input class="ffield" type="text" placeholder="email" required name="email" value="'.$_SESSION['email'].'" /><br/>
<button name="submit" id="Submit" type="submit" class="negative button">Submit</button>
</form>
';?>
Wow, now you`re having your own register.