1 (edited by chrizz 2005-03-16 15:10)

Topic: Reference bug.

Hi.

I'm (admin) trying to edit a users profile by just clicking save.

When locating the user with the search engine and browsing to the users profile from a link from within "http://domain.com/forums/" it works fine since the base url option is set to "http://domain.com/forums".

But if I have a link to the users profile from another url like http://domain.com/ -> http://domain.com/forums/profile.php?id=1234 and then hit save, I get HTTP_REFERER error.

Should this really happen since im in the correct path when pressing the save button?

Re: Reference bug.

Btw, the same error occurs if you copy the URL to the profile, close the browser, and open a new one and then pasting the URL and trying to save. Again you get HTTP_REFERER error.

Re: Reference bug.

Odd. This does not happen to me. Could you perhaps debug the error a bit? I mean, check what HTTP_REFERER actually is set to in confirm_referrer()

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Reference bug.

Doesn't happen for me either. I've tested in 3 different browers, with 2 different PunBB installations and I get no errors on either one of them.

5 (edited by chrizz 2005-03-16 22:53)

Re: Reference bug.

I found the problem.

I made the mistake and the link was: http://domain.com/forum/profile?id=1234 (witch actually works without .php), then I got the error. But, should this happen anyway?

Well, now we know what the issue was, and as usual it was the users fault (mine) not the forums wink

6 (edited by gezz 2005-03-17 00:22)

Re: Reference bug.

Iv had this problem with earlier versions of punbb but I havent tested it on any of the new 1.2.x verions of punbb. I dont think this thread was explained properly so let me reiterate.

For my website the base URL is set to http://www.greasyspoon.org/forum

Yet, if I got to http://greasyspoon.org/forum I cant post or modify any admin settings (probably anything that has to do with database changes) although viewing is normal.

The difference is simply the "www." infront of the URL.

I was thinking that this might be due to browser cacheing (sp?) of the forums pages.

EDIT: Okay, I just tested it and im not even loged in, so I have no clue what the fuck is going on. But Im assuming that the cookie is under http://www.greasyspoon.org/forum and not http://greasyspoon.org/forum

-gezz

Re: Reference bug.

set the cookie domain to ".mydomain.com" to allow cookies to be used on all subdomains

Re: Reference bug.

I believe the problem with including www or not in the URL was fixed in an earlier version.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

9 (edited by Dexus 2005-06-04 12:12)

Re: Reference bug.

I guess this kinda modification will make referer urls more alterable with "http://(www.)?domain.(org|com)/forum" support smile

//
// Make sure that HTTP_REFERER matches $pun_config['o_base_url']/$script
// Symbols (,),[,],|,? are used as regexped, all others are quoted.
function confirm_referrer($script)
{
    global $pun_config, $lang_common;
    $ref=$_SERVER['HTTP_REFERER'];
    if (!$ref) $ref='';
    $pat=preg_quote($pun_config['o_base_url'].'/'.$script);
    $a=array('\(','\)','\|','\?','\[','\]');
    $b=array( '(', ')', '|', '?', '[', ']');
    $pat=str_replace($a,$b,$pat);
    if (!preg_match('#^'.$pat.'#i', $ref))
        message($lang_common['Bad referrer']);
}

P.S. sorry, I haven't found more recent topic to show this modification.