anyway, got the automatic mailing system working... besided getting this error message: (Still running on localhost)
Code: Select all
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Hjemmeside\register.php on line 46I HAVE googled how to change that php.ini, and I know what the file does, and I've tried to edit it, but nothing helps...
Here's the referred register.php file (only interesting part of it):
Code: Select all
if ($num == 0){
//duplicate emails
$query2 = "SELECT * FROM users WHERE email ='$_POST[email]'";
$result2 = mysql_query($query2);
$num2 = mysql_num_rows($result2);
if ($num2 == 0) {
//Passwords and emails matching?
if ($_POST['password'] != $_POST['password2']) {
error("Kodeordene er ikke ens.");}
if ($_POST['email'] != $_POST['email2']) {
error("Email-adresserne er ikke ens.");}
$confirm_code = md5(uniqid(rand())); //random conf. code
//rid of html from hackers
$name = strip_tags($_POST['username']);
$email = strip_tags($_POST['email']);
$pass = strip_tags($_POST['password']);
//Insert to DB
$sql = "INSERT INTO temp SET code='$confirm_code', username='$name', email='$email', password='$pass'";
$result = mysql_query($sql);
if ($result) {
$message = "<b>Din aktiveringskode</b> \r\n";
$message.= "Klik på linket for at aktivere din bruger: \r\n";
$message.= "<a href:'http://localhost/Hjemmeside/confirmation.php?passkey=".
$confirm_code."'>http://localhost/Hjemmeside/confirmation.php?passkey=".$confirm_code."</a>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers.= "From:metallicarules@live.dk";
$sentmail = mail($email, "Oprettelse af bruger", $message, $headers); // -------- LINE 46 --------------- //
} else {
echo "E-mail ikke fundet i databasen.";
}
if ($sentmail) {
echo "En aktiveringskode er blevet sendt til din mail";
} else {
echo "Kunne ikke sende aktiveringskoden.";
}
} else {
echo "E-mail allerede i brug";
}I sincerely hope anyone can help me out with this.
Thanks in advance.