Jump to content

Password Entry


knystrom18
 Share

Recommended Posts

Any idea why this: http://www.rohoa.org/pass isn't submitting the password for entry in IE?Password = CommunityScript: http://www.zubrag.com/scripts/password-protect.phpCalled using a php include before <html>.Page Code:

<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"><link rel="stylesheet" type="text/css" href="css/password.css" /></head><body><div align="center">	 <div id="contain">		  <div id="head">			   <img src="Images/banner.jpg" />		  </div><!--head--> 		  <div id="passContain"			   <form method="post">					 <h4>Please enter the password to access the site.</h4>					 <font color="red"></font>					 <br />										  <input type="password" name="access_password" />					 <input type="submit" name="Submit" value="Submit" />			   </form>		  </div><!--passContain-->  <br />  <a href="http://www.zubrag.com/scripts/password-protect.php">Zubrag.com</a>  </div>  <div id="footer">			<p>				Site By: <a href="http://www.kylenystrom.com/" target="_blank" id="footLink">Kyle Nystrom</a>			</p>		</div></div> </body></html>

Thanks! :)

Edited by Coaxsist
Link to comment
Share on other sites

You probably should include an action attribute on the form tag, even if you leave it blank.

Link to comment
Share on other sites

doesn't seem to work in FF either, unless you changed the password. perhaps its worth posting all your PHP code on that page as well.

Link to comment
Share on other sites

doesn't seem to work in FF either, unless you changed the password. perhaps its worth posting all your PHP code on that page as well.
<?php################################################################ Page Password Protect 2.13################################################################ Visit http://www.zubrag.com/scripts/ for updates############################################################### ## Usage:# Set usernames / passwords below between SETTINGS START and SETTINGS END.# Open it in browser with "help" parameter to get the code# to add to all files being protected. #	Example: password_protect.php?help# Include protection string which it gave you into every file that needs to be protected## Add following HTML code to your page where you want to have logout link# <a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a>################################################################/*-------------------------------------------------------------------SAMPLE if you only want to request login and password on login form.Each row represents different user.$LOGIN_INFORMATION = array(  'zubrag' => 'root',  'test' => 'testpass',  'admin' => 'passwd');--------------------------------------------------------------------SAMPLE if you only want to request only password on login form.Note: only passwords are listed$LOGIN_INFORMATION = array(  'root',  'testpass',  'passwd');--------------------------------------------------------------------*/###################################################################  SETTINGS START##################################################################// Add login/password pairs below, like described above// NOTE: all rows except last must have comma "," at the end of line$LOGIN_INFORMATION = array(  'Community',);// request login? true - show login and password boxes, false - password box onlydefine('USE_USERNAME', false);// User will be redirected to this page after logoutdefine('LOGOUT_URL', 'http://www.rohoa.org/');// time out after NN minutes of inactivity. Set to 0 to not timeoutdefine('TIMEOUT_MINUTES', 5);// This parameter is only useful when TIMEOUT_MINUTES is not zero// true - timeout time from last activity, false - timeout time from logindefine('TIMEOUT_CHECK_ACTIVITY', true);###################################################################  SETTINGS END##################################################################///////////////////////////////////////////////////////// do not change code below///////////////////////////////////////////////////////// show usage exampleif(isset($_GET['help'])) {  die('Include following code into every page you would like to protect, at the very beginning (first line):<br><?php include("' . str_replace('\\','\\\\',__FILE__) . '"); ?>');}// timeout in seconds$timeout = (TIMEOUT_MINUTES == 0 ? 0 : time() + TIMEOUT_MINUTES * 60);// logout?if(isset($_GET['logout'])) {  setcookie("verify", '', $timeout, '/'); // clear password;  header('Location: ' . LOGOUT_URL);  exit();}if(!function_exists('showLoginPasswordProtect')) {// show login formfunction showLoginPasswordProtect($error_msg) {?><html><head><title>Password Authentication</title><META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"><META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"><link rel="stylesheet" type="text/css" href="css/password.css" /></head><body><div align="center">	 <div id="contain">		  <div id="head">			   <img src="Images/banner.jpg" />		  </div><!--head-->		  <div id="passContain"			   <form method="post" action="">					 <h4>Please enter the password to access the site.</h4>					 <font color="red"><?php echo $error_msg; ?></font>					 <br />					 <?php if (USE_USERNAME) echo 'Login:<br /><input type="input" name="access_login" /><br />Password:<br />'; ?>					 <input type="password" name="access_password" />					 <input type="submit" name="Submit" value="Submit" />			   </form>		  </div><!--passContain-->  <br />  <a href="http://www.zubrag.com/scripts/password-protect.php">Zubrag.com</a>  </div>  <?php include ('php/includes/footer.inc.php'); ?></div></body></html><?php  // stop at this point  die();}}// user provided passwordif (isset($_POST['access_password'])) {  $login = isset($_POST['access_login']) ? $_POST['access_login'] : '';  $pass = $_POST['access_password'];  if (!USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION)  || (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) )   ) {	showLoginPasswordProtect("Incorrect password.");  }  else {	// set cookie if password was validated	setcookie("verify", md5($login.'%'.$pass), $timeout, '/');		// Some programs (like Form1 Bilder) check $_POST array to see if parameters passed	// So need to clear password protector variables	unset($_POST['access_login']);	unset($_POST['access_password']);	unset($_POST['Submit']);  }}else {  // check if password cookie is set  if (!isset($_COOKIE['verify'])) {	showLoginPasswordProtect("");  }  // check if cookie is good  $found = false;  foreach($LOGIN_INFORMATION as $key=>$val) {	$lp = (USE_USERNAME ? $key : '') .'%'.$val;	if ($_COOKIE['verify'] == md5($lp)) {	  $found = true;	  // prolong timeout	  if (TIMEOUT_CHECK_ACTIVITY) {		setcookie("verify", md5($lp), $timeout, '/');	  }	  break;	}  }  if (!$found) {	showLoginPasswordProtect("");  }}?>

I've found the general way this works is that the php file is called in the document you want protected with an include.When that document is accessed, the page within the php file is shown. If the password entered is correct, the actual sites page is then shown.Got the script from here: http://www.zubrag.com/scripts/password-protect.phpLemme know if you guys need anything else.Thanks! :)BTW, password is now "Community" (w/out quotes)

Edited by Coaxsist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...