Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Hi all,

I am getting the occasional member who cannot post for due to a bad referrer. Sometimes it allows them and other times it doesn't, but the intermitent ones I think may have been cookie related because I see them posting and do not hear them complaining about not being able to.

However, I have one member who has posted a few times, but from his work machine cannot at all... he keeps getting killed in the check_refer function:

Code
<br />  // ####################################################################### <br />  // Check_refer <br />  // ####################################################################### <br />    function check_refer($Cat="") {<br /><br />      global $config,$ubbt_lang;<br />      $valid = 0;       <br />      $referers = split("\|",$config['referer']);<br />      for ($i=0; $i <= (sizeof($referers)-1); $i++) {<br />         if (stristr(find_environmental('HTTP_REFERER'),$referers[$i])) {<br />           $valid++;<br />         }<br />      }<br />      if (!$valid) {<br />         $this -> not_right($ubbt_lang['NOT_VALID'],$Cat);<br />      }<br />    }<br />


I wrote a little test to see what his referrer was, and viola... blank. After some research on this in the PHP manual site, I find that checking the HTTP_REFERRER is not always viable since some servers will not reveal that info.

So, I added a quick patch for this use to check for his static IP address like this:

Code
<br />  // ####################################################################### <br />  // Check_refer <br />  // ####################################################################### <br />    function check_refer($Cat="") {<br /><br />      global $config,$ubbt_lang;<br />      $valid = 0;       <br />      $referers = split("\|",$config['referer']);<br />      for ($i=0; $i <= (sizeof($referers)-1); $i++) {<br />         if (stristr(find_environmental('HTTP_REFERER'),$referers[$i])) {<br />           $valid++;<br />         }<br />      }<br />		if (find_environmental('REMOTE_ADDRESS') == "xxx.xxx.xxx.xxx") {<br />			$valid++;<br />		}<br />      if (!$valid) {<br />         $this -> not_right($ubbt_lang['NOT_VALID'],$Cat);<br />      }<br />    }<br />


He still cannot post and get the
ubbt_lang['NOT_VALID'] = "The host you are trying to send the input from is not a valid host.";

message...

Why??? Is there anything I can do to get this guy posting consistently???

Thanks!!


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Most work computers are behind a firewall. Firewall software and/or hardware blocks the referer.

Norton/Windows XP "out of the box" used to block the referer. Instructions to adjust that are here:
Browser Problems

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Network Address Translation -firewalls mask the addresses behind them by replacing the source address with the address of the firewall. If you put the IP address of the firewall that he's behind into your script then it might work

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Thanks, Josh!


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Thanks, DLT... would this be a different IP than the one I am getting from the REMOTE_ADDRESS env. var?


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Sponsored Links
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
If you are "seeing" the address at your web server, then it's the IP address of the firewall. Keep in mind that some ISPs / companies use multiple firewalls for load balancing, and since HTTP is a "connection less" protocol you could see all the firewall IPs during a single page request. You might have better luck expanding your check to the first three octets of the IP address.

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Everytime this user logs in though he has the same IP... is that just coincidence or expected?


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Nettomo
Nettomo
Germany, Bremen
Posts: 417
Joined: November 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)