Mad_Coder Posted October 10, 2010 Share Posted October 10, 2010 I have a site where the user must view a timed loader before playing an audio bible. I'm noticing some direct linking to the bible player instead of sitting through the loader... I need to check the previous page's url before actually loading the player. I through together a script last ween in javascript and people reported error, so I assumed it would be best server side anyway. I haven't coded anything in PHP since PHP3. So, I'm asking for your expert options and help... I haven't tested this yet, but is this the best method and are they any problems with this method (if it works). $realname = basename($_SERVER[loader], ".php"); if ($realname == 'loader.php') { return(); } else { // rediret to a notice to user that this isn't allow header( 'Location: http://www.yoursite.com/new_page.html' ) ; } Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 10, 2010 Share Posted October 10, 2010 small syntax error should be return true instead of return. which would return false. <?php$realname = basename($_SERVER[loader], ".php");if ($realname == 'loader.php'){ return true;}else{// rediret to a notice to user that this isn't allowheader( 'Location: http://www.yoursite.com/new_page.html' ) ;}?> Quote Link to comment Share on other sites More sharing options...
Pawn Posted October 11, 2010 Share Posted October 11, 2010 I need to check the previous page's url before actually loading the player. if($_SERVER['HTTP_REFERER'] == "loading.php") { // continue } else { header("Location: loading.php"); exit; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.