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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:23:41+00:00 2026-05-26T18:23:41+00:00

i am using the following password code http://www.zubrag.com/scripts/password-protect.php it is working fine but when

  • 0

i am using the following password code http://www.zubrag.com/scripts/password-protect.php

it is working fine but when i try to echo out the logged in user’s info, i am only able to do it once, at the time of login. after that if i refresh the page, the page is still accessible but the logged in user’s name is not echoed out
can someone help me with this
i have the following code on the first line of the pages that i want to protect

<?php require("/home/abcd/abcd/password_protect.php"); ?>

i am echoing out the name by using

echo "Welcome $login";
  • 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-05-26T18:23:41+00:00Added an answer on May 26, 2026 at 6:23 pm

    What the script basically does is that it has a pre-initialised list of login and passwords stored in the array $LOGIN_INFORMATION .

    $LOGIN_INFORMATION = array(
      'zubrag' => 'root',
      'test' => 'testpass',
      'admin' => 'passwd'
    );
    

    Now it takes a login/password combination from the user and matches with the stored values.
    As per your question , you want to show the name of the authenticated user.

    For that you can use a session

    At the start of the page(Very first line) write

    `session_start();`
    

    then
    $_SESSION['username'] = $username //the authenticated username

    Now at the beginning of every page where you want to print the name ,write

    session_start();
    

    then

    echo $_SESSION['username'];
    

    After you are done and you want to log out ( or cancel the session) write

    session_unregister('username');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m using the following code post values using JSoup: Document document = Jsoup.connect(http://www......com/....php) .data(user,user,password,12345,email,info@tutorialswindow.com)
I am using a webbrowser control to login to a website. WbBrowser.Navigate(http://www.foo.com/login.php) Once the
I am trying to implement reset password functionality using the tutorial at http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic/ and
I am using the following code: CAtlNavigateData navData; CStringA m_strForm = name=+++&priv=1&password=; navData.SetPostData((BYTE*)(LPSTR)(LPCSTR)m_strForm, m_strForm.GetLength(),
I am using following PHP code to connect to MS Access database: $odb_conn =
I'm looking for the correct way of using wp_get_attachment_image(). The following code: <?php $args
I want to login to a website ( http://www.orkut.com ) through com.gargoylesoftware.htmlunit.WebClient But when
I am using HgEclipse from here: http://www.javaforge.com/project/HGE I have created a new repository on
I'm using the following regex to validate password complexity: /^.*(?=.{6,12})(?=.*[0-9]{2})(?=.*[A-Z]{2})(?=.*[a-z]{2}).*$/ In a nutshell: 2
I am getting the following error: Access denied for user 'apache'@'localhost' (using password: NO)

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.