seany123 Posted May 19, 2009 Share Posted May 19, 2009 earlier i got help from people here with another page which sends mails... the issue was that the header().. so i removed it and everything worked... the problem is with this code removing the header() isnt an option. <?php $insertid = $db->Insert_ID(); $email=$_POST['email']; $thekey=$string; $user = $_POST['username']; $pass = $_POST['password']; $subject = 'welcome to rpg'; $message = "Thank you for registering at mysite,please activate your account at http://mafiakillerz.co.cc/validate.php?email=$email&string=$string You can login to the game after activating account at www.mafiakillerz.co.cc with the following details: username : $user password: $pass "; $headers = "From: [email protected]\r\nReply-To: [email protected]"; mail( $_POST['email'], $subject, $message, $headers ); echo "Congratulations! You have successfully registered!<br />You will recieve an email to activate account."; header("Location: index.php"); ?> Link to comment https://forums.phpfreaks.com/topic/158788-how-should-this-header-be/ Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 You can't echo or have any text outputted to the page before a header call. That means your echo. Link to comment https://forums.phpfreaks.com/topic/158788-how-should-this-header-be/#findComment-837454 Share on other sites More sharing options...
seany123 Posted May 19, 2009 Author Share Posted May 19, 2009 okay so ive done this but its still not sending the mail. <?php $insertid = $db->Insert_ID(); $email=$_POST['email']; $thekey=$string; $user = $_POST['username']; $pass = $_POST['password']; $subject = 'welcome to rpg'; $message = "Thank you for registering at mysite,please activate your account at http://mafiakillerz.co.cc/validate.php?email=$email&string=$string You can login to the game after activating account at www.mafiakillerz.co.cc with the following details: username : $user password: $pass "; $headers = "From: [email protected]\r\nReply-To: [email protected]"; mail( $_POST['email'], $subject, $message, $headers ); ?> Link to comment https://forums.phpfreaks.com/topic/158788-how-should-this-header-be/#findComment-837466 Share on other sites More sharing options...
DarkSuperHero Posted May 19, 2009 Share Posted May 19, 2009 Any error messages ? error_reporting (E_ALL); ? Do you have any php code before the code you posted? Link to comment https://forums.phpfreaks.com/topic/158788-how-should-this-header-be/#findComment-837472 Share on other sites More sharing options...
seany123 Posted May 19, 2009 Author Share Posted May 19, 2009 <?php include("lib.php"); define("PAGENAME", "Home"); $query = $db->execute("select `id`, `username`, `validated` from `players` where `username`=? and `password`=?", array($_POST['username'], ($_POST['password']))); $player = $query->fetchrow(); $playerval = $player['validated']; //Begin checking if user has tried to login $error = 0; //Error count $errormsg = "<font color=\"red\">"; //Error message to be displayed in case of error (modified below depending on error) if ($_POST['login']) { if ($_POST['username'] == "") { $errormsg .= "Please enter a username!"; $error = 1; } else if ($_POST['password'] == "") { $errormsg .= "Please enter your password!"; $error = 1; } else if ($playerval == 0) { $errormsg .= "Account not activated!"; $error = 1; } else if ($error == 0) { $query = $db->execute("select `id`, `username` from `players` where `username`=? and `password`=?", array($_POST['username'], ($_POST['password']))); if ($query->recordcount() == 0) { $errormsg .= "You could not login! Please check your username/password!"; $error = 1; } else { $player = $query->fetchrow(); $query = $db->execute("update `players` set `last_active`=? where `id`=?", array(time(), $player['id'])); $hash = ($player['id'] . $_SERVER['REMOTE_ADDR'] . $secret_key); $_SESSION['userid'] = $player['id']; $_SESSION['hash'] = $hash; header("Location: home.php"); } } } $errormsg .= "</font>"; ?> Link to comment https://forums.phpfreaks.com/topic/158788-how-should-this-header-be/#findComment-837485 Share on other sites More sharing options...
seany123 Posted May 21, 2009 Author Share Posted May 21, 2009 i still cant get it to send mails Link to comment https://forums.phpfreaks.com/topic/158788-how-should-this-header-be/#findComment-839511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.