Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Password Protect form needs password entered twice before working
    primarykey
    data
    text
    <p>I'm trying to make a password protected website. The password is currently just hardcoded to make it easier for me to test. </p> <p>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. </p> <p>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.</p> <pre><code> case 'Maintenance': $salt = "test"; $adminpass = "adminpass"; $RealPassword = crypt($adminpass, $salt); function LoginScreen($SaltCode){ ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Please enter password to access this page&lt;/title&gt; &lt;META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"&gt; &lt;META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"&gt; &lt;/head&gt; &lt;body&gt; &lt;style&gt; input { border: 1px solid black; } &lt;/style&gt; &lt;div style="width:500px; margin-left:auto; margin-right:auto; text-align:center"&gt; &lt;form method="post"&gt; &lt;h3&gt;Please enter password to access this page&lt;/h3&gt; &lt;font color="red"&gt;&lt;?php echo $error_msg; ?&gt;&lt;/font&gt;&lt;br /&gt; &lt;input type="password" name="access_password" /&gt;&lt;p&gt;&lt;/p&gt;&lt;input type="submit" name="Submit" value="Submit" /&gt; &lt;/form&gt; &lt;br /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;?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"])) { ?&gt; &lt;B&gt;&lt;fontsize=16&gt;Are you sure you want to Format the data disk?&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt; &lt;form method = "post"&gt; &lt;INPUT TYPE = 'Submit' name = 'FormatSubmit' value = 'Submit'&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt; Please check the box to verify you want to Format the data disk. &lt;Input type = "Checkbox" Name ="FormatCheck" value ="checked"&gt; &lt;/form&gt; &lt;?php if (($_POST['FormatSubmit'] == "Submit") &amp; ($_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; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload