View Full Version : Getting forum domain
steadicamop
06-13-2007, 08:04 PM
Hey guys and gals,
I'm trying to make my product dynamic - at the moment you need to type in the domain name of the forum (ie - steadiforum.com) - and I tried using $vboptions[bburl] but that is stored as http://www.steadiforum.com - and I need to find a way of getting the forum url, but stripped down - without the http://www part - how would I go about this?
Cheers
Jason
Lynne
06-13-2007, 08:49 PM
I don't think it is actually stored anywhere as a phrase currently. But, that doesn't mean you can't make your own phrase and store it and then use it somewhere. I'm not sure that that answers your question exactly. Perhaps if you say how you want to use it, we can help you further.
steadicamop
06-13-2007, 09:52 PM
I have asked a friend of mine, who's pretty clued up with php and he gave me this code:
$ref = str_replace(array('http://','www.'),array('',''),$vboptions['bburl']);
And as I've read it, str_replace works by searching the first part (array('http://','www.')) then replaces it with the next (array('','')) and looking in the last part for the source ($vboptions['bburl']) - but this isn't working, just giving an error:
Warning: strstr() [function.strstr]: Empty delimiter. in /attachment.php(112) : eval()'d code on line 3
Which is this line:
if(!strstr($_SERVER['HTTP_REFERER'],$ref)) {
Now I'm in teritory I don't fully understand - but there is something to do with the strstr function that has caused the error.
Beyond that I'm lost .... can anyone shed any light on this?
Cheers
Jason
LBmtb
06-13-2007, 10:20 PM
Try
$mmNice = str_replace('http://www.','',$_SERVER['SERVER_NAME']);
steadicamop
06-13-2007, 10:26 PM
Brilliant, that's done it - the one thing I will ask about this is that it's going to be used on an anti-leech system so it checks the referring domain before allowing the download - I've tested it and it now works fine, but this is only on my forum, will it work fine with forums in sub directories (www.mysite.com/forum) ?
Would using $_SERVER['SERVER_NAME'] give any issues for people using root servers or home based servers? If a server is running more than one forum, would each one have it's own server name? I'm maybe asking questions which are a little too indepth ..... I'm not too sure myself.
Thanks for your help, you've saved me a big headache :D
Jason
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.