Jump to content


Photo

Need some help.


  • Please log in to reply
2 replies to this topic

#1 Loathorhealer

Loathorhealer
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 22 March 2006 - 02:16 AM

Okay. so I have these files.

Header.php and Welcome.php <--

the header .php file contains.

<?php
require_once 'databaseinfofile.php';
?>
<html>
<head>
<title> Torque - Your Sports Cars Headquarters</title>
</head>
<link rel="stylesheet" href="tor.css">
<table cellpadding="0" cellspacing="0" width="1000" align="center">
<?php
   print("<tr><td align=\"center\">");
   print("<img src=\"images\banner.jpg\" align=\"center\" style=\"border:1px solid #868686\">");
   print ("</td></tr>");
   print("<tr><td class=\"thead\" width=\"1000\" height=\"29\" style=\"border-bottom:1px solid #868686\" style=\"border-right:1px solid #868686\" style=\"border-left: 1px solid #868686\">");
   print("<table align=\"right\" width=\"1000\" height=\"29\" cellpadding=\"0\" cellspacing=\"1\"><tr>");
   print("<td width=\"700\">");

if ($logged_in == 1) {
               print("<a href=\"welcome.php?page=user_profile\"><img src=\"images\usercp.jpg\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"images\memberlist.jpg\">");
} else {
    echo 'Register';
}


   print("</td><td class=\"contenthead\" width=\"300\" align=\"right\">");


if ($logged_in == 1) {
    echo 'Logged in as '.$_SESSION['username'].', <a href="logout.php">logout</a>';
} else {
    echo 'Not logged in. <a href="login.php">Login</a>';
}




   print ("</td></tr></table>");
?>
</table>

and then. The Welcome has


<?php
require_once 'header.php';
   print ("</td></tr></table>");
     if ($logged_in == 1) {
    echo 'welcome back '.$_SESSION['username'].'';
} else {

 print ("
<h1>Login</h1>
<form action=\"login_functions.php\" method=\"post\">
<table align=\"center\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">
<tr><td>Username:</td><td>
<input type=\"text\" name=\"uname\" maxlength=\"40\">
</td></tr>
<tr><td>Password:</td><td>
<input type=\"password\" name=\"passwd\" maxlength=\"50\">
</td></tr>
<tr><td colspan=\"2\" align=\"right\">
<input type=\"submit\" name=\"submit\" value=\"Login\">
</td></tr>
</table>
</form>
</body>
</html>");
}
?>

okay. and then at the top of my page..I get these errors:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/.navy/loathor/squaresyndicate.com/welcome.php:2) in /home/.navy/loathor/squaresyndicate.com/check_login.php on line 5

and what It does, is it registers the session on another page called Login_functions <-- and I dont understand why Im getting that error. :-/

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 22 March 2006 - 02:24 AM

The easiest thing to do is to make session_start() the first command intrepreted by php. If anything has been sent to the browser before session_start() has been called, it will fail.

Move session_start() to the top...make it the first include and at the top of that include, then it should work.

#3 Loathorhealer

Loathorhealer
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 22 March 2006 - 02:41 AM

[!--quoteo(post=357181:date=Mar 21 2006, 09:24 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 21 2006, 09:24 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
The easiest thing to do is to make session_start() the first command intrepreted by php. If anything has been sent to the browser before session_start() has been called, it will fail.

Move session_start() to the top...make it the first include and at the top of that include, then it should work.
[/quote]

LOL you can call me retarted. I had a space in my welcome.php <-- first line and thats what screwed it up. Thanks a bunch. But before I go. I was wondering if you could help me really quick. I want a profile page. somewhat close to Myspace. I was wondering if you could maybe point me in the right direction?

I can write how the person can view it. BUT I need scripts to how it updates the database. Im not entirely sure how I can do that.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users