Debt Consolidation - Property in Dubai - Debt Consolidation - Debt Consolidation - High Paying Adsense List

PDA

View Full Version : Check URL before executing code


payoutwindow
Feb 20th 2009, 12:38 pm
Hey people .. I need a little help.

I have some code like this

<script src="http://www.abcdef.com/mbvcn.php?sfs=6123761283&" language="JavaScript" type="text/javascript"></script><noscript><link href="http://asdsda.com/adsad" type="text/css" rel="stylesheet"/></noscript>

however I want to only execute this code if the url is mydoain.com/folder/

Can some please put up code on how to do this. The site is php based, so even that would be okay.

rene7705
Feb 20th 2009, 9:39 pm
in your .php being called, $_SERVER['HTTP_REFERER'] is what you need to check on, with a strpos() or a preg_match..

http://www.php.net/preg_match

RTFM buddy

payoutwindow
Feb 21st 2009, 5:29 am
Okay ... pointed me in the right directions there.

This is what I have so far ... however the javascript is still not working!!!

Any more help??


<?php
$ref = $_SERVER["PHP_SELF"];
$ref = substr($ref, 0, 6);
//echo $ref;
if ( $ref == '/2010/' )
{
//record visit
echo "<script src="http://www.xxxxx.com/qwwwrwqw.php?pub=1324239&wwewq=adsas%sj21" language="JavaScript" type="text/javascript"></script><noscript><link href="http://adsasddaas.com/nojava.css" type="text/css" rel="stylesheet"/></noscript>";
//echo $ref;
}
?>


Error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/xxxxx/public_html/2010/test.php on line 8