PDA

View Full Version : Can I use this code in vb4 ?


sadiq6210
03-29-2012, 08:53 AM
I was searching for this code but I found it for vb3
Can I use it in vb4?



It would be easy enough to switch the way views are counted with a couple of plugins.

1- Hook Location: vba_links_showlink_goto
$vbulletin->url = $vba_links->_link['linkurl'];
eval(print_standard_redirect('adv_links_transferri ng'));
exit;


2- Hook Location: vba_links_showlink_showdetails_start
$db->query_write("UPDATE LOW_PRIORITY " . TABLE_PREFIX . "adv_links SET views = views+1 WHERE linkid = $linkid");

kh99
03-29-2012, 11:19 AM
I don't think there's anything that won't work for vb4. I don't think the eval() around the print_standard_redirect() is needed, but I don't think it hurts anything.

sadiq6210
03-31-2012, 07:28 AM
I didn't think the eval() will work that's why I asked, but after read you post I tried to use it and it is working perfect with me.

Thanks dear

Pandemikk
03-31-2012, 07:33 AM
The eval() may or may not be needed. I'm never sure on the context. It's not going to break your code, but it may prevent the redirect from working as intended. I'd leave it there.

But the exit is not needed, standard_redirect (which is called from print_standard_redirect) halts execution with an exit. :D

kh99
03-31-2012, 09:57 AM
But the exit is not needed, standard_redirect (which is called from print_standard_redirect) halts execution with an exit. :D

That's exactly the reason the eval() isn't needed - it never returns so nothing is ever eval'ed. In previous versions of vb print_standard_redirect() would return a string that needed to be eval'ed.

Pandemikk
03-31-2012, 10:09 AM
Yeah I don't understand why vB uses eval so much. There's no need to eval print_standard_redirect unless I'm missing something from being up at this hour.