So I want to password my PlayersOnline and Cash etc how would i go about doing this, sorry if its been posted before, but i couldn't seem to find any leads on how to perform these actions.
<!-- Zombe's password protection !-->
<form name = "form1" method = "POST">
Enter password:
<br>
<input type = "password" name = "pass">
<input type = "submit" value = "Accept">
</form>
<?php if($_POST[pass]) { if($_POST[pass] <> "yourpassword") die("<p>Incorrect password."); } else die(); ?>
<?php
/* Zombe's password protection */
ob_start();
session_start();
if(!$_SESSION[$_SERVER[PHP_SELF]])
{ ?>
<!-- Zombe's password protection !-->
<form name = "form1" method = "POST">
Enter password:
<br>
<input type = "password" name = "pass">
<input type = "submit" value = "Accept">
</form>
<?php
if($_POST[pass])
{
if($_POST[pass] <> "yourpassword") die("<p>Incorrect password.");
}
else die();
$_SESSION[$_SERVER[PHP_SELF]] = true;
}
ob_end_flush();
?>
Great jobQuote:
Alright, the previous thingie I made had a problem that it asks for a password every single time, so I improved it a bit, made kind of a login-system, so it asks for a password only once an hour, after it was entered successfully.
PHP Code:<?php
/* Zombe's password protection */
ob_start();
session_start();
if(!$_SESSION[$_SERVER[PHP_SELF]])
{ ?>
<!-- Zombe's password protection !-->
<form name = "form1" method = "POST">
Enter password:
<br>
<input type = "password" name = "pass">
<input type = "submit" value = "Accept">
</form>
<?php
if($_POST[pass])
{
if($_POST[pass] <> "yourpassword") die("<p>Incorrect password.");
}
else die();
$_SESSION[$_SERVER[PHP_SELF]] = true;
}
ob_end_flush();
?>