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: admin@mafiakillerz.co.cc\r\nReply-To: admin@mafiakillerz.co.cc"; 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"); ?> Quote Link to comment 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. Quote Link to comment 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: admin@mafiakillerz.co.cc\r\nReply-To: admin@mafiakillerz.co.cc"; mail( $_POST['email'], $subject, $message, $headers ); ?> Quote Link to comment 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? Quote Link to comment 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>"; ?> Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.