Huge question about JavaScript, cookies, and URLs

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
jairyn_1
Padawan Learner
Posts: 169
Joined: 2004-02-22 06:22am
Location: OMFG!!!!11! Teh b00bees!!!!! 1111oneoneshift+one 111!11oneeleven

Huge question about JavaScript, cookies, and URLs

Post by jairyn_1 »

Okay...

I need to start off by saying that this is kind of complicated and I don't really know very well what I'm doing.

First off, I need to be able to take a tell-a-friend form and have it send the URL of whatever site is showing (easy part). However, I need this script or whatever to be able to include the VISIBLE URL that is showing and change it (if possible) into something entirely different.

This is really important because I need to be able to send URLs with affiliate IDs encoded.

An example of a URL that would need to be taken would be this:

Code: Select all

http://www.myfreeadssecret.com/?hop=verilon
...but this would need to be changed to...

Code: Select all

http://hop.clickbank.net/?verilon/myfas
The problem here is that it NEEDS to be the second URL so that there can be a cookie placed by ClickBank for the products being sold. However, once the 2nd link is put in, it changes to the 1st link, but the 1st link doesn't carry the affiliate cookie - BIG PROBLEM.

So would there be any kind of script that would be able to copy that first URL and extract the affiliate ID (which follows the ?hop= in the first link) and put it into the second URL (following the ? in the second link) via PHP, CGI or JavaScript?

Also, I have a script that works to copy and paste into a form, but I'm not sure how similar that is to what I'm talking about above.

Here it is..

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My Net-Marketing Center Affiliate Resource Center</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css.css" type="text/css">
<script language="JavaScript" type="text/javascript"> 
<!-- 

bBool=false

var copiedtext=""
var tempstore=""

function initiatecopy() {
	bBool=true;
}

function copyit() {
	if (bBool) {
		tempstore=copiedtext
		document.execCommand("Copy")
		copiedtext=window.clipboardData.getData("Text");
			if (tempstore!=copiedtext) {
			}
		bBool=false;
	}
}

// --> 
</script>
</head>

<body>
<form name=theform>
  <p>Your ClickBank nickname:
      <input maxlength=10 size=15 name=nick>
      <input onClick=javascript:go() type=button value="Generate Html" name=button>
      <script>
  function go()
  { x=document.theform.nick.value;
    if (x.length<5){alert('Please enter your full ClickBank nickname in the blank.'); return 0;}
    y=document.location.search.substring(1,11);
    y='msfas';
    document.theform.thelink1.value='http://hop.clickbank.net/?'+x+'/'+y;
    document.theform.thelink2.value='<a href=http://hop.clickbank.net/?'+x+'/'+y+'>Click here to get My SUPER Free Ads Secret -- Advanced Series NOW!</a>';
    
  }
        </script>
  </p>
  <p>Here's your affiliate hoplink url:<br>
    <textarea name=thelink1 wrap=soft cols=56 rows=1></textarea>
  </p>
  <p>Here's your affiliate hoplink in html:<br>
    <textarea name=thelink2 wrap=soft cols=56 rows=3></textarea>
  </p>
</form>
</body>
</html>
Thanks in advance if anyone can help.
+++ ISARMA + BotM + Ubiqtorate + CotK: [mew]+++

ACPATHNTDWATGODW FOREVER!!

Join or die...
User avatar
Pu-239
Sith Marauder
Posts: 4727
Joined: 2002-10-21 08:44am
Location: Fake Virginia

Post by Pu-239 »

Err... this appears to be rather seedy...

ah.....the path to happiness is revision of dreams and not fulfillment... -SWPIGWANG
Sufficient Googling is indistinguishable from knowledge -somebody
Anything worth the cost of a missile, which can be located on the battlefield, will be shot at with missiles. If the US military is involved, then things, which are not worth the cost if a missile will also be shot at with missiles. -Sea Skimmer


George Bush makes freedom sound like a giant robot that breaks down a lot. -Darth Raptor
User avatar
jairyn_1
Padawan Learner
Posts: 169
Joined: 2004-02-22 06:22am
Location: OMFG!!!!11! Teh b00bees!!!!! 1111oneoneshift+one 111!11oneeleven

Post by jairyn_1 »

Pu-239 wrote:Err... this appears to be rather seedy...
It's entirely legitimate.
+++ ISARMA + BotM + Ubiqtorate + CotK: [mew]+++

ACPATHNTDWATGODW FOREVER!!

Join or die...
Post Reply