Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 17-03-05
Registered User
 
Join Date: Jan 2005
Location: London
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
J Nas is an unknown quantity at this point
  using php to print TD javascript code

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&amp;a=XXXXXXXX&amp;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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 17-03-05
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,752
Thanks: 3
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
id just store the actual link in a db column such as:

http://clkuk.tradedoubler.com/click?...XXXXX&g=XXXXXX

then when you come to printing it out you would just have
echo "<a href=\"$link\">$text</a>";

all the javascript stuff isnt really needed. and you can pick up the text links from the link matrix which is quicker than going into each program page and getting them from there.

also you could then just add tracking to the end on links if you wanted like...

echo "<a href=\"$link&epi=FooterLink\">$text</a>";

the link you have there (in your post) should track as it goes through the td tracking thing but the

Code:
<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>
after the actual link isnt of much use.
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 17-03-05
Registered User
 
Join Date: Jan 2005
Location: London
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
J Nas is an unknown quantity at this point
thats very helpfull!

cheers Dan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7