Problems with session_start()

anilson1

New Member
Messages
45
Reaction score
0
Points
0
Hi,
any help with session_start()
I have the message:
----------------------------

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/anilson1/public_html/UpdateData/EmailCheckerPage_Passchanger.php:4) in /home/anilson1/public_html/UpdateData/EmailCheckerPage_Passchanger.php on line 51

--------------------------------
here is my script:


----------------------
PHP:
 <?php
$getmail      = $_POST['getemail'];

// Connect to server and select databse.
mysql_connect("localhost", "xxxxxx", "xxxxxxxxxx")or die("cannot connect"); 
mysql_select_db("anilson1_olgDB")or die("cannot select DB");
 
$result=mysql_query("SELECT Email, PersonalID, MemberID FROM Personalized WHERE Email='$getmail'");
if(mysql_num_rows($result)==1)
{
$line=mysql_fetch_array($result,MYSQL_BOTH);
$user   = $line['MemberID'];
$userid = $line['PersonalID'];
session_start();
$_SESSION['userID'] = $line['PersonalID'];
mysql_query("DELETE FROM Financial WHERE PersonalID='$userid'");

echo "<tr><td></td><td>".$getmail."</td></tr>";
echo "<tr><td>Enter your username:</td><td><input type=\"text\" name=\"getusername\"></td></tr>";
echo "<tr><td>Enter a new password:</td><td><input type=\"password\" name=\"newpasschanger\"></td></tr>";
echo "<tr><td>Re-enter the new password:</td><td><input type=\"password\" name=\"renewedpasschanger\"></td></tr>";
echo "<tr><td></td><td><input type=\"button\" class=\"buttonchenger\" value=\"submit\" onclick=\"inputchecker()\"/></td></tr>";
$extrainfo = "<b><i>Note: </i></b>Due to safety reasons you will have to update your profile.";
}
else
{echo "<tr><td>Sorry but this email seems not to exist in our database. </td></tr><tr><td>Please go back to the main page and register again.</td></tr>";
echo "</td></tr><tr><td><a href='http://cavuanzakikolo.x10hosting.com/'>Main page</a></td></tr>";
$extrainfo="";
}

mysql_close();
?>
-------------------------

what's wrong?
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
try placing session_start() on the first line of the script. if anything is displayed to the browser, then you've already sent headers, and cannot send anymore.
 

anilson1

New Member
Messages
45
Reaction score
0
Points
0
I do not know what is wrong with my codes.
I have a profile page and an update page.
I cann't pass data from profile to the update page. I used session and input hidden box but I get no result any help?


top of profile page:----------------------

PHP:
<?php
session_start();
ob_start();
if(!($_SESSION["userID"]))
{header("location:http://cavuanzakikolo.x10hosting.com");}
$thisMember = $_SESSION["loggedUser"];
$thisuser   = $_SESSION ["userID"];
// Connect to server and select databse.
mysql_connect("localhost", "xxxxx", "xxxxxxx")or die("cannot connect"); 
mysql_select_db("anilson1_olgDB")or die("cannot select DB");
$result=mysql_query("SELECT * FROM Personalized WHERE MemberID='$thisMember'");
$uservalues = mysql_fetch_array($result,MYSQL_BOTH);
$fname=$uservalues["FullName"];
$dob  =$uservalues["DateOfBirth"];
$couty=$uservalues["Country"];
$city =$uservalues["City"];
$phone=$uservalues["Telephone"];
$mail =$uservalues["Email"];
$fdate=$uservalues["SignupDate"];
$ldate=$uservalues["LastSigninDate"];
 
?>
<!---profile page continues-->
HTML:
<html>
<head>
<title>Profile Page</title>
<style>
.buttonchenger  {background-color:red;color:white}
a   {text-decoration:none;color:blue}
a:hover  {color:red}
body   {font-family:Tahoma;color:red;font-size:9}
</style>
 
<body style="margin:0em">
<form name="groupage" method="post" action="ProfileUpdate.php">
 
