Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2008-01-22, 04:11 AM
Junior Member
 
Join Date: Jan 2008
Posts: 2
tylerdawebmasta is on a distinguished road
Default user system help

I programmed a PHP login script for my website and everything works. However, I have one minor problem I can't figure out. In my website's main page code, I inserted this code:

Code:
<?
         include("login/include/session.php");
         if($session->logged_in){
   echo "Welcome <b>$session->username</b>, you are logged in. &nbsp;&nbsp;"
       ."[<a href=\"login/userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
       ."[<a href=\"login/useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
   if($session->isAdmin()){
      echo "[<a href=\"login/admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
   }
   echo "[<a href=\"http://cullmandrumline.org/forum\">Forum</a>] &nbsp;&nbsp;";
   echo "[<a href=\"http://cullmandrumline.org/media\">Media</a>] &nbsp;&nbsp;";
   echo "[<a href=\"login/process.php\">Logout</a>]";
}
else{
    echo "Welcome, Guest. [<a href=\"http://cullmandrumline.org/login/main.php\">Click here to log in.</a>] Not registered? [<a href=\"http://cullmandrumline.org/login/register.php\">Click here to register.</a>] <br><br>";
}
    ?>
I used this code to create a line at the top of the page to tell the user if they are logged in or not, and if they are or are not, displays the appropriate information. This works, but it always displays an error.

Here's the output:

Code:
Warning:  session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/tyler/domains/cullmandrumline.org/public_html/main.php:9) in /home/tyler/domains/cullmandrumline.org/public_html/login/include/session.php on line 46

Warning:  session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/tyler/domains/cullmandrumline.org/public_html/main.php:9) in /home/tyler/domains/cullmandrumline.org/public_html/login/include/session.php on line 46
Welcome, Guest. [Click here to log in.] Not registered? [Click here to register.]
I've tried several things to resolve this, and I can't figure it out.

Can anyone help me?

Thanks,
Tyler
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2008-01-22, 10:30 PM
Member
 
Join Date: Jan 2007
Location: SPb, Russia
Posts: 30
powerdesign is on a distinguished road
Default

tylerdawebmasta, try @include("login/include/session.php"); but better check login/include/session.php for errors, I think it outputs some error text and session cannot be started because of this.
Reply With Quote
  #3 (permalink)  
Old 2008-01-22, 10:43 PM
Junior Member
 
Join Date: Jan 2008
Posts: 2
tylerdawebmasta is on a distinguished road
Default

thanks a lot,

the @include fixed the problem. I don't know why I didn't think of it...

I had already combed through sessions.php and there were no flaws

Well,
THANK YOU SO MUCH!!!

Tyler
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:45 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.