/    Sign up×
Community /Pin to ProfileBookmark

PHP_SELF Error!

Hi can anybody tell me why PHP_SELF won’t work in my programs? any idea would be a big help ?

to post a comment
PHP

11 Comments(s)

Copy linkTweet thisAlerts:
@solavarSep 21.2004 — Your webserver probably has register_globals = 'on', which, for security reasons, is the recommended setting.

When 'on', $PHP_SELF is not automatically generated. You have to use

### see below###






*** CORRECTION *** CORRECTION ***

Your webserver probably has register_globals = 'off', which, for security reasons, is the recommended setting.

When 'off', $PHP_SELF is not automatically generated. You have to use


$_SERVER['PHP_SELF'];

For more info, have a look at...

http://uk.php.net/manual/en/reserved.variables.php#reserved.variables.server
Copy linkTweet thisAlerts:
@shimonSep 21.2004 — uh...surely you mean 'Off'?
Copy linkTweet thisAlerts:
@solavarSep 21.2004 — [i]Originally posted by shimon [/i]

[B]uh...surely you mean 'Off'? [/B][/QUOTE]



My bad!

Thanks, Shimon

Sorry.

Yes, the recommended setting is register_globals='off'



?
Copy linkTweet thisAlerts:
@shimonSep 21.2004 — thought so ?
Copy linkTweet thisAlerts:
@diamondsSep 21.2004 — just use [COLOR=darkred]$_SERVER['PHP_SELF'][/COLOR]
Copy linkTweet thisAlerts:
@zyberjockauthorSep 23.2004 — Thanks for your advices I checked my register_globals and as you said it was turned 'off' so i turned it 'on' and it did great. thanks again. ?
Copy linkTweet thisAlerts:
@shimonSep 23.2004 — That's all very well, but the default is 'off' for a number of reasons - as solavar says, the recommended setting is 'off'.

Have a read:

http://www.php.net/register_globals

http://marc.theaimsgroup.com/?l=php-general&m=105480233205838&w=2

or indeed

http://www.google.com/search?q=PHP+register_globals+evil

And just to make sure, I'll even ask nicely:

[i]Please do not develop with register_globals turned on![/i]

?
Copy linkTweet thisAlerts:
@zyberjockauthorSep 23.2004 — I have read all the articles that you have posted shimon, and I was really convinced that turning register_globals 'off' is 'evil', lol. but how can I make my PHP_SELF variable work when register_globals is 'off' is there any way to do that. or ill just have to type in the whole name of the script? thanks again.
Copy linkTweet thisAlerts:
@Paul_JrSep 24.2004 — [i]Originally posted by zyberjock [/i]

[B]but how can I make my PHP_SELF variable work when register_globals is 'off' is there any way to do that. or ill just have to type in the whole name of the script? thanks again. [/B][/QUOTE]

[font=palatino linotype]It was mentioned in one of the previous posts: use [url=http://us4.php.net/manual/en/reserved.variables.php#reserved.variables.server]$_SERVER['PHP_SELF'];[/url] (note, the [i]PHP_SELF[/i] element is the first one listed on that page).[/font]
Copy linkTweet thisAlerts:
@zyberjockauthorSep 24.2004 — [i]Originally posted by Paul Jr [/i]

[B][font=palatino linotype]It was mentioned in one of the previous posts: use [url=http://us4.php.net/manual/en/reserved.variables.php#reserved.variables.server]$_SERVER['PHP_SELF'];[/url] (note, the [i]PHP_SELF[/i] element is the first one listed on that page).[/font] [/B][/QUOTE]


Thanks paul, I haven't noticed it but i will try it. Thanks... ?
Copy linkTweet thisAlerts:
@Paul_JrSep 24.2004 — [i]Originally posted by zyberjock [/i]

[B]Thanks paul, I haven't noticed it but i will try it. Thanks... ? [/B][/QUOTE]

[font=palatino linotype]No problemo! ?[/font]
×

Success!

Help @zyberjock spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...