<table width="100%" height="100%"><tr valign="top"><td width="15%" ></td><td width="650px">
<!------------------head------------------>
<table border="0" name="head" width="100%" ><tr style="background-color:red;"><td><table style="margin:.5em;" >
<tr><td style="color:white;font-size:20;font-family:Arial Black;border-width:thin;border-style:groove;border-color:white"><b>Virtual<br>Online<br>Group</b></td></tr></table>
<script type="text/javascript" src="http://x10hosting.com/adserve.js?anilson1"></script>
</td></tr></table>
<!------------------Menu------------------>
<table border="0" name="totalbodystructure" width="100%"><tr valign="top"><td><table name="menu" border="0"><tr><td style="font-size:9pt; padding:.5em;font-size:9pt;background-color:feedea">
<a href="/Molingokoko_3303/PuroMadie1094/profileTemplete.php">Introduction</a><br>
My Profile<br>
<a href="/PuroMadie1094/myHotNumbers.php">My Hot Numbers</a><br>
<a href="/Molingokoko_3303/PuroMadie1094/myShowGroups.php">Groups to play</a>
<br><br>
<hr color="red" size="1">
<a href="http://cavuanzakikolo.x10hosting.com/Molingokoko_3303/essaCatrapumba_Milonga/Result_Prize.php">Results/Prizes</a><br>
<a href="http://cavuanzakikolo.x10hosting.com/Molingokoko_3303/essaCatrapumba_Milonga/FAQ.php">FAQ</a><br>
<a href="http://cavuanzakikolo.x10hosting.com/Molingokoko_3303/essaCatrapumba_Milonga/ContactUs.php">Contact us</a><br>
<!-----------------body-------------------->
</td></tr></table></td><td width="75%">
 
<table border="0" width="100%"><tr valign="top"><td>
<div style="text-align:right;color:red;font-size:10pt"><span style="font-family:Monotype Corsiva;font-size:13pt"><i><?php echo $_SESSION['loggedUser']." "; ?></i></span>[<a href="http://cavuanzakikolo.x10hosting.com/mylogout.php">Logout</a>]</div><br>
<table border="0" width="100%"><tr><td><p style="font-size:11pt;font-family:verdana,arial,sans-serif"><i>Together we stand a chance.</i><br></td><td>
<table border="1"  style="border-color:red;border-style:groove;border-width:thin;"><tr><td><div style="text-align:center;color:white;font-size:32; background-color:red;"> VOG </div></td></tr></table>
</td></tr></table>
</td></tr></table><br>
<!-------------------enter new structure here-------------------->
<table name="body" width="100%" border="0" ><tr valign="top"><td>
<span style="font-family:Arial Black">Personal Profile</span><hr size="1" width="100%" color="red">
<table border="0" width="100%" style="font-size:10pt"><tr><td>Full Name:</td><td><?php echo $fname; ?></td></tr>
<tr><td>Date of Birth:</td><td><?php echo $dob; ?></td></tr>
<tr><td>Country:</td><td><?php echo $couty; ?></td></tr>
<tr><td>City:</td><td><?php echo $city; ?></td></tr>
<tr><td>Telephone:</td><td><?php echo $phone; ?></td></tr>
<tr><td>Email:</td><td><?php echo $mail; ?></td></tr>
<tr><td></td><td><a href="UpdateData/changePasswordFrominside.php"><span style="font-size:9px">change password</span></a></td></tr>
</table>
<input type="submit" class="buttonchenger" value="Update">
<input type="hidden" name="loggedmember" value="<?php echo $thisMember; ?>" />
<br>
<br>
<br>
<br>
<span style="font-family:Arial Black">Statistics</span><hr size="1" color="red">
<table width="100%" style="font-size:10pt"><tr><td>
<tr><td>Sign up date:</td><td><?php echo $fdate; ?></td></tr>
<tr><td>Last sign in date:</td><td><?php echo $ldate; ?></td></tr>
<tr><td>Winner Numbers:</td><td></td></tr>
 
</table>
 
<!----------------------stop here------------------------------>
</td>
</td></tr></table>
</td></tr></table>
<hr color="red" width="100%" align="right" size="1">
<div style="text-align:right; font-family:arial;font-size:10px;padding-right:.5em" width="100%">About <a href="#">VOG@2008</a>  | <a href="http://cavuanzakikolo.x10hosting.com/TermOfAgreement1.php">Terms of Agreement</a> | </right></div>
</td></tr></table>
</td><td></td></tr></table>
</body>
 
</html>
-----------------------end of profile page

Here goes the update page (top) -----------

