PDA

View Full Version : how do i seperate the xxx.php from the rest?


trafix
04-05-2003, 05:49 AM
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/showthread.php?s=&postid=377723#post377723

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

example:

https://vborg.vbsupport.ru/store.phps=&action=main

how do i seperate the

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"
//############### 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

$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:

$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.
$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.
//########## 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