Jump to content

404 page not found on form submit-half form process is carried out...any ideas?!


rachwilbraham

Recommended Posts

Hi!  I have been baffled by this for at least an hour and a half now and I think I could do with some help!  :shrug:

 

Basically, I have a registration form that inserts data into a mysql table then sends an email (with PEAR mail) with an activation code to the email address provided, then should redirect to another page when this process is completed, either to  a 'success' page if the email is sent or an 'error' page if the email is not sent.  At the moment the data is being inserted to the mysql table,  but then the email is not being sent and I get the '404 Page Not Found' error for the ORIGINAL web address, not the redirect.  I'm completely stumped!  Here's the code:

 

 

$md5pass = md5($_POST['pass2']);
$activ_code = rand(10000,99999);
$server = $_SERVER['HTTP_HOST'];
$host = ereg_replace('www.','',$server);

mysql_select_db($database, $connection);
mysql_query("INSERT INTO users
(`email`,`password`,`country`,`joined`,`activation_code`,`fname`,`lname`,`title`,`type`,`telephone`,`company`,`position`)
			  VALUES ('$_POST[email]','$md5pass','$_POST[country]',now(),'$activ_code','$_POST[first_name]','$_POST[last_name]','$_POST[title]','4','$_POST[telephone]','$_POST[company]','$_POST[position]')") or die(mysql_error());

$message = 
"Thank you for registering an account with $server. Here are the login details...\n\n
User Email: $_POST[email] \n
Password: $_POST[pass2] \n
Activation Code: $activ_code \n
____________________________________________
*** ACTIVATION LINK ***** \n
Activation Link: http://$server/activate.php?usr=$_POST[email]&code=$activ_code \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";

include_once "c:\php\PEAR\Mail.php";

$from = "email";
$to = $_POST['email'];
$subject = "Registration Activation Code";
$body = $message;

$host = "IP ADDRESS";
$username = "username";
$password = "password";

$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
  header ( "Location: registrationerror.php");
  //echo("<p>" . $mail->getMessage() . "</p>Failed");
} else {
  header ( "Location: registrationsuccess.php");
  //echo("<p>Message successfully sent!</p>");
}

 

I really appreciate any ideas on this one!!  :wtf:

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.