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 8871165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:54:58+00:00 2026-06-14T17:54:58+00:00

I use sessions with php, I use session_start and store some variables that are

  • 0

I use sessions with php, I use session_start and store some variables that are passed from a login form, the variables are ‘user_name’ and ‘user_role’ at the beginning of code I check if those variables are set, and if not, redirect to loggin scree. Now the problem is that I have a include file that has the menu options in it, if the user is a privileged user, it shows more options than if it’s not. my problem is that when the include file is processed i get PHP Notice: Undefined index: user_name in C:\inetpub\wwwroot\2StarsGames.com\SomeGame v4.1\interface\HeaderMenu.php on line 20 ‘user_name’ Since i don’t get errors in the rest of the files, i just included the menu file in this post. Can someone tell me if there’s a special treatment of sessions if are inside a separate file?

<div id="page_header"> 
<img class="logoImage" src="./img/some1.png" align="left" />
SUPER B 
<img class="logoImage" src="./img/some2.png" align="right" />
</div>

<div id="page_menu">
<center>
    <a class="menu" href="./Contest.php">Contest</a>
    <a class="menu" href="./Cards.php">Cards</a>
    <a class="menu" href="./PlayersPoints.php">Players Points</a>   
    <a class="menu" href="./SBCardsCode.php">Card's Code</a> 
    <a class="menu" href="./Avatars.php">Avatars</a>   
    <a class="menu" href="./Sims.php">Sims</a>   
    <a class="menu" href="./Boards.php">Boards</a> <br/>   
    <a class="menu" href="./Charity.php">Charity</a>
    <?php 
        $username = strtolower($_SESSION['user_name']);
        if($username == 'some name1' ||
           $username == 'some name2' ||
           $username == 'some name3' ||
           $username == 'some name4')
        {
            echo "          
                <a class='menu' href='./PayoutsNoWin.php'>Payouts</a>  
                <a class='menu' href='./Payins.php'>Payins|</a>            
                <a class='menu' href='./Payments.php'>Payments</a>
                <a class='menu' href='./Tools.php'>Tools</a>  
                <a class='menu' href='./TransferData.php'>Transfer Data</a>
                <a class='menu' href='./Games.php'>Games</a>
                ";
        }
    ?>
</center>

edit
the session_start() is in the file that includes this one.

  • 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-14T17:55:00+00:00Added an answer on June 14, 2026 at 5:55 pm

    You need to suppress the error reporting:

    $username = strtolower(@$_SESSION[‘user_name’]);

    or better, check for isset($_SESSION[‘user_name’]) before using the variable.

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

Sidebar

Related Questions

I have the following login script, where i do use sessions. <?php session_start(); if(isset($_SESSION['logged_in'])){
When I use PHP header redirection, all session variables are lost... Some people say
When is it best to use database as a session store in PHP? I
I have sessions that for the website and this is how i use them:
I use VS2010, C# to develop ASP.NET web app, I create some sessions in
I am using a PHP login script that challenges user for username & password.
I have a php page that starts with a session_start() and it stores the
I am needing to use sessions for my php page, so, on my index.php
I have a form that is submitted to a php script with jquery and
I just noticed something strange. I thought that, as PHP's manual says, session_start() must

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.