PDA

View Full Version : Understanding exec_header_redirect


derfelix
01-19-2010, 06:14 AM
Hello,

I have a little problem using exec_header_redirect
For a hackpage.. using posting similar to imagecomments i want to do following:
(that used to work in older vb versions)

if there is a postid present, i want to add an anchor jumpmark to the url, just as vbulletin does in showthread.php...
everything is fine.. at the end I have a redirect..


(example:)
$postid=4;
if($postid)
{
exec_header_redirect($url . "#postid$postid");
}
else
{
exec_header_redirect($url);
}


it works except it sends me to the $url without the #postid$postid even if the postid is present
....
I looked into it.. and exec_header_redirect calls the function: create_full_url
before processing the url..
create_full_url rebuilds the url and strips the anchor jump... :(

so exec_header_redirect behaves like expected...

BUT:
in showthread.php i can find:
if ($posts['postid'])
{
unset($pageinfo['goto']);
$pageinfo['p'] = $posts['postid'];
exec_header_redirect(fetch_seo_url('thread|js', $threadinfo, $pageinfo) . "#post$posts[postid]");
}
else
{
unset($pageinfo['goto']);
$pageinfo['p'] = $threadinfo['lastpostid'];
exec_header_redirect(fetch_seo_url('thread|js', $threadinfo, $pageinfo) . "#post$threadinfo[lastpostid]");
}

and there it seems to work....

I am really stuck.. any help, hint etc.. would be very appreciated..

I dont think it has todo with the fetch_seo_url (which i dont use because the #postxxx is anyway added afterwards)

F.

Lynne
01-19-2010, 04:24 PM
Did you try using the method from showthread.php?

derfelix
01-19-2010, 04:43 PM
yes... except for the fetch_seo_url() because i dont have any seo url there...(in the hack)
it works.. for the redirect.. but I loose the anchor...
hoping there arent any security issues.. i will do the following..
just create my own function exec_header_redirect_jump
with the same content as the vbulletin one.. but adding the jumpmark after the create_full_url($url)

Not very elegant.. but it will work...

I suspect the #postid$postid is just a leftover from vb3... and the real stuff is done in fetch_seo_url