Login Problems

Discussion in 'PHP' started by DTHBAH2006, Mar 4, 2007.

  1. #1
    Can someone explain why this happens?

    I got to my admin login screen and type the password. It refreshes and does not go into the admin area. I hit refresh on the browser and it takes me to the main admin section. I then click on a link inside the main admin section and it then takes me back to the original admin login section.

    Very frustrating.

    Any help would be greatly appreciated.

    Thanks,

    dthbah2006 :confused:
     
    DTHBAH2006, Mar 4, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Can you post your code?

    Could be that you're looking for a cookie when it isn't set yet. But only your code will tell us...
     
    nico_swd, Mar 4, 2007 IP
  3. DTHBAH2006

    DTHBAH2006 Active Member

    Messages:
    988
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    70
    #3
    Thanks for replying.

    I have no idea where to get the code needed to solve the problem.
     
    DTHBAH2006, Mar 4, 2007 IP
  4. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #4
    What script are you trying to log in to?
     
    smatts9, Mar 4, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    Open the login page in a text editor and copy and paste the code between
     wrappers here.
    
    Fly over it quick and see if there are any passwords or something personal that you may want to remove before posting it.
    PHP:
     
    nico_swd, Mar 4, 2007 IP
  6. DTHBAH2006

    DTHBAH2006 Active Member

    Messages:
    988
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    70
    #6
    <body id="loginpage">
    <br><br><br><br><br><br><br><br><br>
    <table align="center"><tr><td align="center">
    <div id="logo">Script XXXXXXXXXXXXX Admin</div><br>
    <form name="frmAdminLogin" action="" method="post" id="loginform">
    <b>Enter Admin Password</b> <br><br>
    <input type="hidden" name="user" value="admin">
    <input type="password" name="admin_pass" size="25" ><br><br>
    <button type="submit">Login</button>
    </form>
    <br><br>

    Is this what you are referring?

    I can close the browser and open a new one and it takes me to the admin inside section. When I click a link to complete something in the admin section it takes me back to the admin login page.
     
    DTHBAH2006, Mar 4, 2007 IP
  7. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #7
    No, open the PHP file locally on your computer and copy and paste the code. The PHP code is not visible for normal users when it's parsed on the server.
     
    nico_swd, Mar 4, 2007 IP
  8. DTHBAH2006

    DTHBAH2006 Active Member

    Messages:
    988
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    70
    #8
    require_once("admin.inc.php");


    if ($_POST['admin_pass'] && $_POST['admin_pass'] == $admin_pass)
    // Login admin
    {
    setcookie($ck_admin, md5($admin_pass), 0, "/");
    header("Location: home.php");
    exit;

    }
    elseif ($_GET['signout'])
    // Signout admin
    {
    setcookie($ck_admin, "", 0, "/");
    header("Location: index.php");
    exit;
    }
    elseif ($_COOKIE[$ck_admin] == md5($admin_pass))
    // Already logged in. Redirect to admin home page
    {
    header("Location: home.php");
    exit;
    }


    ?>

    Is this it?
     
    DTHBAH2006, Mar 4, 2007 IP
  9. DTHBAH2006

    DTHBAH2006 Active Member

    Messages:
    988
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    70
    #9
    It was my Anti-Virus keeping the cookie from being set. :D

    Thanks to all.

    dthbah2006
     
    DTHBAH2006, Mar 5, 2007 IP