Old 01-04-2006   #1 (permalink)
Registered User
 
Join Date: Jan 2006
Posts: 2

session_start help!! ERRORS!

Im totaly new in PHP, and a friend let me use he's scripts, now here is a problem, i did all i had to and i only get:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/www/stisan.hostingrapid.com/register.php:4) in /home/www/stisan.hostingrapid.com/header2.php on line 1

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/www/stisan.hostingrapid.com/register.php:4) in /home/www/stisan.hostingrapid.com/header2.php on line 1
Sesion has expired.[GO BACK]


Can i get help?

here is register.php:
Quote:
<html>

<head>
<?php include("header2.php"); ?>

<?php

$gamename = "Evolution";

echo "<title>$gamename</title>";

?>

</head>

<body bgcolor="#FFFFFF" text="black" link="black" alink="grey" vlink="black">


<div align="center">

<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#CCCCCC">
<td width="25&amp;" height="30">&nbsp;</td>

<td width="50%" height="30">


<div align="center"><font color="#FFFFFF">

<?php

echo "<b><font size='5' color='#000099'>$gamename
</font></b></font></div></td>";

?>

<td width="25%" height="30">&nbsp;</td></tr>
<tr bgcolor="#666666">
<td width="25%" height="30">

<div align="center">

<font color="#CCCCCC"><b><font color="#FFFFFF">MENU</font></b></font>
</div></td>

<td width="50%" height="30">&nbsp;</td>

<td width="25%" height="30">


<div align="center"><b><font color="#FFFFFF">LINKS</font></b></div></td></tr>

<tr bgcolor="#666666">
<td width="25%" height="30" bgcolor="#CCCCCC" valign="top">


<p>&nbsp;<p>

<ul>
<font size="4"><b><a href="index.php">Home</a></b></font><p>
<font size="4"><b>Register</b></font><p>
<font size="4"><b><a href="lostpass.php">Lost password</a></b></font><p>
<font size="4"><b><a href="rules.php">Rules</a></b></font><p>

<font size="4"><b><a href="contact">Contact, us!</a></b></font>
</ul>
</td>

<td width="50%" height="30" bgcolor="#CCCCCC" valign="top">

<div align="center"> <p>&nbsp;<p align="center">
<font color="#0000CC">
<font color="#000099">
<b>Updates:</b>
</font></font>
<p>&nbsp;<p>

<font face="Georgia, Times New Roman, Times, serif" size="3">

<center>
Register to get your Evolution account now, and begin the game.<br>Password will be sent to E-mail.
<?php
$nump = mysql_num_rows(mysql_query("select * from playerdata"));
echo " <b>$nump</b> people already have signed up!";
?>
</center>
</font>

<p><font face="Georgia, Times New Roman, Times, serif" size="3">
Username:<input type=text name=user><br>
Email:<input type=text name=email><br>
Verify Email:<input type=text name=vemail><br>




<?php
echo "Referral ID:<input type=text name=referal readonly value=$referal><br><i>If you don't know what this is, leave it blank.</i>";
?><br>
<input type=submit value=Register>
</form>

<?php
if ($action == register) {
if (!$user || !$email || !$vemail ) {
echo "You must fill out all fields.";
include("foot.php");
exit;
}
$dupe1 = mysql_num_rows(mysql_query("select * from playerdata where user='$user'"));
if ($dupe1 > 0) {
echo "Someone already has that username.";
include("foot.php");
exit;
}
$dupe2 = mysql_num_rows(mysql_query("select * from playerdata where email='$email'"));
if ($dupe2 > 0) {
echo "Someone already has that email.";
include("foot.php");
exit;
}
if ($email != $email) {
echo "The emails do not match.";
include("foot.php");
exit;
}
$referal = strip_tags($referal);
$user = strip_tags($user);
$password = strip_tags($password);
if ($referal) {
mysql_query("update playerdata set referal=referal+1 where id=$referal");
}
$password = rand(10000 , 90000);
$message = "welcome to $gamename your pass is $pass login now and change it. have fun playing at $gamename. Webmaster";
mysql_query("insert into playerdata (user, email, password) values('$user','$email','$password')") or die("Could not register.");
mail("$email", "$gamename", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}\r\n"
."Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n"
."X-Mailer: PHP/" . phpversion()) or die("could not send mail");

echo "You are now registered to play, $user. Please check your e-mail for your pass and login now.";
echo "<br><a herf=index.php>login</a>";
}
?>


</font>

<td width="25%" height="30" bgcolor="#CCCCCC" valign="top" align="center">

<p>&nbsp;<p><b><font size="4">

Services

</font></b>

<p><font size="4"><b>

Prices

</b></font>

<p><font size="4"><b>

Order Form

</b></font>

<p><font size="4"><b>

Credit Cards


</b></font></td></tr>

<tr bgcolor="#666666"> <td width="25%" height="30" valign="top"></td>

<td width="50%" height="30" valign="top">&nbsp;</td>
<td width="25%" height="30" valign="top" align="center">&nbsp;</td></tr>

<tr bgcolor="#CCCCCC">
<td width="25%" height="30" valign="top">&nbsp;</td>

