Der kommer ikke nogen fejl, men der sker intet
Hejsa,Jeg har denne kode, der bruges når brugeren vil ændre konto informationer. Problemet er bare at der intet sker, der kommer intet output (Den postede nogle fejl tidligere (required fields etc), men dem fik jeg rettet til). Nogle der kan se hvorfor der intet sker?
include("/home/tacklepr/public_html/db.php");
//Vars
$contact_name = &$HTTP_POST_VARS['contact_name'];
$adress = &$HTTP_POST_VARS['adress'];
$area_code = &$HTTP_POST_VARS['area_code'];
$city = &$HTTP_POST_VARS['city'];
$state = &$HTTP_POST_VARS['state'];
$phone_no = &$HTTP_POST_VARS['phone_no'];
$fax_no = &$HTTP_POST_VARS['fax_no'];
$website_url = &$HTTP_POST_VARS['website_url'];
$email_adress = &$HTTP_POST_VARS['email_adress'];
$login_name = &$HTTP_POST_VARS['login_name'];
$password_old = &$HTTP_POST_VARS['password_old'];
$password_1 = &$HTTP_POST_VARS['password_1'];
$password_2 = &$HTTP_POST_VARS['password_2'];
$ip = getenv("REMOTE_ADDR");
// Do some error checking on the form input
if((!$contact_name) || (!$adress) || (!$area_code) || (!$city) || (!$state) || (!$website_url) || (!$email_adress) || (!$login_name)){
echo '<br/><font color=red><b>You did not submit the following required information </b></font><br/>';
if(!$contact_name){
echo "<li>Contact name is a required field. Please click back and enter your name.</li><br/>";
}
if(!$adress){
echo "<li>Adress is a required field. Please click back and enter the adress of the store.</li><br/>";
}
if(!$area_code){
echo "<li>Area code is a required field. Please click back and enter the area code of the store.</li><br/>";
if(!$city){
echo "<li>City is a required field. Please click back and enter the location (city) of the store.</li><br/>";
}
if(!$state){
echo "<li>State is a required field. Please click back and enter the location (state) of the store.</li><br/>";
}
if(!$website_url){
echo "<li>Website adress/url is a required field. Please click back and enter the website adress/url below.</li><br/>";
}
if(!$email_adress){
echo "<li>E-mail is a required field. Please click back and enter a e-mail adress (Only our Support will use this email).</li><br/>";
}
if(!$login_name){
echo "<li>Login name is a required field. Please click back and enter a login name.</li><br/>";
}
if (($password_old) || ($password_1) || ($password_2)) {
if (($password_old != $password) || ($password_1 != $password_2)) {
echo "<li>Error changing your password, please type it again</li><br/>";
}
}
exit(); // if the error checking has failed, we'll exit the script!
}
// Checking if the user's new email and/or username does exist in the database
$sql_doublecheck1 = mysql_query("SELECT * FROM merchants WHERE login_name='$login_name' AND id!='$id' ");
$sql_doublecheck2 = mysql_query("SELECT * FROM merchants WHERE email_adress='$email_adress' AND id!='$id' ");
$doublecheck1 = mysql_num_rows($sql_doublecheck1);
$doublecheck2 = mysql_num_rows($sql_doublecheck2);
if(($doublecheck1 > 0) || ($doublecheck2 > 0)){
echo "<font color=red><b>Please correct the following error(s):</b></font><br/><br/>";
if($doublecheck1 > 0){
echo "<li>The Login Name you have selected has already been used by another merchant in our database. Please choose a different login-name</li><br/>";
unset($login_name);
}
if($doublecheck2 > 0){
echo "<li>The email you have selected has already been used by another merchant in our database. Please choose a different e-mail adress</li><br/>";
unset($email_adress);
}
exit(); // exit the script so that we do not create this account!
}
//Now we crypting the password
$db_password = md5($password_1);
if ($password_1) {
// Enter info into the Database.
$sql = mysql_query("INSERT INTO merchants (id, contact_name, adress, area_code, city, state, phone_no, fax_no, login_name, password, email_adress, website_url)
VALUES('', '$contact_name', '$adress', '$area_code', '$city', '$state', '$phone_no', '$fax_no', '$login_name', '$db_password', '$email_adress', '$website_url')") or die (mysql_error());
} else {
// Enter info into the Database.
$sql = mysql_query("INSERT INTO merchants (id, contact_name, adress, area_code, city, state, phone_no, fax_no, login_name, email_adress, website_url)
VALUES('', '$contact_name', '$adress', '$area_code', '$city', '$state', '$phone_no', '$fax_no', '$login_name', '$email_adress', '$website_url')") or die (mysql_error());
}
if(!$sql){
echo 'There has been an error changing your account. Please contact the webmaster.';
} else {
$userid = mysql_insert_id();
// Let's mail the user!
$subject = "E-mail activation at Tackleprices.com (Merchant Area)";
$message = "Dear $merchant_name,
Please click the link to validate the e-mail change : http://www.tackleprices.com/merchant/add_ok_activate.php?id=$userid&code=$db_password
New e-mail: $email_adress
Best Regards,
Tackleprices.com Staff
This is an automated response, please do not reply!";
mail($email_adress, $subject, $message, "From: Tackleprices.com <merchant@tackleprices.com>\nX-Mailer: PHP/" . phpversion());
echo '<font color=green size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>You will receive a e-mail shortly, please click the link within to activate the email changemation has been mailed to your email address</b></font>';
}
