newbie
am 18.09.2007 13:31:36 von coryHi at all, I'm newbie in php and I'm searching to make function one
project that I found in a school book, the project is ok because it
functions a part some script. I'd like to know which is the error.
I'm working on win xp pro and on it I have installed a server apache
ver.2.2.4
php ver. 5.2.4, mysql server and client ver.
3.23
I report you the problem:
When I compile the form, my data that I fill in, it has not
processed.The thing strange is that when I change version of Apache,
version of php, And version of mysql the problem becomes another in
other words is another script that don't go.
here is the script:
include ("admin/config.php");
include ("admin/users.php");
########################################################
## NEW MEMBER REGISTER
########################################################
if($register=="Register New Member"){
//****************************
// CHECK FOR USER AND EMAIL **
//****************************
$SELECT_USERS = mysql_query("SELECT * FROM users WHERE
Username='$username'",$db);
$USER_EXISTS = mysql_num_rows($SELECT_USERS);
$SELECT_EMAILS = mysql_query("SELECT * FROM users WHERE
Email='$email'",$db);
$EMAIL_EXISTS = mysql_num_rows($SELECT_EMAILS);
//******************
// BEGIN CHECK **
//******************
if(strlen($firstname)<3){$msg[1] = "Firstname too short";}
if(strlen($surname)<3) {$msg[2] = "Surname too short";}
if(strlen($telephone)<6){$msg[3] = "Not a valid phone number";}
if(strlen($email)<3) {$msg[4] = "Not a valid e-mail address";}
if(strlen($address)<10) {$msg[5] = "Address is too short";}
if(strlen($city)<3) {$msg[6] = "City name too short";}
if(strlen($postcode)<4) {$msg[7] = "Postcode too short";}
if(strlen($country)<3) {$msg[8] = "Country too short";}
if($EMAIL_EXISTS) {$msg[4] = "E-mail already exists";}
if(strlen($username)<3) {$msg_user = "Very short username";}
if($USER_EXISTS) {$msg_user = "Username already exists";}
else{$user_ok = 1;}
if(strlen($password)<6) {$msg_pass = "Please use more than 6
characters";}
else{$pass_ok = 1;}
if((count($msg)!= 0)||(!$user_ok)||(!$pass_ok)) {$msg[0] = "Error on
creating new account";}
else{$details_ok = 1;}
//*****************************
// SUCCESSIVE REGISTRATION **
//*****************************
if(($details_ok)&&($user_ok)&&($pass_ok)){
$md5_password = md5($password);
$INSERT = mysql_query("INSERT INTO users (
Username,
Password,
Firstname,
Surname,
Company,
Address,
City,
County,
Postcode,
Country,
Telephone,
Mobile,
Fax,
Email
)
VALUES (
'$username',
'$md5_password',
'$firstname',
'$surname',
'$company',
'$address',
'$city',
'$county',
'$postcode',
'$country',
'$telephone',
'$mobile',
'$fax',
'$email'
)",$db);
if($INSERT){$meta_next = "";
$msg[0]= "Thank You!";
//*****************************
// INSERT CARDHOLDER DETAILS **
//*****************************
$INSERT_CARDHOLDER = mysql_query("INSERT INTO cardholders (
Username,
Firstname,
Surname,
Address,
City,
Postcode,
Country,
Telephone,
Email,
Mobile,
Fax,
Cardtype,
Cardname,
Cardnumber,
Cardexpire
)
VALUES (
'$username',
'$firstname',
'$surname',
'$address',
'$city',
'$postcode',
'$country',
'$telephone',
'$email',
'$mobile',
'$fax',
'$cardtype',
'$username',
'$cardnumber',
'$cardexpire'
)",$db);
if($INSERT_CARDHOLDER){$msg_cardholder = "Done!";}
else{$msg_cardholder = "Error";}
//*****************************
// INSERT SHIPPING DETAILS **
//*****************************
$INSERT_SHIPPING = mysql_query("INSERT INTO shipping (
Username,
Firstname,
Surname,
Address,
City,
Postcode,
Country,
Telephone
)
VALUES (
'$username',
'$firstname',
'$surname',
'$address',
'$city',
'$postcode',
'$country',
'$telephone'
)",$db);
if($INSERT_SHIPPING){$msg_shipping = "Done!";}
else{$msg_shipping = "Error";}
//***************************************************
//REPLACE ANONYMOUS ITEM SELECTIONS/NORMAL USERNAME *
//***************************************************
$SELECT_ITEMS = mysql_query("SELECT * FROM cart WHERE
Username='$user'",$db);
$DELETE_USER = mysql_query("DELETE FROM users_anonymous WHERE
IDName='$user'",$db);
while($item = mysql_fetch_array($SELECT_ITEMS)){
$UPDATE_ITEMS = mysql_query("UPDATE cart SET
Username ='$username',
Date ='$tdate'
WHERE Username='$user'",$db);
}
//***************************************************
//MAKES THE USER A MEMBER *
//***************************************************
$loggedin=1;
$set_cookie = setcookie ("customer","$username",time()+2600000);
}
else{$meta_next = NULL;}
}
}
?>
=$meta_next;?>
=$conf[footer];?>