<td width="50%" height="30" valign="top">&nbsp;</td>

<td width="25%" height="30" valign="top" align="center">

© 2006 All rights reserved. Stisan.hostingrapid.com.

</td></tr></table>

<?php include("foot.php"); ?>
And here's the other, index.php:

Quote:
<?php include("header2.php"); ?>

<html>

<head>
<?php

$gamename = "Evolution";

echo "<title>$gamename</title>";

?>

</head>

<body bgcolor="#FFFFFF" text="black" link="black" alink="grey" vlink="black">


<div align="center">

<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#CCCCCC">

<td width="25&amp;" height="30">&nbsp;</td>

<td width="50%" height="30">


<div align="center"><font color="#FFFFFF">

<?php

echo "<b><font size='5' color='#000099'>$gamename
</font></b></font></div></td>";

?>

<td width="25%" height="30">&nbsp;</td></tr>
<tr bgcolor="#666666">
<td width="25%" height="30">

<div align="center">

<font color="#CCCCCC"><b><font color="#FFFFFF">MENU</font></b></font>

</div></td>

<td width="50%" height="30">&nbsp;</td>

<td width="25%" height="30">


<div align="center"><b><font color="#FFFFFF">AD'S</font></b></div></td></tr>

<tr bgcolor="#666666">
<td width="25%" height="30" bgcolor="#CCCCCC" valign="top">


<p>&nbsp;<p>

<ul>
<font size="4"><b>Home</b></font><p>
<font size="4"><b><a href="register.php">Register</a></b></font><p>

<font size="4"><b><a href="lostpass.php">Lost password</a></b></font><p>
<font size="4"><b><a href="rules.php">Rules</a></b></font><p>

<font size="4"><b><a href="contact">Contact, us!</a></b></font>
</ul>
</td>

<td width="50%" height="30" bgcolor="#CCCCCC" valign="top">

<div align="center"> <p>&nbsp;<p align="center">
<font color="#0000CC">
<font color="#000099">
<b>Updates:</b>

</font></font>
<p>&nbsp;<p>

<font face="Georgia, Times New Roman, Times, serif" size="3">

<center>
Username: <input type="text" name="user"><br>
Password: <input type="text" name="password"><br>
<input type="submit" value="Log in!"><br>
<?php
if (!$user || !$password) {
include("head.php");
echo "Please fill out all fields.";
include("foot.php");
exit;
}
include("head.php");
$logres = mysql_num_rows(mysql_query("select * from playerdata where user='$user' and password='$password'"));
if ($logres <= 0) {
echo "Login failed. If you have not already, please signup. Otherwise, check your spelling and login again.";
include("foot.php");
exit;
} else {
session_register("user");
session_register("pass");
echo "&nbsp;<br>Welcome back.<br>Please click below to continue..<br><br><center>[<a href=updates.php><b>Log In</b></a>]</center><br>";
}
include("config.php");
mysql_query("UPDATE playerdata SET logins=logins+1");

include("foot.php");
?>

</font>

<td width="25%" height="30" bgcolor="#CCCCCC" valign="top" align="center">

<p>&nbsp;<p><b><font size="4">

Services

</font></b>

<p><font size="4"><b>

Prices


</b></font>

<p><font size="4"><b>

Order Form

</b></font>

<p><font size="4"><b>

Credit Cards


</b></font></td></tr>

<tr bgcolor="#666666"> <td width="25%" height="30" valign="top"></td>

<td width="50%" height="30" valign="top">&nbsp;</td>

<td width="25%" height="30" valign="top" align="center">&nbsp;</td></tr>

<tr bgcolor="#CCCCCC">
<td width="25%" height="30" valign="top">&nbsp;</td>

<td width="50%" height="30" valign="top">&nbsp;</td>

<td width="25%" height="30" valign="top" align="center">

© 2006 All rights reserved. Stisan.hostingrapid.com.

</td></tr></table>

<?php include("foot.php"); ?>












Please help! im short on time
Diablo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-05-2006   #2 (permalink)
Yup, that's meee!
 
thecubed's Avatar
 
Join Date: Jun 2004
Location: Infront of my screen (most of the time)
Posts: 89

Send a message via AIM to thecubed Send a message via Yahoo to thecubed Send a message via Skype™ to thecubed
Can you post the contents of 'header2.php'?

EDIT:: Even before posting header2.php, try this

in register.php, your code looks like this at the top:
PHP Code:
<html>

<head>
<?php include("header2.php"); ?>
change it to:
PHP Code:
<?php include("header2.php"); ?>
<html>
<head>
Your header2.php script is getting called after register.php has already send headers.
Try that and also please post the contents of header2.php here so we can help you.
__________________

www.thecubed.com <--- TheCubed Homepage!

Last edited by thecubed; 01-05-2006 at 02:24 AM.. Reason: I realized something :) many times.
thecubed is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-05-2006   #3 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
session_start() must be placed on top of everything,expecially header stuffs
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-05-2006   #4 (permalink)
Registered User
 
Join Date: Jan 2006
Posts: 2

:)

Oh! thank you! ill try that,


anf for this message to be posted im writing unsencsebulk stuff
Diablo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 05:17 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT