Jump to content

headers allready sent =(


Recommended Posts

My 2 files:

the exact error:

Warning: Cannot modify header information - headers already sent by (output started at /home/founder/public_html/orpgcreator.com/createrpg.php:1) in /home/founder/public_html/orpgcreator.com/createrpg.php on line 99


include "config.php";

//if creating new game
$reserved_game_names = array("default");

$game_server = mysql_real_escape_string($_POST['selectServer']);
$game_url = mysql_real_escape_string($_POST['textGameURL']);
$game_url_unreal = str_replace(" ", "", strtolower($game_url));
$game_name = mysql_real_escape_string($_POST['textGameName']);
$game_desc = mysql_real_escape_string($_POST['textDesc']);

$name = mysql_real_escape_string($_POST['textName']);
$handle = mysql_real_escape_string($_POST['textHandle']);
$email = mysql_real_escape_string($_POST['textEmail']);
$pass = mysql_real_escape_string($_POST['textPass']);

$goals = mysql_escape_string($_POST['textMsg']);

$code = rand(10000,99999);
$time = time();

//check if name was left blank
if (empty($name))
	//set error message
	$err .= "Name was left blank...<br>";

//check if desc is blank
if (empty($game_desc))
	$err .= "Description was left blank..<br>";	

//check if email was left blank or invalid
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) || empty($email))
	//set error message
	$err .= "Email was left blank or incorrect...<br>";

//check if username in use
$result = mysql_query("SELECT ownerID FROM game_owners WHERE ownerHandle='$handle'");
if (mysql_num_rows($result) == 1 || empty($handle))
	//set error message
	$err .= "Username in use...<br>";

//check if game url in use or a RESERVED WORD
$result = mysql_query("SELECT ownerID FROM game_owners WHERE ownerGameURL='$game_url'");
if (mysql_num_rows($result) == 1 || in_array($game_url, $reserved_game_names) || empty($game_url))
	//set error message
	$err .= "Game url allready in use...<br>";

//check if game server exists
$result = mysql_query("SELECT serverID FROM game_servers WHERE serverName='$game_server'");
if (mysql_num_rows($result) == 0)
	//set error message
	$err .= "Game server does not exist...<br>";
	//get server ID
	$rec = mysql_fetch_object($result);

//if password empty
	$err .= "Admin password was left blank...";

//check if no errors
	//insert new user query
	mysql_query("INSERT INTO game_owners (ownerName, ownerIP, ownerHandle, ownerPass, ownerEmail, ownerActCode, ownerGameURL, ownerGameURLReal, ownerGameServerID, ownerGameGoals, ownerRegDate) 
								VALUES ('$name', '$ip', '$handle', '$pass', '$email', '$code', '$game_url_unreal', '$game_url', '$rec->serverID', '$goals', '$time')") or die(mysql_error());

	//fetch latest game
	$result = mysql_query("SELECT ownerID FROM game_owners ORDER BY ownerID DESC LIMIT 1");
	$game = mysql_fetch_object($result);

	mysql_query("INSERT INTO settings(settingType, settingResult, settingGameRefID) VALUES ('gameDesc', '$game_desc', '$game->ownerID')") or die(mysql_error());

	mail($email, "oRPG Creator.com New Game Activation", "Please visit http://www.orpgcreator.com/activate.php?server=$game_server&code=$code&game=$game_url_unreal&email=$email", "From: oRPGCreator.com <[email protected]>\n\r");

	header("Location: activate.php?email=$email");
	//$err =  "An email has been dispatched to $email to activate your game from [email protected]";


my config.php file


$dbhost="localhost";    // usually "localhost"

$connection = mysql_connect("$dbhost", 
mysql_select_db("$dbname", $connection);

max_chars = 4;



I just dont understand why it just stopped redirecting... :(

Link to comment
Share on other sites

Can everyone stop hacking PHP, please? :(

Rather find out why contents are being sent before the header(s).

By the looks of your script(s), I would suggest that it is a MySQL error or the mail function causing the errors.

It's a simple fix either way.

Edited by Spudinski
please stop please?
Link to comment
Share on other sites

  • 2 weeks later...
Which is what Dave had already stated which then prompted Spuds reply followed by SRB's reply.


Totally missed his reply :|

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...