vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   how do i seperate the xxx.php from the rest? (https://vborg.vbsupport.ru/showthread.php?t=51200)

trafix 04-05-2003 05:49 AM

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

Xenon 04-05-2003 10:43 AM

take a look at online.php there you can see how vb divides the filenames and so on :)

trafix 04-05-2003 11:01 AM

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")."\";");



trafix 04-06-2003 08:37 AM

dosnt matter.....

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

the hack is finished!
will release soon

trafix 04-06-2003 09:10 AM

ooops yes i well ned this for the hack afterall ......i will have to add it to the phpinclude template

trafix 04-06-2003 01:03 PM

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:

Xenon 04-06-2003 02:11 PM

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

trafix 04-07-2003 06:36 AM

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!

trafix 04-07-2003 07:04 AM

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


All times are GMT. The time now is 11:17 AM.

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.01414 seconds
  • Memory Usage 1,771KB
  • 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
  • (9)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