Re: $PHP_SELF not working -please help
| From: | Steve Edberg | Date: | Wed, 19 Dec 2001 20:07:12 +0000 |
| Subject: | Re: $PHP_SELF not working -please help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78243@lists.php.net to get a copy of this message | ||
Is the code below in a function? If so, you'll have to globalize $PHP_SELF:
function your_function() {
global $PHP_SELF;
...
echo $PHP_SELF;
..
}
alternatively, you could do
function your_function() {
...
echo $GLOBALS['PHP_SELF'];
..
}
To the best of my knowledge, PHP_SELF is set regardless of the register_globals configuration setting, but I'm not 100% sure.
-steve
At 11:13 AM +0000 12/19/01, Caleb Carvalho wrote:
Hi there,
I have created a script that is suppose to get some input from
user and display back, and i have the following method
<FORM METHOD="POST" ACTION="<? echo $PHP_SELF ?> ">
so i have a script that if login fails it will ask the user
to register,
if(!$username) {
session_unregister("userid");
session_uregister("userpassword");
echo "Authorisation Failed." .
"you must enter a valid credentials.".
"try again.<BR>\n";
echo "<A HREF=\"$PHP_SELF\">Login</A><BR>";
echo "If you're not a member please regsiter.<BR>\n";
echo "<A HREF=\"$register_script\">Membership</A>";
exit;
}
else echo "welcome, $username!";
........
Now for some strange reasons it tries to access my web direcorty that does not contain any file, and i get the 404 page not found error.
any help would do,
Thanks
Caleb
--
+------------------------------------------------------------------------+
| Steve Edberg sbedberg@ucdavis.edu |
| University of California, Davis (530)754-9127 |
| Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| "Restriction of free thought and free speech is the most dangerous of |
| all subversions. It is the one un-American act that could most easily |
| defeat us." |
| - Supreme Court Justice (1939-1975) William O. Douglas |
+------------------------------------------------------------------------+