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

Reply

Join Date: Jul 2009
Posts: 2
Reputation: ersubhajit is an unknown quantity at this point 
Solved Threads: 0
ersubhajit ersubhajit is offline Offline
Newbie Poster

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

 
0
  #1
Jul 22nd, 2009
I am getting this problem whenever I login from index.php to admin_area.php. I am giving the codes of the two files. Please help.

Index.php

  1. <?php
  2. session_start();
  3. include("../lib/globals.php");
  4.  
  5.  
  6.  
  7. if(isset($_REQUEST['submit']))
  8. {
  9. $u_name=$_REQUEST['username'];
  10. $pass=$_REQUEST['password'];
  11. $sql="select * from `user_table_master` where `user_name`='$u_name' and `password`='$pass'";
  12.  
  13. $result=mysql_query($sql);
  14. $row=mysql_fetch_array($result);
  15.  
  16. $num_of_rows=mysql_num_rows($result);
  17.  
  18. if($num_of_rows>0)
  19. {
  20. $_SESSION['logged_in']='y';
  21. $_SESSION['user_type']=$row['user_type'];
  22. $_SESSION['user_formation']=$row['formation'];
  23. $_SESSION['user_name']=$row['user_name'];
  24. $_SESSION['name']=$row['name'];
  25. $_SESSION['user_id']=$row['user_id'];
  26. $_SESSION['can_see_remarks']=$row['can_see_remarks'];
  27. ?>
  28. <script language="JavaScript">
  29. document.location.href='admin_area.php';
  30. </script>
  31. <?php
  32. }
  33. else
  34. {
  35. ?>
  36. <script language='javascript'>
  37. alert("Either 'UserName' or 'PassWord' is incorrect");
  38. </script>
  39. <?php
  40. }
  41. }
  42.  
  43. ?>
  44.  
  45. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  46. <html>
  47. <head>
  48. <title>SMERians' Corner</title>
  49. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  50. <link href="../style/style.css" rel="stylesheet" type="text/css">
  51. <script language="javascript">
  52. function validate()
  53. {
  54. var username=document.f1.username.value;
  55. var password=document.f1.password.value;
  56. if(username=="")
  57. {
  58. alert('Please enter Login Id.');
  59. document.f1.username.focus();
  60. return false;
  61. }
  62. if(password=="")
  63. {
  64. alert('Please enter Password.');
  65. document.f1.password.focus();
  66. return false;
  67. }
  68. }
  69. </script>
  70. </head>
  71.  
  72. <body leftmargin="0" topmargin="0" alink="#000000" vlink="#000000" link="#000000">
  73. <table width='100%' height="117" border='0' cellspacing="0">
  74. <tr height="60">
  75. <td align="center" bgcolor="#2A166F" class="sty1">
  76. <table id="Table_01" width="567" height="90" border="0" cellpadding="0" cellspacing="0">
  77. <tr bgcolor="00AEEF">
  78. <td width="530" align="center" valign="middle" bgcolor="#2A166F"> <font size="+5"><img src="../images/ADMIN1.gif"></font></td>
  79. </tr>
  80. </table>
  81. </td>
  82. </tr>
  83. <tr height="2px"><td bgcolor="#FFFFFF"></td></tr>
  84. <tr height="4px"><td align="right" bgcolor="00aeef"></td></tr>
  85. </table>
  86. <form name="f1" method="post" action="index.php" onSubmit="return validate();">
  87. <p>&nbsp;</p>
  88. <p>&nbsp;</p>
  89. <table width="36%" border="0" align="center" cellspacing="0" cellpadding="0" class="tab_sty1" bgcolor="00AEEF">
  90. <tr bgcolor="#000000" height="20"><td colspan="4" class="mysty1"><div align="center"><font color="#FFFFFF"><b>SMERians' Login</b></font></div></td></tr>
  91. <tr><td><div align="center"></div></td>
  92. <td>&nbsp;</td>
  93. <td>&nbsp;</td>
  94. <td width="45%" rowspan="6"><img src="../images/key.jpg" width="150" height="112"></td>
  95. </tr>
  96. <tr><td>&nbsp;</td>
  97. <td>&nbsp;</td>
  98. <td>&nbsp;</td>
  99. </tr>
  100. <tr>
  101. <td width="27%" align="center" class="mysty2"><div align="right">&nbsp;Login ID : </div></td>
  102. <td width="2%">&nbsp;</td>
  103. <td width="26%" align="left"><input name="username" type="text" id="username" size="15" maxlength="20"></td>
  104. </tr>
  105. <tr>
  106. <td align="center" class="mysty2"><div align="right">Password : </div></td>
  107. <td>&nbsp;</td>
  108. <td align="center"><div align="left"><input name="password" type="password" id="password" size="15"></div></td>
  109. </tr>
  110. <tr><td align="center">&nbsp;</td>
  111. <td align="center">&nbsp;</td>
  112. <td align="center">&nbsp;</td>
  113. </tr>
  114. <tr><td align="center">&nbsp;</td>
  115. <td align="center">&nbsp;</td>
  116. <td align="center">&nbsp;</td>
  117. </tr>
  118. <tr><td align="center" colspan="4"><input type="submit" name="submit" value="Submit" ></td></tr>
  119. <tr><td colspan="4">&nbsp;</td></tr>
  120. </table>
  121. </form>
  122. </body>
  123. </html>




admin_area.php

  1. <?php
  2. session_start();
  3. if(!empty($_SESSION['logged_in']))
  4. {
  5. $user_name=$_SESSION['user_name'];
  6. $user_type=$_SESSION['user_type'];
  7. ?>
  8. <html>
  9. <head>
  10. <title>SMERians' Corner</title>
  11. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  12. <link href="../style/style.css" rel="stylesheet" type="text/css">
  13. <script language="javascript">
  14. function validate()
  15. {
  16. var username=document.f1.username.value;
  17. var password=document.f1.password.value;
  18. if(username=="")
  19. {
  20. alert('Please enter Login Id.');
  21. document.f1.username.focus();
  22. return false;
  23. }
  24. if(password=="")
  25. {
  26. alert('Please enter Password.');
  27. document.f1.password.focus();
  28. return false;
  29. }
  30. }
  31. </script>
  32. <style type="text/css">
  33. <!--
  34. .style12 {font-size: 16px}
  35. -->
  36. </style>
  37. </head>
  38. <body leftmargin="0" topmargin="0" alink="#000000" vlink="#000000" link="#000000" onLoad="startclock()">
  39. <?php include("admin_header.php");?>
  40. <table width='98%' border='0' cellspacing="0">
  41. <tr>
  42. <td width="190" align="left" valign="top"><?php include("admin_left.php"); ?></td>
  43. <td align="center" valign="top">
  44. <table width="800" border="0" align="center">
  45. <tr><td align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000"><? echo date('d-m-Y'); ?>&nbsp;&nbsp;<span id="showDate"></span></font></td></tr>
  46. </table>
  47. <br><br><br>
  48. <table width="500" border="0" align="center">
  49. <tr>
  50. <td class="text4">
  51. <div align="center">
  52. <?php if (isset($_GET['val']))
  53. {
  54. ?>
  55. <font size="+2">You Are Not An Authorised User To See This Page</font>
  56. <?php
  57. }
  58. else
  59. {
  60. ?>
  61. <font color="00aeef" size="+2">
  62. Welcome <?php echo"'".$_SESSION['name']."'"; ?></font>
  63. <?php
  64. }
  65. ?>
  66. </div>
  67. </td>
  68. </tr>
  69. </table>
  70. </td>
  71. </tr>
  72. </table>
  73. </body>
  74. </html>
  75. <?php
  76. }
  77. else
  78. {
  79. header("location:index.php");
  80. }
  81. ?>
  82.  




Please help me as soon as possible
Last edited by peter_budo; Jul 22nd, 2009 at 2:56 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 17
Reputation: praghna is an unknown quantity at this point 
Solved Threads: 2
praghna's Avatar
praghna praghna is offline Offline
Newbie Poster

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

 
0
  #2
Jul 22nd, 2009
Make sure there are no characters in the file before the <?php and save any UTF-8 files without the BOM.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 47
Reputation: Banderson is an unknown quantity at this point 
Solved Threads: 4
Banderson's Avatar
Banderson Banderson is offline Offline
Light Poster

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

 
0
  #3
Jul 22nd, 2009
Be sure that session_start(); is the first line in each of your codes without spaces or blank lines.
  1. <?php
  2. session_start();
  3. ............................
  4. ?>
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 2
Reputation: ersubhajit is an unknown quantity at this point 
Solved Threads: 0
ersubhajit ersubhajit is offline Offline
Newbie Poster

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

 
0
  #4
Jul 22nd, 2009
Originally Posted by Banderson View Post
Be sure that session_start(); is the first line in each of your codes without spaces or blank lines.
  1. <?php
  2. session_start();
  3. ............................
  4. ?>

Thank You Very Much. There was a space before the <?php tag.

It solved my problem. Thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 47
Reputation: Banderson is an unknown quantity at this point 
Solved Threads: 4
Banderson's Avatar
Banderson Banderson is offline Offline
Light Poster

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

 
0
  #5
Jul 22nd, 2009
Glad you got it fixed, please mark this thread solved.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 44
Reputation: guru12 is an unknown quantity at this point 
Solved Threads: 6
guru12's Avatar
guru12 guru12 is offline Offline
Light Poster

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

 
0
  #6
Jul 22nd, 2009
Dear friend

Can you please remove the session_start(), because they already start the seecion in include("../lib/globals.php"); file , these reason only show this error

THanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC