Published in: PHP
<?php ################################################################## # SETTINGS START ################################################################## // Add login/password pairs below, like described above // NOTE: all rows except last must have comma "," at the end of line 'admin' => 'admin' ); // request login? true - show login and password boxes, false - password box only // User will be redirected to this page after logout // time out after NN minutes of inactivity. Set to 0 to not timeout // This parameter is only useful when TIMEOUT_MINUTES is not zero // true - timeout time from last activity, false - timeout time from login ################################################################## # SETTINGS END ################################################################## /////////////////////////////////////////////////////// // do not change code below /////////////////////////////////////////////////////// // timeout in seconds // logout? } // show login form function showLoginPasswordProtect($error_msg) { ?> <html> <head> <title>Admin Control Panel</title> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body style="text-align:center"> <style> input { border: 1px solid black; } </style> <form method="post"> <h1>Please enter password to access this page</h1> <?php if (USE_USERNAME) echo 'Login:<br /><input type="input" name="access_login" /><br />Password:<br />'; ?> <input type="password" name="access_password" /><p></p><input type="submit" name="Submit" value="Submit" /> </form> </body> </html> <?php // stop at this point } } // user provided password $pass = $_POST['access_password']; || (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) ) ) { showLoginPasswordProtect("Incorrect password."); } else { // set cookie if password was validated // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed // So need to clear password protector variables } } else { // check if password cookie is set showLoginPasswordProtect(""); } // check if cookie is good $found = false; foreach($LOGIN_INFORMATION as $key=>$val) { $lp = (USE_USERNAME ? $key : '') .'%'.$val; $found = true; // prolong timeout if (TIMEOUT_CHECK_ACTIVITY) { } break; } } if (!$found) { showLoginPasswordProtect(""); } } ?>
You need to login to post a comment.
