vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Advert Management (https://vborg.vbsupport.ru/showthread.php?t=39074)

SpeedStreet 12-19-2002 12:34 PM

Would any of my proposed fixes work for this, PPN?

waherne 12-19-2002 04:04 PM

PPN,

I modified your hack and have now got it to randomise the adverts successfully. As I said before, I am not a programmer, so my code is probably inefficient in performing the task - when I post the code here, you and others can hopefully assist in that respect.

The only thing with my modification is that I have disabled the 'show on whole board' functionality. Basically, I didn't need it for my purpose.

I'm at work now and don't have access to my laptop. I will post my code to this thread over the next few days.

Once again, thanks for the hack.

Willie

thakikka 12-20-2002 09:34 PM

I guess I found the error I reported some posts before (banners not shown on directly linked posts).

If the script finds something like "&threadid=19938" then the banner gets displayed.

But if you directly link to a post, it contains "?postid=172199" and the banner does not get displayed.

Can someone fix this so banners get displayed on every page?

Thanks in advance,
Sebastian

thewolf 12-22-2002 08:22 AM

Hi PPN,

any news on the new version of this hack?

Also, will it work with the latest stable version of Vbulletin (2.2.9)?

Keep up the good work!

Thanks,
Marco.

waherne 12-22-2002 09:30 AM

Further to my post above, here are the changes I made to PPN's hack to make it randomise. As I said, let us all work together to make my code more efficient.

Willie

////////////////////START//////////////////////////
In global.php, FIND:

if(isset($advert_forumid)) {
$foruminfo = getforuminfo($advert_forumid);
$advert=$DB_site->query_first("SELECT * FROM ads WHERE LOCATE(CONCAT(',',forumid,','),',$foruminfo[parentlist],')>0 AND

time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()");
} else {
$advert=$DB_site->query_first("SELECT * FROM ads WHERE wholeforum='1' AND time>=".time()." AND (exposed<=exposures OR

exposures=0) ORDER BY RAND()");
}

AND REPLACE IT WITH:

$DB_site;

$sql="SELECT * FROM ads WHERE LOCATE(CONCAT(',',forumid,','),',$foruminfo[parentlist],')>0 AND time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()";

$advert1 = mysql_query($sql);
$advert2 = mysql_query($sql);

$adcounter=0;
while($countrow = mysql_fetch_row($advert1))
{
$adcounter++;
}
$act1=rand(0,$adcounter-1);
$adcounter3=0;
while($countrow3 = mysql_fetch_row($advert2))
{
if($adcounter3==$act1)
{
$DB_site->query("UPDATE ads SET exposed=exposed+1 WHERE adid='$countrow3[0]'");
eval("\$advert = trim(\"".str_replace("\'", "'", addslashes($countrow3[7]))."\");");
}
$adcounter3++;
}

///////////////END///////////////////

I just noticed that there is another block of code that should also be included in the Find It and Replace above, essentially it's the code immediately following that set out above and beginning with $DB_site->query("UPDATE ads SET exposed - one query only.

SpeedStreet 12-22-2002 05:39 PM

Now, let me understand you correctly. This code works, but it eliminates the "Show on all forums" functionality?

waherne 12-22-2002 07:59 PM

Correct.

Adverts on child forums will be pooled together with adverts on their parent forums (and their parents...) as before. One advert will then be picked from the pool. Therefore, insertion of an advert at the ultimate parent level could be one way of displaying it on the entire forum.

Test my code and see if it suits your needs.

Willie

quickstang22 12-31-2002 01:08 AM

Willie

I tried your fix but lost all my ads. Not one is showing up. I made sure they were not selected for show all fourms. Just had them in child forums

Matt

themonarch 01-05-2003 12:56 AM

Quote:

Originally posted by Visionray
good thing I read the last few pages of this thread and realized this hack isn't working. Maybe the first post should be updated with that info so people don't go instalilng it to only find out it doesn't work.
mmm, good point VisionRay. I installed this hack and then when it didn't work, I came back in here to read the whole thread and found out it's not working right yet.

ChurchMedia 01-05-2003 06:33 AM

When I run this query:

CREATE TABLE `ads` (
`adid` smallint(5) NOT NULL auto_increment,
`name` varchar(25) NOT NULL default '',
`forumid` smallint(5) NOT NULL default '0',
`wholeforum` smallint(1) NOT NULL default '0',
`exposed` smallint(10) NOT NULL default '0',
`exposures` smallint(10) NOT NULL default '0',
`time` int(10) NOT NULL default '0',
`advert` text NOT NULL,
KEY `adid` (`adid`)
);

I get this error:

MySQL said:

You have an error in your SQL syntax near '\'\',
`forumid` smallint(5) NOT NULL default \'0\',
`wholeforum` smallint(' at line 3

Any ideas?


All times are GMT. The time now is 12:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01300 seconds
  • Memory Usage 1,741KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete