Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2003, 05:49 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how do i seperate the xxx.php from the rest?

In my other thread i mentioned that i was building an ads hack to target individual forums....this is nearly finished apart from a small problem with getting a random
https://vborg.vbsupport.ru/showthrea...723#post377723

However the next part of the hack will allow you to target individual files - store.php

example:

Code:
https://vborg.vbsupport.ru/store.phps=&action=main
how do i seperate the

Code:
store.php
from the rest so i can then perform a quiry to see if there is a match in the ads database and if so display the required banner.

thanks again in advance
Reply With Quote
  #2  
Old 04-05-2003, 10:43 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

take a look at online.php there you can see how vb divides the filenames and so on
Reply With Quote
  #3  
Old 04-05-2003, 11:01 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yep, i did have a look at that before i first posted but couldnt work it out. now that you have forced me into looking further would i do something like this or is other coding needed to set "case"
PHP Code:
//############### start advertising / sponsorship banner #############
case 'store':
      
$userinfo[where] = "$filename";
      break;

$showad $DB_site->query_first("SELECT * FROM ads WHERE pagename='$filename'");
    if (empty(
$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")."\";");

Reply With Quote
  #4  
Old 04-06-2003, 08:37 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

dosnt matter.....

lol..dont realy need it anyway....

the hack is finished!
will release soon
Reply With Quote
  #5  
Old 04-06-2003, 09:10 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ooops yes i well ned this for the hack afterall ......i will have to add it to the phpinclude template
Reply With Quote
  #6  
Old 04-06-2003, 01:03 PM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok i still cant work this out....

if i put this into globals.php

PHP Code:
$showad $DB_site->query_first("SELECT * FROM ads WHERE pagename='???????'"); 
What do i have to either replace ?????? with so it only equals "store" or "store.php" if that file is being accessed for example instead of /xxxx/store.php (i can get that..lol)

or do i have to add other coding in front of it.

i give up for the night...bed time..

thanks for any help in the meantime :sleep:
Reply With Quote
  #7  
Old 04-06-2003, 02:11 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you have to copy this part of online.php before:

PHP Code:
  $loc $userinfo[location];
  
$loc=preg_replace("/\?s=[a-z0-9]{32}(&)?/","?",$loc);
  if (
$loc==$userinfo[location]) {
    
$loc=preg_replace("/\?s=(&)?/","?",$loc);
  }
  if (
$loc==$userinfo[location]) {
    
$loc=preg_replace("/&s=[a-z0-9]{32}/","",$loc);
  }
  if (
$loc==$userinfo[location]) {
    
$loc=preg_replace("/&s=/","",$loc);
  }

  if (
$userinfo[invisible]) {
    
$userinfo[hidden] = '*';
    if (
$bbuserinfo[usergroupid] == 6) {
      
$userinfo[invisible] = 0;
    }
  }

  
$filename strtok($loc'?');
  
$pos strrpos ($filename'/');
  if (!
is_string($pos) || $pos) {
    
$filename substr($filename$pos+1);
  } 
then you can use $filename
Reply With Quote
  #8  
Old 04-07-2003, 06:36 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for pointing me in the right direction

I have now broken it down into 2 codes .......
this is the code to strip the url it does work in global.php but not in the phpinclude template.
PHP Code:
$loc $currentscript;
  
$loc=preg_replace("/\?s=[a-z0-9]{32}(&)?/","?",$loc);
  if (
$loc==$userinfo[location]) {
    
$loc=preg_replace("/\?s=(&)?/","?",$loc);
  }
  if (
$loc==$currentscript) {
    
$loc=preg_replace("/&s=[a-z0-9]{32}/","",$loc);
  }
  if (
$loc==$currentscript) {
    
$loc=preg_replace("/&s=/","",$loc);
  }

  if (
$userinfo[invisible]) {
    
$userinfo[hidden] = '*';
    if (
$bbuserinfo[usergroupid] == 6) {
      
$userinfo[invisible] = 0;
    }
  }

  
$pagenameid strtok($loc'?');
  
$pos strrpos ($pagenameid'/');
  if (!
is_string($pos) || $pos) {
    
$pagenameid substr($pagenameid$pos+1);
  
 } 
Here is the banner code to get the random or sponsored banner once again this works in the phpinclude template but not in global.php however from the template it always generates a random banner cos $pagename is not recognised in the template as it was set in the global tamplate. It will function properly in the global template but will not show up when $showthisad2 is called from the header.
PHP Code:
//########## start get ad banner
if ($forumid<"0" and $postid<"0" and $threadid<"0") {
$showad2 $DB_site->query_first("SELECT * FROM ads WHERE pagename='$pagenameid'");
    
    
    if (empty(
$showad2[pagename]) or $showad2[pagename]=="") {
  
  
$anotherad2 $DB_site->query_first("SELECT * FROM ads WHERE active=1 and bannerbank=1 ORDER BY RAND() desc LIMIT 1");
  
  eval(
"\$showthisad2= \"".gettemplate("ads_bannerbank2")."\";");
 
  } else {
 
 if (
$showad[active]=="1") {
  
  eval(
"\$showthisad2= \"".gettemplate("ads_page_sponsor")."\";");

  } else { 
  
$anotherad2 $DB_site->query_first("SELECT * FROM ads WHERE active=1 ORDER BY RAND() desc LIMIT 1");
  echo 
"$anotherad[client]";
  eval(
"\$showthisad2= \"".gettemplate("ads_bannerbank2")."\";");
  }
  }
}
//####### end advertising stuff ############# 
again they wont work together if put in the same location.

however i an one step closer to finishing the hack......

Damn this is going to save me a lot of headache when it is working properly!
Reply With Quote
  #9  
Old 04-07-2003, 07:04 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

YAHOO...got it!!!!!!!!!!!!!!

had do add extra coding from global.php to make the whole thing work in the phpinclude template.

i will release it when i pack it up....tomorrow or the next day...lol
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:08 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.04431 seconds
  • Memory Usage 2,281KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete