hmm, i've had many help calls about this tutorial but this hasn't come up yet, i'll just have a look at the code.
ok, that error will show when either the mysql query failed, or the mail sending failed. having a look at the code, the query
has got mysql_error() in the or die clause, so if it were a mysql query error, then you would see it. so that must mean it's a problem with sending the email. here are a couple of things you can do to try and fix it up:
- put the following code into a file called phpinfo.php and run it:
Code:
<?php echo phpinfo() ?>
check to see what these things are under configuration - php core:
--- safe_mode: if it says
on, you will have to find out a new way to try and send emails
--- SMTP
--- sendmail_from
--- sendmail_path
the last 3 are the main 3 configuration settings that correspond to sending emails, check to see what is set in those fields.
you can try running a test on mail():
Code:
<?php mail("your@email.com","testing","testing..."); ?>
substitute your email address for
your@email.com, and if you recieve an email, then the script
should work, but there's probably a problem with the additional headers that mail() is trying to send.
if you don't get an email after running that script, then your server doesn't allow mail() sending of emails. there are alternatives, you could rewrite the mail function.
[ script from php.net/mail comments: scott at criticalpath dot com ]
Code:
<?php
function sendmail($to='', $subject='', $message='', $headers='', $extra='')
{
$fd = popen("/usr/sbin/sendmail -t $extra", 'w');
fputs($fd, "To: $to\n");
fputs($fd, "Subject: $subject\n");
fputs($fd, "X-Mailer: PHP4\n");
if ($headers) {
fputs($fd, "$headers\n");
}
fputs($fd, "\n");
fputs($fd, $message);
pclose($fd);
}
?>
so if you conclude that your server doesn't allow mail(), change mail() to sendmail() in the membership script, and add that function into the code at the top of the page
below include 'config.php';.
if nothing works, contact me and i will figure out another way for you to register and activate your users, you may have to abandon activation and just have regular registration.
good luck