conker87 Posted May 30, 2007 Share Posted May 30, 2007 I have a little count script that increases every time a user clicks ("reads") an article on my site. Though the counter also increases when there is a refresh and they comment (as the comment form pints to the same page). I've been playing about with referrers, this is what I have at the point of where the increase code is: if (!($_SERVER['HTTP_REFERER'] == "http://www.leagueofvillains.co.uk/?area=$area&id=$id") || !($_SERVER['HTTP_REFERER'] == NULL)) { $count++; } I think that should only increase by one if the Referrer of the page is not itself (a form processed) and if it is not NULL (a refresh) however it doesn't work and continues to increase even during these actions. Anyone see what I'm doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/53489-http-refer/ Share on other sites More sharing options...
btherl Posted May 30, 2007 Share Posted May 30, 2007 I think you want && (and) instead of || (or) "If referer is not myself and referer is not null, then increase count" instead of "If referer is not myself OR referer is not null, the increase count" The second one is always true.. I would write it like this: if ($_SERVER['HTTP_REFERER'] !== "http://www.leagueofvillains.co.uk/?area=$area&id=$id" && !empty($_SERVER['HTTP_REFERER'])) Quote Link to comment https://forums.phpfreaks.com/topic/53489-http-refer/#findComment-264482 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.