PHP:
<?php
$thismember = $_POST['loggedmember'];
//echo $thismember."and".$_SESSION['loggedUser'];
// Connect to server and select databse.
mysql_connect("localhost", "xxxx", "xxxxx")or die("cannot connect"); 
mysql_select_db("anilson1_olgDB")or die("cannot select DB");
 
//Connect to the table in the database
$sql="SELECT * FROM PersonalizedTable WHERE MemberID='$usermember'";
$result=mysql_query($sql);
//This counts all rows in the database table and if exists
//get the values otherwise display a message that database is empty.
$counter=mysql_num_rows($result);
if($counter>0)
{
$line=mysql_fetch_array($result,MYSQL_BOTH);
$mail = $line["Email"];
$uid  = $line["PersonalID"];
}
mysql_close();
?>
<!--- update page continues -->
HTML:
<html>
<head>
<title>Reset Password</title></head>
<style>
.buttonchenger  {background-color:red;color:white}
a   {text-decoration:none;color:blue}
a:hover  {color:red}
body   {font-family:Tahoma;color:red;font-size:9}
 
</style>
<script type="text/javascript">
 
function inputchecker()
{
var approvation = "true";
if(myForm.renewedpasschanger.value=="")
{
valuedisplay.innerText = "Please enter again the new password";
myForm.renewedpasschanger.style.backgroundColor="feedea";
myForm.renewedpasschanger.focus();
approvation = "false";
}
else
{myForm.renewedpasschanger.style.backgroundColor="white";}
if(myForm.newpasschanger.value=="")
{
valuedisplay.innerText = "Please enter the new password";
myForm.newpasschanger.style.backgroundColor="feedea";
myForm.newpasschanger.focus();
approvation = "false";
}
else
{myForm.newpasschanger.style.backgroundColor="white";}
 
 
if(approvation=="true")
{
if(myForm.newpasschanger.value!=myForm.renewedpasschanger.value)
{
valuedisplay.innerText="The passwords do not match.\nPlease re-enter password.";
myForm.renewedpasschanger.value="";
myForm.renewedpasschanger.style.backgroundColor="feedea";
myForm.renewedpasschanger.focus();
}
else
{myForm.action="proccessingPassChanger.php";
 myForm.submit();
}
}
else
{window.event.returnValue=false;}
 
}
 
</script>
 
<body>
<form name="myForm" method="post">
 
<table width="100%" height="100%"><tr valign="top"><td width="15%" ></td><td width="650px">
<!------------------head------------------>
<table border="0" width="100%" ><tr style="background-color:red;"><td><table style="margin:.5em;" >
<tr><td style="color:white;font-size:20;font-family:Arial Black;border-width:thin;border-style:groove;border-color:white"><b>Virtual<br>Online<br>Group</b></td></tr></table>
<script type="text/javascript" src="http://x10hosting.com/adserve.js?anilson1"></script>
</td></tr></table>
<!------------------Menu------------------>
<table border="0" width="100%"><tr valign="top"><td>
<!---------------->
<h2 style="font-color:red">Reset password</h2>
 
<table width="75%" style="font-size:10pt">
<tr><td></td><td><?php echo $thismember; ?></td></tr>
<tr><td>Enter a new password:</td><td><input type="password" name="newpasschanger"></td></tr>
<tr><td>Re-enter the new password:</td><td><input type="password" name="renewedpasschanger"></td></tr>
<tr><td></td><td>
<input type="button" class="buttonchenger" value="submit" onclick="inputchecker()"></td></tr>
</table>
 
<p id="valuedisplay"></p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
 
<input type="hidden" name="userinfo" value="<?php echo $thismember.'-'.$uid; ?>" />
 
 
 
<!------- --------->
</td></tr></table>
<hr color="red" width="100%" align="right" size="1">
<div style="text-align:right; font-family:arial;font-size:10px;padding-right:.5em" width="100%">@2008 VOG | <a href="http://cavuanzakikolo.x10hosting.com/TermOfAgreement1.php">Terms of Agreement</a> | <a href="#">About Us</a></right></div>
 
</td></tr></table></td><td></td></tr></table>
</form>
</body>
</html>
-------------------end of update page
Edit:
I solved the problem.
On profile page I had a button to update profile and I had link to update password.
When I tried to change the password I couldn't get values posted by profile page because the form was not submitted.
 
Last edited:

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
glad to hear it's fixed.

ps, you can close your own topics by pressing add reply (not quick reply). under the text form, there's a check box to close the topic.
 
Top