I'm very new to PHP and coding in general and am having trouble getting authentication to work with two different sites. This leads me to believe something is wrong with php.ini?
My first site is from godaddy.com
I have linux hosting.
php.ini is automatically included at the / directory
here it is:
register_globals = off
allow_url_fopen = off
expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
[Zend]
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so
The second site is my person one
php.ini is pretty long but
sessions are enabled. I can post it here if needed.
Both sites use a simple script that I found here:
http://www.yourcodes.com/free-php-login-script.php#phploginscript
The actual code is here:
<?
//Change 123pass below to your password of choice
$key = '123pass';
if (!isset($pass)){
echo "You must enter a password to view this page.";
?>
<form name="form1" method="post" action="<? $_SERVER[PHP_SELF]; ?>">
Password:
<input type="text" name="pass">
<input type="submit" name="Submit" value="Login">
</form>
<?
die;
}
if ($pass == ''){
echo "You must enter a password to view this page.";
?>
<form name="form1" method="post" action="<? $_SERVER[PHP_SELF]; ?>">
Password:
<input type="text" name="pass">
<input type="submit" name="Submit" value="Login">
</form>
<?
die;
}
//replace 123pass below with the password of your choice
if ($pass !== $key){
echo "Password incorect try again.";
?>
<form name="form1" method="post" action="<? $_SERVER[PHP_SELF]; ?>">
Password:
<input type="text" name="pass">
<input type="submit" name="Submit" value="Login">
</form>
<?
die;
}
?>
Put your protected information here!
The problem is that when I enter the password nothing happens
and it just resets it self. Anything to do with _SERVER[PHP_SELF]?
Please help. These sites are for good causes.
Thanks