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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:36:47+00:00 2026-06-10T04:36:47+00:00

I’m trying to make a password protected website. The password is currently just hardcoded

  • 0

I’m trying to make a password protected website. The password is currently just hardcoded to make it easier for me to test.

The problem that I’m running into is that when I type the actual password, the cookie doesn’t seem to get set. If I re-enter the password a second time, then the cookie gets set.

I know that the problem is the order that I am calling the code, but I’m having a hard time actually identifying what I should change in order to make it function correctly on the first correct password input. Any help would be appreciated.

     case 'Maintenance':

$salt = "test";
$adminpass = "adminpass";
$RealPassword = crypt($adminpass, $salt);

function LoginScreen($SaltCode){
?>

    <html>
<head>
  <title>Please enter password to access this page</title>
  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>
<body>
  <style>
    input { border: 1px solid black; }
  </style>
  <div style="width:500px; margin-left:auto; margin-right:auto; text-align:center">
  <form method="post">
    <h3>Please enter password to access this page</h3>
    <font color="red"><?php echo $error_msg; ?></font><br />
    <input type="password" name="access_password" /><p></p><input type="submit" name="Submit" value="Submit" />
  </form>
  <br />
  </div>
</body>
</html> 






<?php
global $PasswordEntered;
$PasswordEntered = crypt($_POST['access_password'],$SaltCode);

}









if (!isset($_COOKIE["Cookie"]))
{ 

LoginScreen($salt);

if ($PasswordEntered == $RealPassword)
    {
        setcookie("Cookie", $PasswordEntered, time()+600);
    } 

}



if (isset($_COOKIE["Cookie"]))
{

?>  

<B><fontsize=16>Are you sure you want to Format the data disk?</b></font><br><br>


<form method = "post">

<INPUT TYPE = 'Submit' name = 'FormatSubmit' value = 'Submit'>


<br><br><br>
Please check the box to verify you want to Format the data disk.

<Input type = "Checkbox" Name ="FormatCheck" value ="checked">


</form>

<?php
if (($_POST['FormatSubmit'] == "Submit") & ($_POST['FormatCheck'] == "checked"))
    {
    html_exec_cmd('echo -e "o\nn\np\n1\n\n\nw\n" | fdisk /dev/sda;sleep 1;mkfs.ext3 /dev/sda1;mount /dev/sda1 /data/');
     }

}

     break;
  • 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-10T04:36:49+00:00Added an answer on June 10, 2026 at 4:36 am

    I ended up completely dropping the setcookie parameter, because I couldn’t figure out a way to resolve it. I decided to go with the $_SESSION parameter to get it to work. An added bonus is that the session is controlled serverside, so the security will be higher.

    case 'Login':
    
          $salt = "test";
          $adminpass = "adminpass";
          $RealPassword = crypt($adminpass, $salt);
    
          if (isset($_SESSION['loggedin'])){
            echo "You are already logged in.";
          }
          else if ($_POST['access_password']){
            $PasswordEntered = crypt($_POST['access_password'],$salt);
            if ($PasswordEntered == $RealPassword){
                $_SESSION['loggedin']=1;
                LogData('Logged in',$logdir);
                echo "You are now logged in!";
            }
            else{
                echo LoginScreen();
                LogData('Failed login attempt',$logdir);
            }
          }
          else{ 
            echo LoginScreen();
          }
        break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.