Jump to content

how should this header be?


seany123

Recommended Posts

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

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 );
?>

<?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>";


?>

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.