/    Sign up×
Community /Pin to ProfileBookmark

Is there a way to check and see what page someone came from, and if they didn’t come from a certain page (for me it’s: [url]http://localhost/index.php?page=register)[/url].

If they didn’t come from that page, and they go straight to [url]http://localhost/register.php[/url] then redirect them back to [url]http://localhost/index.php?page=register[/url]

This way people can’t make their own form, and insert something from that form into my database.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 20.2006 — $_SERVER['HTTP_REFERER']

However, it's not 100% guaranteed to be correct/accurate, as it depends on what the client sends in the headers.

A better method would probably be to use a session variable to track where they've been.
×

Success!

Help @The_Little_Guy 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 6.18,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...