$php_mysql$ Posted August 19, 2011 Share Posted August 19, 2011 so when a post is submitted successfully i redirect users to the post page where i add this <?php $referer = $_SERVER['HTTP_REFERER']; if($_REQUEST['post'] == 'success' && $referer == 'post.php') { echo '<div id="posted">'; echo '<p align="center">Posted successfully below!<br/></p>'; echo '</div>'; } ?> so when i add just $referer == 'post.php') the message below do not show but when i put full path like wamp/www/script/post.php only then the message show any idea? Quote Link to comment https://forums.phpfreaks.com/topic/245177-http_referer-wont-work-with-just-pagephp/ Share on other sites More sharing options...
shamwowy Posted August 19, 2011 Share Posted August 19, 2011 Did you try: $referer = $_SERVER['HTTP_REFERER']; $checkpost = 'post.php'; if (strpos($referer,$checkpost)) { echo '<div id="posted">'; echo '<p align="center">Posted successfully below!<br/></p>'; echo '</div>'; } In theory, strpos() should look for any string you pass in, in this case just look for post.php in your referer string. Quote Link to comment https://forums.phpfreaks.com/topic/245177-http_referer-wont-work-with-just-pagephp/#findComment-1259318 Share on other sites More sharing options...
MasterACE14 Posted August 19, 2011 Share Posted August 19, 2011 should keep in mind $_SERVER['HTTP_REFERER'] isn't reliable. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. Quote Link to comment https://forums.phpfreaks.com/topic/245177-http_referer-wont-work-with-just-pagephp/#findComment-1259321 Share on other sites More sharing options...
$php_mysql$ Posted August 19, 2011 Author Share Posted August 19, 2011 thanks gonna give it a try and get back :-) Quote Link to comment https://forums.phpfreaks.com/topic/245177-http_referer-wont-work-with-just-pagephp/#findComment-1259327 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.