Hi,
I hope somebody can help me check if my code is ok.
I
am storing Trade doubleR javascript textlinks in my DB, i try and replace the actual text in the link with my own text
this is the data held in the table column
Quote:
|
<a href="http://clkuk.tradedoubler.com/click?p=XXXXX&a=XXXXXX&g=XXXXXX" target="_blank">$text</a><script language="javascript">var uri = 'http://impgb.tradedoubler.com/imp/inv/XXXXXX/XXXXXXX?' + new String (Math.random()).substring (2, 11);document.write('<img src="'+uri +'">');</script>
|
and store this in a variable e.g. $dbtext
I replace the actual text of the link with #$text# so i can write my own text in its place by using EVAL()
....
$isp_link = $dbtext // $dbtext =
TD code in db
$data = addslashes($isp_link); // i add slashed cos the javascript in the
TD code has apostrophes all over the place
$text =" Whoohoo heres my own text"; //this text really comes from another table col !
eval('$data = "' . $data . '";'); //DO STRING TRANSFORMATION so that the value $text in $isp_link is replaced with my own text which really comes from another column in the table!
echo "<span class=enquirelink>$data</a></span>";
------------------
so all this stuff prints out this source
<span class="enquirelink"><a href="http://clkuk.tradedoubler.com/click?p=XXXXX&a=XXXXXXXX&g=XXXXX" target="_blank">Whoohoo heres my own text</a><script language="javascript">var uri = \'http://impgb.tradedoubler.com/imp/inv/XXXXX/XXXXXXX?\' + new String (Math.random()).substring (2, 11);document.write(\'<img src="\'+uri +\'">\');</script></span>
---------------
so is this link ok ? are my clicks going to be tracked ok? is there a better way to do this ?
i have magic quotes on btw.
thanks all