1
cricrou
HTTP_REFERER error and function checkReferer
  • 2005/9/20 7:58

  • cricrou

  • Just popping in

  • Posts: 2

  • Since: 2005/9/19


Hi,

After installing XOOPS 2.2.3, I got following error:

XOOPS Site site security has detected that your computer has a firewall setting that is preventing you from registering on the site. We use 'Referrer-checking' know as HTTP_REFERER which makes sure that all contents posted are from authorised users only. Your firewall settings are blocking this information, so this will prevent you from registering properly if you try and proceed. [...]

In my test environment, I do not use default HTTP and HTTPS ports (80, 443) but something like 19080 and 19443. So the URL looks likehttp://localhost:19080/.
Due to this port number, the function checkReferer always returns false and XOOPS is not usable.

The problem comes from the test:
if ($pref['host'] != $_SERVER['HTTP_HOST']) { ...
In my environment, this condition will always be true as $pref['host'] value is 'localhost' and $_SERVER['HTTP_HOST'] value is 'localhost:19080'.

I've corrected it by updating these lines:
$pref parse_url($ref);
        if ( 
$pref['host'] != $_SERVER['HTTP_HOST'] ) {
            return 
false;
        }

by:
$pref parse_url($ref);
        
$local_url $pref['host'];
        if ( 
$pref['port'] <> '' $local_url .= ':'.$pref['port'];
        if ( 
$local_url != $_SERVER['HTTP_HOST'] ) {
            return 
false;
        }


I do not know if it is the best way to correct it but now it works.


2
Kissaki
Re: HTTP_REFERER error and function checkReferer
  • 2005/9/30 22:29

  • Kissaki

  • Just popping in

  • Posts: 29

  • Since: 2005/7/16


sry, but where?
in wich file? ;)
thx

3
Kissaki
Re: HTTP_REFERER error and function checkReferer
  • 2005/9/30 23:11

  • Kissaki

  • Just popping in

  • Posts: 29

  • Since: 2005/7/16


hmm, no edit function? ok then ;)
i fixed it this way (xoops 2.2.2):
in class/xoopssecurity.php

Quote:
function checkReferer($docheck=1)
{
if ($docheck == 0) {
return true;
}
$ref = $_SERVER['HTTP_REFERER'];
if ($ref == '') {
return false;
}
$pref = parse_url($ref);
if ( $pref['host'] != "myip" ) {
return false;
}
return true;
}



where i typed 'myip' i have my ip ;)
so, what does it do? it gets the referer url and checks if the host of this url is 'myip'
that's all
hope it'll help so.
greetz

4
cricrou
Re: HTTP_REFERER error and function checkReferer
  • 2005/10/1 8:01

  • cricrou

  • Just popping in

  • Posts: 2

  • Since: 2005/9/19


Forgot to tell in which file it is ...
function checkReferer in class/xoopssecurity.php


5
massacre
Re: HTTP_REFERER error and function checkReferer
  • 2005/10/6 15:44

  • massacre

  • Just popping in

  • Posts: 48

  • Since: 2005/8/10


Hehe... yeah.

I *just* found it herehttps://xoops.org/modules/smartfaq/faq.php?faqid=310&com_id=17236&com_rootid=12693&com_mode=thread&#comment17236

Looks like they moved it, but it looks the same. Now I'm wondering what the other function was for.

I've changed it to return true, so hopefully my testing will go smoothly now.

6
massacre
Re: HTTP_REFERER error and function checkReferer
  • 2005/10/6 15:48

  • massacre

  • Just popping in

  • Posts: 48

  • Since: 2005/8/10


Well, my problem still exists even without the referrer check which is supposed to resolve 9 out of 10 issues.

I guess I'm in the 10%. Any other ideas?

It's definitely related to proxy or firewall, as when I VPN into work, the firewall settings are forced as is the proxy. It's only when I go through work and it's something they changed very recently, as it has been working fine for 2 months.

7
Mithrandir
Re: HTTP_REFERER error and function checkReferer

The server-running-on-non-port-80-port problem should be fixed in XOOPS 2.2.3 RC2, which is just around the corner.
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

Login

Who's Online

220 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 220


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits