I’m working on a registration code, but I can’t get it to work and I don’t know why.
My mysql database info is:
table: account
columns: id, username, email, password, securityid, referby
Here are my codes:
register-form.php
[php]<?php
session_start();
include(“config.php”);
include(“addon/security.php”);
if(!isset($_GET[‘account’])){
if($_POST[‘USERNAME’] == “” || $_POST[‘PASSWORD’] == “” || $_POST[‘PASSCONFIRM’] == “” || $_POST[‘EMAIL’] == “” || $_POST[‘SECURITYID’] == “”){
echo ‘’;
exit();
} else {
$username = $_POST[‘USERNAME’];
$username = sec_char($username);
$password = $_POST[‘PASSWORD’];
$password = sec_char($password);
$passconfirm = $_POST[‘PASSCONFIRM’];
$passconfirm = sec_char($passconfirm);
if($password != $passconfirm){
echo ‘’;
die();
}
$email = $_POST[‘EMAIL’];
$email = sec_email($email);
$referby = $_POST[‘REFERBY’];
$referby = sec_char($referby);
$securityid = $_POST[‘SECURITYID’];
$securityid = sec_char($securityid);
/*
*
*This section tests information and saves it.
*
*/
$name = mysql_real_escape_string($username);
$query = mysql_query(“SELECT * FROM account WHERE USERNAME=’$username’”);
if(mysql_num_rows($query) != 0 || mysql_num_rows($queryz) != 0)
{
//Already created.
echo ‘’;
die();
}
else
{
mysql_query(“INSERT INTO account (username, password, email, referby, securityid) VALUES(’$username’, ‘$password’, ‘$email’, ‘$referby’, ‘$securityid’)”) or die(mysql_error());
echo ‘’; // [the new code, sends the user to a success page]
//echo ‘’; [the origional code, this will send the user to their client once they make register]
}
}
}else{
}
?>[/php]
and
register.php
[php
Account Information | |
Username: | |
Email Address: | |
Password: | |
Confirm Password: | |
Other Information | |
Referral ID: What is this? |
|
SECURITY | |
Security ID: What is this? |
!! |
By checking this box you state that you have read and agreed to the Terms of Service. |
|