vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   My random problem! (https://vborg.vbsupport.ru/showthread.php?t=51195)

trafix 04-05-2003 02:05 AM

My random problem!
 
I am building a new banner hack to allow targeted sponsorship of nominated forums :)

If a forum is sponsored the approiate banner will be displayed with link.........THIS WORKS!

However if a forum is not sponsored then a random banner is to be selected from the list....THIS IS NOT WORKING :(

I have added this to forumdisplay.php
PHP Code:

//############### start advertising / sponsorship banner #############
$showad $DB_site->query_first("SELECT * FROM ads WHERE forumidnum='$forumid'");
    if (empty(
$showad[forumidnum])) {
  
$randomad=$DB_site->query("SELECT * FROM ads ORDER BY rand() LIMIT 1");
  eval(
"\$showthisad .= \"".gettemplate("ads_bannerbank")."\";");
 } else {    
eval(
"\$showthisad .= \"".gettemplate("ads_forum_sponsor")."\";");


Here is the ads_bannerbank template
Code:

<center><smallfont>Please support our sponsors<br>
<a target='blank' href='http://www.atmyparty.com/network/click.php?bannerid=$randomad[id]'>
<img border='0' width='$randomad[width]' heigth='$randomad[heigth]' alt='$randomad[banner_text]'
 src='http://www.atmyparty.com/network/view.php?bannerid=$randomad[id]'></a>
<br>Please contact us to sponsor area of the site.<br><br></smallfont><center>

here is the source code of the non-sponsored page
Code:

<center><font face="verdana,arial,helvetica" size="1" >Please support our sponsors<br>
<a target='blank' href='http://www.atmyparty.com/network/click.php?bannerid='>
<img border='0' width='' heigth='' alt='' src='http://www.atmyparty.com/network/view.php?bannerid='>
</a><br>Please contact us to sponsor area of the site.<br><br></font><center>

What am i doing wrong?

thanks in advance

trafix 04-05-2003 05:39 AM

Ok whilst I have been waiting I have been working on other areas of the hack....however i still have not been able to solve this problem yet.

I will start a new thread for my next hurdle,
I have nearly been able to complete targeting forums here the next hurdle is to target a particular script......eg....store.php

new thread here https://vborg.vbsupport.ru/showthrea...threadid=51200

mr e 04-05-2003 06:40 PM

are you sure the cell will be empty?
PHP Code:

if (empty($showad[forumidnum])) { 

you could try
PHP Code:

if (empty($showad[forumidnum]) or $showad[forumidnum] == 0)
 { 


trafix 04-05-2003 10:10 PM

1 Attachment(s)
Hmmm thanks mr e,

I actually didnt think of that....doh...but it didnt work either I even tried
PHP Code:

//############### start advertising / sponsorship banner #############
$showad $DB_site->query_first("SELECT * FROM ads WHERE forumidnum='$forumid'");
    if (empty(
$showad[forumidnum]) or $showad[forumidnum] =="") {
  
$randomad=$DB_site->query("SELECT * FROM ads ORDER BY RAND() desc LIMIT 1");
   eval(
"\$showthisad .= \"".gettemplate("ads_bannerbank")."\";");
 } else {    
eval(
"\$showthisad .= \"".gettemplate("ads_forum_sponsor")."\";");


and it didnt work either

I only have 3 banners on the table so far and they do work when a target forum is nominated eg here i have also managed to make the ad banner to appear at the top of all threads in the nominated forum as well. i have even got it to display the sponsorship in the forum list. there are 2 sponsored forums here
http://www.atmyparty.com/network/for...s=&forumid=172

I have attached a gif of the current data table, so i spose to answer your question....if you are viewing forum number 28 the cell more correctly is not there rather than empty. so by defult i want to display a random banner in the unsponsored forum/threads.

Thanks so far for your ideas...

trafix 04-05-2003 10:17 PM

sorry but just to add to that the coding is displaying the right templates for both sponsored and unsponsored forums as the 2 templates are different....the problem is that the unsponsored forum has no image displayed.

Dean C 04-06-2003 07:23 AM

I may be missing something here but why are you only selecting when there is no data? Should it be like this:

PHP Code:

//############### start advertising / sponsorship banner #############
$showad $DB_site->query_first("SELECT * FROM ads WHERE forumidnum='$forumid'");
    if (!empty(
$showad[forumidnum]) or $showad[forumidnum] =="") {
  
$randomad=$DB_site->query("SELECT * FROM ads ORDER BY RAND() desc LIMIT 1");
   eval(
"\$showthisad .= \"".gettemplate("ads_bannerbank")."\";");
 } else {    
eval(
"\$showthisad .= \"".gettemplate("ads_forum_sponsor")."\";");


That's what doesn't make sense to me :s

- miSt

trafix 04-06-2003 08:05 AM

HIp hip horay.........after 2 bloody days the thing works...now to work out how to target a php file

https://vborg.vbsupport.ru/showthrea...threadid=51200

then its finished!

trafix 04-06-2003 08:36 AM

<font size="4">THE HACK IS FINISHED!</font>

Now to get rid of phpnewads


All times are GMT. The time now is 05:40 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.01231 seconds
  • Memory Usage 1,748KB
  • 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
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete