473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Cannot send session cache limiter - headers already sent

2
I get this msg: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /web/www/frac/users/s/students/katalog/brukere/login.php:2) in /web/www/frac/users/s/students/katalog/brukere/login.php on line 3

when I use this code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if($_GET['loggut']=="1")
  4. {
  5. session_start();
  6. session_destroy(); 
  7. header("Location: medlem.php"); 
  8. exit(); 
  9. else 
  10. session_start(); 
  11.  
  12.  
  13. require("innstillinger/konfigurasjon.php"); 
  14.  
  15. if(file_exists("installer.php")) 
  16. echo <<<__HTML_END
  17. exit(); 
  18.  
  19. if(!empty('$_SESSION[b_brukernavn]') && 
  20. !empty('$_SESSION[b_login_key]')) 
  21. $b_brukernavn = '$_SESSION[b_brukernavn]'; 
  22. $b_login_key = '$_SESSION[b_login_key]'; 
  23.  
  24. $sql = mysql_query("select * from $tabell_brukere where 
  25. brukernavn = '$b_brukernavn' AND login_key = 
  26. '$b_login_key' AND status <> '0'"); 
  27.  
  28. $antall_funnet = mysql_num_rows($sql); 
  29.  
  30. if($antall_funnet==1) 
  31. header("Location: medlem.php"); 
  32. exit(); 
  33.  
  34. if(isset($_POST[logginn])) 
  35. foreach( $_POST as $key => $value ) 
  36.  ${$key} = htmlspecialchars($value, ENT_QUOTES); 
  37. if(!empty($brukernavn) && !empty($passord)) 
  38. $md_passord = md5($passord); 
  39.  
  40. $sjekk_bruker = mysql_query("select id from 
  41. $tabell_brukere where passord='$md_passord' and 
  42. brukernavn='$brukernavn'"); 
  43. $funnet=mysql_num_rows($sjekk_bruker); 
  44.  
  45. if($funnet<>1) 
  46. sleep(3); 
  47. print "Beklager, gyldig bruker ble ikke funnet"; 
  48. else 
  49. function tilfeldig_key($lengde) 
  50. $utvalg = 
  51. "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr 
  52. stuvwxyz"; 
  53. for($i=0;$i<$lengde;$i++) 
  54. $streng .= $utvalg{rand(0,35)}; 
  55. return $streng; 
  56. $tidspunkt = date("d-m-Y H:i:s"); 
  57. $login_session_kode = date("YmdHis").tilfeldig_key(15); 
  58. $login_session_md_kode = md5($login_session_kode); 
  59.  
  60. $oppdater_db = mysql_query("update $tabell_brukere set 
  61. login_key='$login_session_md_kode', 
  62. login_tid='$tidspunkt', count=count+1 where 
  63. brukernavn='$brukernavn' AND passord='$md_passord'"); 
  64.  
  65. if($oppdater_db) 
  66. '$_SESSION[b_brukernavn]'= $brukernavn; 
  67. '$_SESSION[b_login_key]'= $login_session_md_kode; 
  68.  
  69. header("Location: medlem.php"); 
  70. print "Innlogging vellykket, <a href='$brukerside'>Gå 
  71. videre til medlemsområdet --></a>"; 
  72. exit(); 
  73. else 
  74. print "Innlogging ikke mulig, prøv igjen"; 
  75. else 
  76. print "Både brukernavn og passord må fylles ut"; 
  77.  
  78. // start logg inn skjema 
  79. echo <<<__HTML_END
  80. <form action="login.php" method="post"> 
  81.  
  82. Brukernavn 
  83.  
  84. <input type="text" name="brukernavn" 
  85. value="$brukernavn" size="30" /> 
  86.  
  87. Passord 
  88.  
  89. <input type="password" name="passord" value="" 
  90. size="30" /> 
  91.  
  92. <input type="submit" name="logginn" value="Logg inn" /> 
  93.  
  94. </form> 
  95.  
  96. <a href="glemt_pass.php">Glemt passord ?</a> 
  97.  
  98.  
  99. __HTML_END;
  100. }
  101. ?>


Can someone please help and help me to fix this?
Sep 5 '07 #1
4 2055
arashi
2
I did remove the space and its working no more msg, but i just get a white side whitout anything on it!!! where the login box and password box?:S

help.
Sep 5 '07 #2
nathj
938 Expert 512MB
I get this msg: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /web/www/frac/users/s/students/katalog/brukere/login.php:2) in /web/www/frac/users/s/students/katalog/brukere/login.php on line 3

when I use this code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if($_GET['loggut']=="1")
  4. {
  5. session_start();
  6. session_destroy(); ?>
Hi arashi,

The session_start(); line must be the very first thing the page executes. It has to run before anything else is set. This is what your error means.

Move the session_start() to the very top, so that it appears there and only there and you should be up and running - or at least have this error fixed.

Cheers
nathj
Sep 5 '07 #3
ak1dnar
1,584 Expert 1GB
When posting source codes please use the correct CODE tags, as It is help us to read the code lines easily.
[code=php]
Sep 5 '07 #4
pbmods
5,821 Expert 4TB
Heya, Arashi. Welcome to TSDN!

Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

If you're getting a blank page, your script is probably generating an error. Check out this article to find out what is going on.
Sep 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: mr_burns | last post by:
Hi, i am getting the following errors when running my php script: Warning: Cannot send session cookie - headers already sent by (output started at ...
4
by: Bob | last post by:
Seem to have a problem ending a session. I get the following message. Warning: session_start(): Cannot send session cookie - headers already sent by (output started at...
3
by: lawrence k | last post by:
I'm getting this warning: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
1
by: juergen | last post by:
Hi, there are many postings on this subject, I have read them put don't have an answer. I get these warnings: Cannot send session cookie - headers already sent in, but my php-scripts are okay. ...
14
by: bb nicole | last post by:
I using session when creaate a forum. But it display error like: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at...
4
by: three-eight-hotel | last post by:
I'm somewhat of a newbie to PHP coding, but have developed a site using the technology, and have been pleasantly surprised by the capabilities offered. I am more comfortable in the ASP world,...
3
by: mrosado | last post by:
Hi everybody, I have this problem.- The browser launch this two errors: Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at...
1
by: gipsy | last post by:
Hello, I know that you guys are familiar with this, but I tried almost every solution I googled, but no chance getting it wroked, here is the error. and here is the sessiondata.php lines,...
11
by: craigtomo | last post by:
i have changed my login .php file to the following this file is opened directly and is not called from any other file <?php // dBase file $host=""; // Host name $username=""; // Mysql...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.