Apacche(Xampp)

03/25/2010 17:42 xfactorbowler#1
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.
03/25/2010 18:56 pieter#2
google .htaccess or .htpasswd
03/25/2010 19:29 Zombe#3
...Or just add this to the beginning of the php script:
PHP Code:
<!-- 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(); ?>
Don't forget to edit your password...
03/25/2010 19:29 xfactorbowler#4
I like zombies way better woot
03/25/2010 19:43 Zombe#5
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();
?>
03/25/2010 20:14 gedimazs#6
Quote:
Originally Posted by Zombe View Post
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();
?>
Great job
03/25/2010 20:17 xfactorbowler#7
awesome my friend just frikn awesome
03/26/2010 13:16 iAslana#8
Zombe is noobi :D He should work on our website ;)
+7 Reported At: Fri 26 Mar 2010 - 13:15:55 GMT +1 Cause: Request Close
03/26/2010 13:22 trane.#9
#Case Closed