Links that are logging people out problem

Discussion in 'PHP' started by Laceygirl, Mar 31, 2009.

  1. #1
    I'm having this issue with links. This script I'm working with has an admin panel and its giving me troubles.

    By clicking on the first link, its logging me out of the admin panel:

     
    <div id="nav">
      <div class="nav_right"></div>
      <ul class="navMenu">
       <li>[COLOR=red]<a href="<?=$site_url?>/admin">Admin Home</a>[/COLOR]</li>
       <li><a href="?action=manage">Media</a></li>
       <li><a href="?action=manage_cats">Categories</a></li>
       <li><a href="?action=manage_pages">Pages</a></li>
       <li><a href="?action=manage_users">Users</a></li>
       <li><a href="?action=manage_links">Links</a></li>
       <li><a href="?action=comments">Comments</a></li>
       <li><a href="?action=settings">Settings</a></li>
      </ul>
      <div class="nav_left"></div>
     </div>
    
    Code (markup):
    What other options do I got to code this so it doesn't log me out?

    I have it setup differently like so but it still does the logout thing:
    	<div id="up_header">
    	<div id="logo">
    		<div id="siteName">
    		[COLOR="Red"]<a href="<? echo "$site_url"?>">PH Arcade</a>[/COLOR]		</div>
    Code (markup):

     
    Laceygirl, Mar 31, 2009 IP
  2. javaongsan

    javaongsan Well-Known Member

    Messages:
    1,054
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #2
    try
     <li><? echo "<a href='http://$site_url/admin'>Admin Home</a>"; ?></li> 
    
    Code (markup):
     
    javaongsan, Mar 31, 2009 IP
  3. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #3
    No matter what kind/style of links you are adding, they should not affect session data ! In case if it happens, probably your landing page ( link target ) uses an incomplete verification ( which resets all your current session information ).
     
    ActiveFrost, Mar 31, 2009 IP
  4. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ensure that you are not going from a non-www domain (google) to a www (www.google) because the session data will NOT be the same.
     
    NatalicWolf, Mar 31, 2009 IP
  5. Laceygirl

    Laceygirl Notable Member

    Messages:
    4,617
    Likes Received:
    188
    Best Answers:
    1
    Trophy Points:
    250
    #5
    Doesn't change anything.

    Its not.:)

    Which means it'll be near impossible to search through and find the problem as this script has like 100 files to it. I may have to hand this to a pro.
     
    Laceygirl, Mar 31, 2009 IP
  6. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I can help you for a very fair price. Hit me up. I have experience at debugging and analysis of code.
     
    NatalicWolf, Mar 31, 2009 IP
  7. SHOwnsYou

    SHOwnsYou Peon

    Messages:
    209
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I would suggest checking the pages that log you out for a database connection.

    If your db name, user name or password are typed wrong (or just missing), this will log you out. Or if that is working, you may not have it set up to keep you logged in. A lot of scripts just use

    session_start();

    To keep the session alive. If this is missing, you likely only need to make a few changes for it to work.
     
    SHOwnsYou, Apr 1, 2009 IP
  8. Laceygirl

    Laceygirl Notable Member

    Messages:
    4,617
    Likes Received:
    188
    Best Answers:
    1
    Trophy Points:
    250
    #8
    Heck no. I got $2000 in the business so far and I'm not willing to spend a dime more! Of course I welcome you to do it for the love of helping others. Since I can't handle the pressure of making the whole new version I hired someone to do it. When they were "so called" finished absolutely worked right and I had to go through it all. This is one of the last issues I've got.

    That looks to be the problem. I put this sesson_start(); in the following line(its probably wrong):
    </head>
    <?php
        include ('../config.php');
    	include ('includes/admin.php');
    	$userid = intval($_COOKIE['ava_userid']);
    	session_start();
    	?>
    <body>
    Code (markup):
    Maybe its right, maybe not. I tried with the { as well but no luck. Starting from yesterday I noticed that anytime I edit and reupload this particular file it ends up locking me online for a couple of hours. It won't let me logout of the site. Could this error be evidence of where the problem is?
     
    Laceygirl, Apr 1, 2009 IP
  9. SHOwnsYou

    SHOwnsYou Peon

    Messages:
    209
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    This is really hard to diagnose without the additional code.

    Do you have something that displays whether people are logged in or not? Like "You are logged in as xxx"

    Does that display when you enter the admin page? Or just that you do not have the proper credentials?

    The source of the log out almost has to be it not continuing with the registered session. So you are missing a couple lines of code somewhere on the page.

    Hard to tell without knowing what the config and admin includes contain.
     
    SHOwnsYou, Apr 1, 2009 IP
  10. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I will help you for free, please message me. I know what is wrong now. Simply IM me. I will do it free.
     
    NatalicWolf, Apr 1, 2009 IP
    Laceygirl likes this.
  11. rosseric

    rosseric Peon

    Messages:
    24
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    session_start() shouldn't be used after sending headers (which are sent ones you send output - like HTML, so session_start() should be before any output)
    also, $userid = intval($_COOKIE['ava_userid']); doesn't seem much secure. cookies can be edited on the client side, it should be verified by keeping the password (hashed) in the cookie too, or using sessions for storing the user id.
     
    rosseric, Apr 2, 2009 IP