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

  • Home
  • SEARCH
  • 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 8154851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:29:29+00:00 2026-06-06T16:29:29+00:00

I was trying to make a one page script with the action set to

  • 0

I was trying to make a one page script with the action set to server php self but when running the script even after I type in the right password I am given “You Must Supply a Password”. Am I doing this right. Please let me know my mistake

login.php

    <?php
        $pass = 'defense6';

        if(isset($_POST['submit'])){

            if(($_POST['password'] == $pass)) {    
                   $_SESSION['password'] = md5($_POST['password']);
                   header('Location: index.php');
            } else {
                echo 'Password Invalid';
            }

        }
        else {
            echo 'You must supply a password.'.$_SESSION['password'] ;
        }
        ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">  
Password: &nbsp;<input name="password" type="password" /><br/><br/>
:
<input type="submit" name="submit" value="Login" style="float:right;" />

<br/>
  <p></p>
</form>

index.php

<?php
$pass = 'defense6';
 if($_SESSION['password'] == md5($pass)) {}
else {header('Location: login.php');}
?>
  • 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-06T16:29:32+00:00Added an answer on June 6, 2026 at 4:29 pm

    You need to add seesion_start() on every page you use session.

    session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

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

Sidebar

Related Questions

I'm trying to make a login and logout script for a page but for
Trying to make simple minesweeper game in python, but have one problem. I have
i have been trying very hard to make tinyMCE work on my page. even
I'm currently trying to make a page via php which allows the user to
Hi I'm trying to migrate my HTML/PHP/JS/XML page into one php file. I was
im trying to make this box stay one one width at 150px but how
I'm trying to make one word (variable) of a message box bold in my
I'm trying to make one of the MenuItems on my Menu have a checkmark
In order to condense my code I am trying to make one of my
Possible Duplicate: C# full screen console? I am trying to make one of my

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.