Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:18:56+00:00 2026-06-14T14:18:56+00:00

have this question in mind. I know there are a lot questions like this

  • 0

have this question in mind. I know there are a lot questions like this on the internet, but none of them seem to do the trick for me 🙁

So I’m planning on making an adminpanel on a website. You enter by going through a login screen, when the name+pass is correct an session is made. On the other adminpages I’ll test if this session is set, by this I’ll know if the user can access the page or not.

Inlog.php (simplyfied)

<?php session_start(); ?> <html ...

then after lots of controls

    if ($adminpwd == $pass) {
    session_regenerate_id();
    $_SESSION["mysessionname"] = $name;
    $tijd = date('H:i:s', strtotime('+ 30 minutes'));
    $_SESSION["E4A_einde"] = $tijd;
    session_write_close();
echo "<script type='text/javascript'>window.location = 'myotheradminpage'</script>";
}

My other php pages include this script

<?php session_start();
if (!isset($_SESSION["mysessionname"])) {

session_destroy();
echo '<SCRIPT LANGUAGE="JavaScript"> window.alert("no session found") </SCRIPT>';
echo "<script type='text/javascript'>window.location = 'myloginpage'</script>";
        }

With this element, if the session is not set there’s a redirect, if the session is set the other code on the php page wil be triggered.

But the fact is that Every single time i’m redirected again to my loginpage. so my session is not set :s Can’t figure out why so please help me out.

I tried a lot of thins with on every page to add the session_start() methode, I tried to regenerated the session id before I set the sessions, but nothing works..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:18:57+00:00Added an answer on June 14, 2026 at 2:18 pm

    In your initial session_start before the HTML, try setting this:

    <?php session_start();  
    $_SESSION["mysessionname"]; ?>
    <html ...
    

    This will declare your session variable before anything runs.

    Let me know if this works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know questions like this have been asked before, and I've viewed a lot
I know there are a lot of other SO entries that seem like this
I've seen several questions about password protecting pages, but none of them seem to
I know there is more than one question out there that matches this, but
I know this question is asked hundred times. but there is no answer to
I'm almost certain I know the answer to this question, but I'm hoping there's
i know this question might look like a duplicate. but i had a hard
I am new to db4o . I have this question in mind: when the
I have this little question that's been on my mind for a while now.
I have this question, just in theory. I do some query results and there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.