Version: 1.00, by Scott MacVicar
Developer Last Online: Mar 2016
Version: 2.2.x
Rating:
Released: 05-25-2002
Last Update: Never
Installs: 47
No support by the author.
This is a script to allow you to manage the adverts on your forums, you can have any sort of advert you can imagine there is no actual limit with this hack to what it can be, javascript, flash, image, text and images.
You add adverts to a category or a forum or the whole board. If the category has child forums they will inherit the adverts as well as their own adverts if they have any.
Adverts can have a set exposure such as 10,000 views and once it has reached that it will stop.
It fills a variable called $advert which you just place in any template, such as the header, you can also use variables and replacements within the adverts, such as $bbuserinfo[userid] for the persons userid in a link within an advert.
Updated June 9th at 19:44 GMT
Added date limits and options for unlimited exposures.
To upgrade from an older version, reapply code in global.php, upload ads.php and run this sql query to alter the ads table you made.
[sql]ALTER TABLE `ads` ADD `time` INT(10) DEFAULT '0' NOT NULL;[/sql]
[sql]ALTER TABLE `ads` ADD `wholeforum` SMALLINT(1) DEFAULT '0' NOT NULL;[/sql]
If you already run that query though are still experiencing problems with the time always being January 1st run
New features include showing the advert on the entire forum by using a radio button, some highlighting in the admin panel, italic name indicates the time period has ended and a bold name means the advert has met its quota for exposures.
You must chance RAND() to RAND(NOW()) if you have mysql 3.23.52 or above
Scott
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I tried adding a limit, just HOPING that would work, and that still didn't seem to fix the problem.
i.e.
PHP Code:
$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() LIMIT 50");
I'm still thinking that the issue lies within the info of the table. My last entry is always garbled only in that table, no others...
I was reviewing this thread and also the code for the hack.
I'm not a programmer but would this be a solution?!!!!
I think that the problem relates to the mysql query and the 'order by rand()' instruction.
Would this solution work?
1. Query the database but exclude the order by rand() referred to above.
2. Count the no of rows in the query result/array. Result ='x'.
3. Use a php function to pick a random value 'y' between 0 and x-1.
4. Select row 'y' from the query result/array and use this to display the advert.
What do you think?
Or is there anyone else out there that has the coding skill to implement and test this?
This is a great hack and only needs the last push to make it a super one!
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.
How about if generate a random number using PHP, convert it to an integer value (probably by
multiplying by 100 and lopping off the decimals) and use that as the
seed?
I don't know how to do this, but I clearly remember there being something on these forums about a vbrand() function.