Prevent direct access to a PHP page.
Posted
by SyaZ
on Stack Overflow
See other posts from Stack Overflow
or by SyaZ
Published on 2008-10-09T00:29:47Z
Indexed on
2010/03/26
8:53 UTC
Read the original article
Hit count: 506
How do I prevent my users from accessing directly pages meant for ajax calls only?
Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source...
p/s: Using Apache as webserver.
EDIT: To answer why, I have jQuery ui-tabs in my index.php, and inside those tabs are forms with scripts, which won't work if they're accessed directly. Why a user would want to do that, I don't know, I just figure I'd be more user friendly by preventing direct access to forms without validation scripts.
© Stack Overflow or respective owner