Jump to content

Warning: session_start() [function.session-start]: Cannot send session cache lim


sonehs

Recommended Posts

this is the error... codes below it.. any suggestions?

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/tritusco/public_html/dosignup.php:2) in /home/tritusco/public_html/dosignup.php on line 3

 

include ('dbc.php'); 


if ($_POST['Submit'] == 'Register')
{
   if (strlen($_POST['email']) < 5)
   {
    die ("Incorrect email. Please enter valid email address..");
    }
   if (strcmp($_POST['pass'],$_POST['conf_pass']) || empty($_POST['pass']) )
{ 
//die ("Password does not match");
die("ERROR: Password does not match or empty..");

}
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{ 
		 die("Invalid code entered. Please enter the correct code as shown in the Image");
  		} 
$rs_duplicates = mysql_query("select id from user_register where user_email='$_POST[email]'");
$duplicates = mysql_num_rows("$rs_duplicates");

if ($duplicates > 0)
{	
//die ("ERROR: User account already exists.");
header("Location: register.php?msg=ERROR: User account already exists..");
exit();
}




$md5pass = md5($_POST['conf_pass']);
$activ_code = rand(1000,9999);
$server = $_SERVER['HTTP_HOST'];
$host = ereg_replace('www.','',$server);
mysql_query("INSERT INTO user_register
              (`id`,`fname`,`lname`,`email`,`activation_code`,`pass`)
			  VALUES
			  ('$_POST[email]','$md5pass','$_POST[country]',now(),'$activ_code','$_POST[full_name]')") or die(mysql_error());

$message = 
"Thank you for registering an account with $server. Here are the login details...\n\n
User Email: $_POST[email] \n
Password: $_POST[conf_pass] \n
Activation Code: $activ_code \n
____________________________________________
*** ACTIVATION LINK ***** \n
Activation Link: http://$server/activate.php?usr=$_POST[email]&code=$activ_code \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";

mail($_POST['email'] , "Login Activation", $message,
    "From: \"Auto-Response\" <notifications@$TritusCo.com>\r\n" .
     "X-Mailer: PHP/" . phpversion());
unset($_SESSION['ckey']);
echo("Registration Successful! An activation code has been sent to your email address with an activation link...");	

exit;
}	

?> 

<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>

Link to comment
Share on other sites

You have output on line 2 in dosignup.php

 

Make sure you do not have anything before your opening PHP tag (<?php), this includes spaces/new lines etc.

 

ahh thx... hmm my code isnt working do u see anything else sticking out?  its supposed register the user....

 

<?php 
session_start();


include ('dbc.php'); 


if ($_POST['Submit'] == 'Register')
{
   if (strlen($_POST['email']) < 5)
   {
    die ("Incorrect email. Please enter valid email address..");
    }
   if (strcmp($_POST['pass'],$_POST['conf_pass']) || empty($_POST['pass']) )
{ 
//die ("Password does not match");
die("ERROR: Password does not match or empty..");

}
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{ 
		 die("Invalid code entered. Please enter the correct code as shown in the Image");
  		} 
$rs_duplicates = mysql_query("select id from user_register where user_email='$_POST[email]'");
$duplicates = mysql_num_rows("$rs_duplicates");

if ($duplicates > 0)
{	
//die ("ERROR: User account already exists.");
header("Location: register.php?msg=ERROR: User account already exists..");
exit();
}




$md5pass = md5($_POST['conf_pass']);
$activ_code = rand(1000,9999);
$server = $_SERVER['HTTP_HOST'];
$host = ereg_replace('www.','',$server);
mysql_query("INSERT INTO `tritusco_members`.`user_register` (`id` ,`fname` ,`lname` ,`email` ,`pass`, 'activation_code) VALUES (NULL , '$firstname', '$lastname', '$email', '$pass')") or die(mysql_error());
$message = 
"Thank you for registering an account with $server. Here are the login details...\n\n
User Email: $_POST[email] \n
Password: $_POST[conf_pass] \n
Activation Code: $activ_code \n
____________________________________________
*** ACTIVATION LINK ***** \n
Activation Link: http://$server/activate.php?usr=$_POST[email]&code=$activ_code \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";

mail($_POST['email'] , "Login Activation", $message,
    "From: \"Auto-Response\" <notifications@$TritusCo.com>\r\n" .
     "X-Mailer: PHP/" . phpversion());
unset($_SESSION['ckey']);
echo("Registration Successful! An activation code has been sent to your email address with an activation link...");	

exit;
}	

?> 

<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TritusCo - Making life easier on the web!</title>

<link href="css/tritusco.css" rel="stylesheet" type="text/css" />



</head>

<body>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="564" align="center" valign="top"><div id="topright">
   	  <div id="home">
         	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
         	    <tr>
         	      <td width="10"><img src="images/pnkarw.png" width="6" height="15" /></td>
         	      <td width="58"><a href="index.php">Home</a></td>
       	      </tr>
       	    </table>
       	</div>
  			<div id="faqs">
         	<table width="100%" border="0" cellspacing="0" cellpadding="0">
         	<tr>
         	<td width="10"><img src="images/pnkarw.png" width="6" height="15" /></td>
         	<td width="58"><a href="=faqs.php">FAQ's</a></td>
       	    </tr>
       	    </table>
   			</div>
  				<div id="logintab">
         		<table width="100%" border="0" cellspacing="0" cellpadding="0">
         		<tr>
         		<td width="10"><img src="images/pnkarw.png" width="6" height="15" /></td>
         		<td width="58"><a href="login.php">Login</a></td>
       	    	</tr>
       	    	</table>
   				</div>
<div id="contactab">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8"><img src="images/pnkarw.png" width="6" height="15" /></td>
<td width="75"><a href="contacts.php">Contact Us</a></td>
</tr>
</table>
</div>
</div>    
<br />
<div id="bspc"></div>

<div id="logo"><img src="images/logo.png" width="139" height="46" />
</div>
    <br />
    <br />
    <div id="bar">
  <img src="images/bar.png" width="800" height="24" />
</div>
<br /><br /><br /><br />
<center><table width="495" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="495" height="24" align="center" valign="bottom"><img src="images/topbody.png" width="494" height="24" />
  
    
    </td>
  </tr>
  <tr>
    <td height="100%">  
    <div id="bodybox">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="3%">  </td>
          <td width="94%"> <center><form action="signup.php" method="POST" name="signup"><table width="434" height="359" border="0" cellpadding="0" cellspacing="4">
  <tr>
    <td width="162" height="66" align="left" valign="top" class="headerName">Sign <span class="headername">Up</span></td>
    <td colspan="3"> </td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">First Name:</td>
    <td colspan="3"><label>
      <input name="firstname" type="text" class="textBox" id="firstname" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Last Name:</td>
    <td colspan="3"><label>
      <input name="lastname" type="text" class="textBox" id="firstname" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Email:</td>
    <td colspan="3"><label>
      <input name="email" type="text" class="textBox" id="email" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Confirm Email:</td>
    <td colspan="3"><label>
      <input name="conf_email" type="text" class="textBox" id="conf_email" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Password:</td>
    <td colspan="3"><label>
      <input name="pass" type="password" class="textBox" id="pass" />
    </label></td>
  </tr>
  <tr>
    <td height="32" align="right" valign="middle" class="naText">Confirm Password:</td>
    <td colspan="3"><label>
      <input name="conf_pass" type="password" class="textBox" id="conf_pass" />
    </label></td>
  </tr>
  <tr>
    <td height="19" align="right"></a>  <img src="pngimg.php" alt="" align="middle" /></td>
    <td width="4" height="19" align="left"> </td>
    <td width="148" align="left"><input name="user_code" type="text" size="10" /></td>
    <td height="19" align="center"> </td>
    </tr>
  <tr>
    <td height="46" colspan="4" align="center"><input type="image" value="submit" src="./images/signupbut.png" border="0" alt="SUBMIT!" name="image2" /></td>
  </tr>
  <tr>
    <td align="center"></a></td>
    <td colspan="2" align="center" class="naText">Own a business?</td>
    <td width="100" align="left"><a href="register.php">Register</a></td>
  </tr>
          </table>
</form></center></td>
          <td width="3%"> </td>
        </tr>
      </table>
    </div>
    </td>
  </tr>
  <tr>
    <td height="24" valign="top"><img src="images/botbody.png" width="494" height="24" /></td>
  </tr>
</table>
</center>

</td>
  </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

my code isnt working
What is it doing? Blank page, php error, one of your error messages in the code, redirecting... What do you see in front of you that would help someone to help you?

ive changed around a few things.... ok so when i try to register... i have the form action set to its self... and it reloads the page, but doesnt do anything... doesnt add the users info to the database, and it doesnt send a message to the screen... take a look at my code

<?php 
session_start();


include ('dbc.php'); 


if ($_POST['Submit'] == 'Register')
{
   if (strlen($_POST['email']) < 5)
   {
    die ("Incorrect email. Please enter valid email address..");
    }
   if (strcmp($_POST['pass'],$_POST['conf_pass']) || empty($_POST['pass']) )
{ 
//die ("Password does not match");
die("ERROR: Password does not match or empty..");

}
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{ 
		 die("Invalid code entered. Please enter the correct code as shown in the Image");
  		} 
$rs_duplicates = mysql_query("select id from user_register where user_email='$_POST[email]'");
$duplicates = mysql_num_rows("$rs_duplicates");

if ($duplicates > 0)
{	
//die ("ERROR: User account already exists.");
header("Location: register.php?msg=ERROR: User account already exists..");
exit();
}




$md5pass = md5($_POST['conf_pass']);
$activ_code = rand(1000,9999);
$server = $_SERVER['HTTP_HOST'];
$host = ereg_replace('www.','',$server);
mysql_query("INSERT INTO `tritusco_members`.`user_register` (`id` ,`fname` ,`lname` ,`email` ,`pass`, 'activation_code) VALUES (NULL , '$firstname', '$lastname', '$email', '$pass')") or die(mysql_error());
$message = 
"Thank you for registering an account with $server. Here are the login details...\n\n
User Email: $_POST[email] \n
Password: $_POST[conf_pass] \n
Activation Code: $activ_code \n
____________________________________________
*** ACTIVATION LINK ***** \n
Activation Link: http://$server/activate.php?usr=$_POST[email]&code=$activ_code \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";

mail($_POST['email'] , "Login Activation", $message,
    "From: \"Auto-Response\" <notifications@$TritusCo.com>\r\n" .
     "X-Mailer: PHP/" . phpversion());
unset($_SESSION['ckey']);
echo("Registration Successful! An activation code has been sent to your email address with an activation link...");	

exit;
}	

?> 

<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TritusCo - Making life easier on the web!</title>

<link href="css/tritusco.css" rel="stylesheet" type="text/css" />



</head>

<body>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="564" align="center" valign="top"><div id="topright">
   	  <div id="home">
         	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
         	    <tr>
         	      <td width="10"><img src="images/pnkarw.png" width="6" height="15" /></td>
         	      <td width="58"><a href="index.php">Home</a></td>
       	      </tr>
       	    </table>
       	</div>
  			<div id="faqs">
         	<table width="100%" border="0" cellspacing="0" cellpadding="0">
         	<tr>
         	<td width="10"><img src="images/pnkarw.png" width="6" height="15" /></td>
         	<td width="58"><a href="=faqs.php">FAQ's</a></td>
       	    </tr>
       	    </table>
   			</div>
  				<div id="logintab">
         		<table width="100%" border="0" cellspacing="0" cellpadding="0">
         		<tr>
         		<td width="10"><img src="images/pnkarw.png" width="6" height="15" /></td>
         		<td width="58"><a href="login.php">Login</a></td>
       	    	</tr>
       	    	</table>
   				</div>
<div id="contactab">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8"><img src="images/pnkarw.png" width="6" height="15" /></td>
<td width="75"><a href="contacts.php">Contact Us</a></td>
</tr>
</table>
</div>
</div>    
<br />
<div id="bspc"></div>

<div id="logo"><img src="images/logo.png" width="139" height="46" />
</div>
    <br />
    <br />
    <div id="bar">
  <img src="images/bar.png" width="800" height="24" />
</div>
<br /><br /><br /><br />
<center><table width="495" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="495" height="24" align="center" valign="bottom"><img src="images/topbody.png" width="494" height="24" />
  
    
    </td>
  </tr>
  <tr>
    <td height="100%">  
    <div id="bodybox">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="3%">  </td>
          <td width="94%"> <center><form action="signup.php" method="POST" name="signup"><table width="434" height="359" border="0" cellpadding="0" cellspacing="4">
  <tr>
    <td width="162" height="66" align="left" valign="top" class="headerName">Sign <span class="headername">Up</span></td>
    <td colspan="3"> </td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">First Name:</td>
    <td colspan="3"><label>
      <input name="firstname" type="text" class="textBox" id="firstname" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Last Name:</td>
    <td colspan="3"><label>
      <input name="lastname" type="text" class="textBox" id="firstname" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Email:</td>
    <td colspan="3"><label>
      <input name="email" type="text" class="textBox" id="email" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Confirm Email:</td>
    <td colspan="3"><label>
      <input name="conf_email" type="text" class="textBox" id="conf_email" />
    </label></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="naText">Password:</td>
    <td colspan="3"><label>
      <input name="pass" type="password" class="textBox" id="pass" />
    </label></td>
  </tr>
  <tr>
    <td height="32" align="right" valign="middle" class="naText">Confirm Password:</td>
    <td colspan="3"><label>
      <input name="conf_pass" type="password" class="textBox" id="conf_pass" />
    </label></td>
  </tr>
  <tr>
    <td height="19" align="right"></a>  <img src="pngimg.php" alt="" align="middle" /></td>
    <td width="4" height="19" align="left"> </td>
    <td width="148" align="left"><input name="user_code" type="text" size="10" /></td>
    <td height="19" align="center"> </td>
    </tr>
  <tr>
    <td height="46" colspan="4" align="center"><input type="image" value="submit" src="./images/signupbut.png" border="0" alt="SUBMIT!" name="image2" /></td>
  </tr>
  <tr>
    <td align="center"></a></td>
    <td colspan="2" align="center" class="naText">Own a business?</td>
    <td width="100" align="left"><a href="register.php">Register</a></td>
  </tr>
          </table>
</form></center></td>
          <td width="3%"> </td>
        </tr>
      </table>
    </div>
    </td>
  </tr>
  <tr>
    <td height="24" valign="top"><img src="images/botbody.png" width="494" height="24" /></td>
  </tr>
</table>
</center>

</td>
  </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

I don't see anything in your form that would cause $_POST['Submit'] to be set to 'Register'. How about put the following lines in your code right after the include statement to see what exactly you are receiving (on the initial page load this will display an empty array) -

 

echo "<pre>";
echo "POST:";
print_r($_POST);
echo "</pre>";

Link to comment
Share on other sites

It sends this to the page...

 

POST:Array

(

)

 

 

I don't see anything in your form that would cause $_POST['Submit'] to be set to 'Register'. How about put the following lines in your code right after the include statement to see what exactly you are receiving (on the initial page load this will display an empty array) -

 

echo "<pre>";
echo "POST:";
print_r($_POST);
echo "</pre>";

Link to comment
Share on other sites

Well, when you submit the form on that page, which is the subject being discussed (I already told you that - "on the initial page load this will display an empty array"), you get something that looks like this -

 

POST:Array
(
    [firstname] => myfirst
    [lastname] => mylast
    [email] => myemail
    [conf_email] => myemailagain
    [pass] => mypwd
    [conf_pass] => mypwdagain
    [user_code] => something
    [image2_x] => 
    [image2_y] => 
    [image2] => submit
)

 

There is nothing there that is setting $_POST['Submit'] to anything and certainly not the value 'Register'

 

Link to comment
Share on other sites

ok, so i see what u mean... i made it POST and i made it action "login.php" and this is what i get.

 

POST:Array

(

    => Atticus504@aim.com

    [pass] => usarmy

    [image2_x] => 58

    [image2_y] => 17

    [image2] => submit

)

 

 

 

Well, when you submit the form on that page, which is the subject being discussed (I already told you that - "on the initial page load this will display an empty array"), you get something that looks like this -

 

POST:Array
(
    [firstname] => myfirst
    [lastname] => mylast
    [email] => myemail
    [conf_email] => myemailagain
    [pass] => mypwd
    [conf_pass] => mypwdagain
    [user_code] => something
    [image2_x] => 
    [image2_y] => 
    [image2] => submit
)

 

There is nothing there that is setting $_POST['Submit'] to anything and certainly not the value 'Register'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

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.