Synook Posted January 24, 2010 Share Posted January 24, 2010 That means you have output on line 1 that is preventing a header being sent on line 5. Link to comment Share on other sites More sharing options...
migroo Posted January 24, 2010 Author Share Posted January 24, 2010 Okay I have changed my coding lol I didn't think anyone would be on and so I have edited my last post.The only coding I have on line 1 would be <?phpThen I declare a few variables to catch the data from the forum between line 1 and line 5.On line 5 I have it set my session. Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2010 Share Posted January 24, 2010 You have to call session_start() on every page where you'll be using the $_SESSION variable. Link to comment Share on other sites More sharing options...
migroo Posted January 24, 2010 Author Share Posted January 24, 2010 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/darva11/public_html/login.php:1) in /home/darva11/public_html/login.php on line 2I am getting this error on my LogIn.php page.And I am utterly lost as to why I am getting this. Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2010 Share Posted January 24, 2010 Make sure that the following is the first thing in the document, even before spaces or line breaks: <?php session_start(); Link to comment Share on other sites More sharing options...
migroo Posted January 24, 2010 Author Share Posted January 24, 2010 Okay I am still getting an error:Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/darva11/public_html/login.php:1) in /home/darva11/public_html/login.php on line 1Here is my exact php code starting on line 1 column 1: <?php session_start(); $user = $_POST['username']; $pass = $_POST['password']; //conection information $con = mysql_connect("localhost","gelin","muga"); //selecting databace mysql_select_db("hamerab", $con); //Check for propper password $result = mysql_query("SELECT * FROM users WHERE UserName='$user'"); $row = mysql_fetch_array($result); if($row['UserName'] == $user && $row['Password'] == $pass) { $good = "Welcome ".$row['DisplayName'].". You are now Securly Logged in. <a href='/profiles/".$row['ProfileUrl']."/index.php'>OK</a>"; $_SESSION['username']=$user; } else $bad="Sorry, Your username or password is wrong!"; ?> After this I have my DTD and then my php coding.Also here is my login forum coding: <form action="/login.php" method="post"> <table> <tr> <th colspan="2"> <img border="0" src="/images/welcome1.png" width="230" height="75" /> </th> </tr> <tr> <td><input class="grey" type="text" name="username" value="Username"/></td> <th rowspan="2"> <a href="/register.html"> <img border="0" src="/images/join.png" width="60" height="120" /> </a> </th> </tr> <tr> <td><input class="grey" type="password" name="password" value="Password" /></td> </tr> <tr> <th colspan="2"> <input type="image" src="/images/log1.png" width="230" height="75"/> </th> </tr> </table> </form> Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2010 Share Posted January 24, 2010 Are you including that file into another file? Link to comment Share on other sites More sharing options...
migroo Posted January 24, 2010 Author Share Posted January 24, 2010 Are you including that file into another file?I have two files. The LogIn forum is: HQ2.htmlAnd the file I am trying to use to create the session is: login.phpI then have a third file. That is going to use the session.Here is a link to the HQ2.html file:HQ2.htmlThe username I am using to test it with is: airjetericThe password is: eleeteyou will have to forgive the size of the site I made it 1400px wide. I think you might be able to more clearly see what I am trying to do, if you just see it.And thanks again for all the help. I have learned more in the last few days, here, from you guys then I have learned in months. Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2010 Share Posted January 24, 2010 If the file is included into another one, you only need the session_start() function the the main file. Link to comment Share on other sites More sharing options...
migroo Posted January 24, 2010 Author Share Posted January 24, 2010 Here is what they are doing:HQ2.html-->>login.php-->>index.phpSo I just need to use the session_start() in HQ2.html? Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2010 Share Posted January 24, 2010 Here is what they are doing:HQ2.html-->>login.php-->>index.phpSo I just need to use the session_start() in HQ2.html?Are you using include() to place login.php inside HQ2.html? Link to comment Share on other sites More sharing options...
migroo Posted January 24, 2010 Author Share Posted January 24, 2010 No I am not I just am making the pages php and using html on them am I doing that wrong? Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2010 Share Posted January 24, 2010 No, you're not. I was just saying that if a file is included into another, session_start() isn't needed.If you're getting a "headers already sent" error, then there has to be some output somewhere in the file before session_start() was called. Link to comment Share on other sites More sharing options...
migroo Posted January 26, 2010 Author Share Posted January 26, 2010 Okay I will Look around and maybe re do the whole thing Just to see if its something dumb. I will probably be back to posting in a day or too. =] Link to comment Share on other sites More sharing options...
migroo Posted January 27, 2010 Author Share Posted January 27, 2010 Never mind what I had posted here I figured it out. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.