Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Creating php Jump Script


Guest

Recommended Posts

I am in the process of developing a "jump" script that will work in conjunction with my OsC store. I have included in the column_left five banners that include an affiliate code. What my intentions are is to set up a "jump.php" page but because my extremely limited knowledge of php is causing me no end of grief, I was wondering if someone with that expertise could see what I am doing wrong.

 

Step one - Create a "jump.php" file and upload it to the catalog/ file as below:

<?php

if ($m == "") ($link = "http://www.adorablyyoulingerie.com/catalog";) //default blank
if ($m == "FigLeaves") ($link="http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=92704.10000281&type=3&subid=3";)
if ($m == "Pro Activ Solutions") ($link="http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=80371.10000024&type=3&subid=3";)
if ($m == "Hanes") ($link="http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=131870.10000007&type=3&subid=3";)
if ($m == "Just My Size") ($link="http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=139839.10000003&type=3&subid=3";)
if ($m == "Sierra Trading Post") ($link="http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=132016.10000259&type=3&subid=3";)


header(location: $link"); //jump to the hidden affiliate URL above
exit();
?>

 

The first line is designed to redirect anyone who tries to capture the "jump.php" file from the browser window to the catalog page. The subsequent lines are intended to be read by the link from the "column_left" and direct the visitor directly to the affiliate screen.

 

Step Two - Amend the links in the "column_left" file to associate with the "jump.php" file as follows:

 

<td><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=FigLeaves"><img file></a>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Pro Activ Solutions"><img file></a>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Hanes"><img file></a>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Just My Size"><img file></a>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Sierra Trading Post"><img file></a></td>

 

As these codes stand, I am getting a parsing error in the browser window suggesting that my coding is wrong but I have no idea where.

 

I also believe that if I can develop this to be functional with OsC it would be an invaluable tool for online retailers to thwart at least some of the affiliate link code thievery that steals their profits.

 

If someone has the time or the inclination to see where I have erred here I would greatly appreciate it.

 

Thank You

DylanO

Link to comment
Share on other sites

Script:

 

<?php
switch ($m) {

case NULL :
$link = 'http://www.adorablyyoulingerie.com/catalog'; //default blank
break;

case 'FigLeaves':
$link='http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=92704.10000281&type=3&subid=3';
break;

case 'Pro Activ Solutions':
$link='http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=80371.10000024&type=3&subid=3';
break;

case 'Hanes':
$link='http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=131870.10000007&type=3&subid=3';
break;

case 'Just My Size':
$link='http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=139839.10000003&type=3&subid=3';
break;

case 'Sierra Trading Post':
$link='http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=132016.10000259&type=3&subid=3';
break;

default:
$link = 'http://www.adorablyyoulingerie.com/catalog'; //default blank
break;
}
header('Location: $link'); //jump to the hidden affiliate URL above
exit();
?>

A "switch construct" is better coding than a trail of "if's".

 

And your column_left amendment should be:

 

<tr>
<td><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=FigLeaves"><img file></a><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Pro Activ Solutions"><img file></a><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Hanes"><img file></a><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Just My Size"><img file></a><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Sierra Trading Post"><img file></a></td>
</tr>

osC is "table based". All you forgot there were the <tr> </tr> tags.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Maybe the column_left amendment should be this:

 

<tr>
<td><a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=FigLeaves"><img file></a><br>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Pro Activ Solutions"><img file></a><br>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Hanes"><img file></a><br>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Just My Size"><img file></a><br>
<a href="http://www.adorablyyoulingerie.com/catalog/jump.php?m=Sierra Trading Post"><img file></a></td>
</tr>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

And if you wanted to get rid of the little grey corners in your boxes, I know two people who have tried this with success:

 

remove rounded corners and images from boxes

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I am beginning to think you are my personal mentor in all of this Jim. Once again I thank you. I will work it through and let you know how it works out.

 

About the box corners - I am just about to recolor them as I have the buttons in the various product pages.

Link to comment
Share on other sites

I have just uploaded the jump.php as written and made changes to the column left and the links are taking me back to the main catalog page. I know it is thinking about it because it is taking longer to reload the main page. There are no errors showing and the site is still functioning so I just have to find the tweak for the code. Just an update.

Link to comment
Share on other sites

What exactly do you want the code to do that it isn't doing?

:unsure:

 

And as I said once before, working with you on your site has it's benefits.

;)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

What exactly do you want the code to do that it isn't doing?

:unsure:

 

And as I said once before, working with you on your site has it's benefits.

;)

 

 

What I was attempting to do was to hide or mask the affiliate code so it could not be stolen by thieves and redirected to their own affiliate code which is happening at a growing rate and most people who are in affiliate programmes have no idea that this is happening. Their commissions are being silently stolen.

 

The intention is that the link that is sitting on the column_left when clicked will silently find the appropriate connection in the jump.php and redirect that click to the company. To clarify, if I click on FigLeaves or try to "see" its affiliate code I will just see the jump.php link. When I click on that link it will send me through the jump.php connection to Figleaves.com using my affiliate code.

I am not sure that is a clear explanation but it is as close as I can get this late in the day.

 

I do have some sweet looking models don't I! ;)

Link to comment
Share on other sites

I see what you're doing.

 

You're tacking the "m=...(whatever).." on the end of the link.

 

We'll need to change the script to read that.

 

I'll see what I can do to figure that out.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Try this:

 

Change the first 3 lines of the script to this:

 

<?php
$m = $HTTP_GET_VARS['m'];
switch ($m) {

Look closely at your code for the figleaves.com pic.

 

I think you have /catalog in there twice.

:blush:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Try this:

 

Change the first 3 lines of the script to this:

 

<?php
$m = $HTTP_GET_VARS['m'];
switch ($m) {

case NULL :
   $link = 'http://www.adorablyyoulingerie.com/catalog'; //default blank
   break;

case 'FigLeaves':
   $link='http://click.linksynergy.com/fs-bin/click?id=xxxxxxxxxxx&offerid=92704.10000281&type=3&subid=3';
   break;

case 'Pro Activ Solutions':
   $link='http://click.linksynergy.com/fs-bin/click?id=xxxxxxxxxxx&offerid=80371.10000024&type=3&subid=3';
   break;

case 'Hanes':
   $link='http://click.linksynergy.com/fs-bin/click?id=xxxxxxxxxxx&offerid=131870.10000007&type=3&subid=3';
   break;

case 'Just My Size':
   $link='http://click.linksynergy.com/fs-bin/click?id=xxxxxxxxxxx&offerid=139839.10000003&type=3&subid=3';
   break;

case 'Sierra Trading Post':
   $link='http://click.linksynergy.com/fs-bin/click?id=xxxxxxxxxxx&offerid=132016.10000259&type=3&subid=3';
   break;

default:
   $link = 'http://www.adorablyyoulingerie.com/catalog'; //default blank
   break;
}
header('Location: $link'); //jump to the hidden affiliate URL above
exit();
?>

 

and the code line in the column_left looks like this

 

<tr>
<td align="center"><a href="catalog/jump.php?m=FigLeaves"><img alt="Figleaves your one stop for lingerie from sexy to daily wear" src="/images/figleaves125x125_brands.gif"></a><BR><BR>
<a href="/catalog/jump.php?m=Pro Activ Solutions"><img alt="Get your skin the healing it needs with ProActiv Solutions" src="/images/proactivsolution2637_10000158.gif"></a><BR><BR>
<a href="/catalog/jump.php?m=Hanes"><img alt="Hanes for all of your lingerie needs" src="/images/hanesaff_UnisexCasualwr_125x125.jpg"></a><BR><BR>
<a href="/catalog/jump.php?m=Just My Size"><img alt="Just My Size delivering clothes that really fit including your lingerie" src="/images/JustMySizeAFF_JEANS_125x125.jpg"></a><BR><BR>
<a href="/catalog/jump.php?m=Sierra Trading Post"><img alt="Get your closets and lingerie drawers outfitted with the best from Sierra Trading Post" src="/images/sierraSTP_womens_125x125.gif"></a></td></td>
</tr>

 

I am still being brought back to the catalog page "non SSL" instead of being directed to the affiliate store.

 

Since I have been working on this since 5 this morning and it is now after 8 in the evening, I think I am going to take a fresh look at this in the morning.

Thanks Jim

Link to comment
Share on other sites

your problem is this line in jump.php

header('Location: $link');

You are using single quotes so PHP ignores the $link which confuses things. You need to use one of the following:

header('Location: ' . $link);

or

header("Location: $link");

Link to comment
Share on other sites

:blush:

 

Nice catch!

 

The links sould be:

 

<tr><td align="center"><a href="jump.php?m=FigLeaves"><img alt="Figleaves your one stop for lingerie from sexy to daily wear" src="/images/figleaves125x125_brands.gif"></a><BR><BR>
<a href="jump.php?m=Pro Activ Solutions"><img alt="Get your skin the healing it needs with ProActiv Solutions" src="/images/proactivsolution2637_10000158.gif"></a><BR><BR>
<a href="jump.php?m=Hanes"><img alt="Hanes for all of your lingerie needs" src="/images/hanesaff_UnisexCasualwr_125x125.jpg"></a><BR><BR>
<a href="jump.php?m=Just My Size"><img alt="Just My Size delivering clothes that really fit including your lingerie" src="/images/JustMySizeAFF_JEANS_125x125.jpg"></a><BR><BR>
<a href="jump.php?m=Sierra Trading Post"><img alt="Get your closets and lingerie drawers outfitted with the best from Sierra Trading Post" src="/images/sierraSTP_womens_125x125.gif"></a></td></tr>

Your <base href".."> will add the rest.

;)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Gentlemen,

 

Your solutions have worked and visitors are now being forwarded to affiliates. Excellent job from you both

I am going to look into setting this up as a contribution since there are a number of posts regarding affiliates and it will help protect some profits in the future perhaps. Once I have it written up I will let you know.

 

Thank you

Dylan

Link to comment
Share on other sites

<?php
$id = substr($_SERVER['PATH_INFO'], 1);
switch ($id) {
case "FigLeaves":
header("Location: http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&offerid=92704.10000281&type=3&subid=3");
break;

default:
header("Location: http://www.adorablyyoulingerie.com/catalog/");
}
?>

 

And link like this:

 

<a href="jump.php/FigLeaves">Go</a>

Link to comment
Share on other sites

Hi Burt,

 

You have delivered additional code changes and I have to ask. The code as it is now set up works and delivers the click through to the affiliate site and appears to register. Since I am just now finding my way around php coding, this is the current code

<?php
$m = $HTTP_GET_VARS['m'];
switch ($m) {

and this is your proposed code

<?php
$id = substr($_SERVER['PATH_INFO'], 1);
switch ($id) {

 

What are the additional benefits to your code structure?

 

Dylan

Link to comment
Share on other sites

Just another way to write the same thing.

It doesn't use the $m variable...so no need to add ?m= to your link. Saves a whole 3 characters ;)

 

Note also, that my code no $link variable - this is not needed - it only adds an extra processing step.

Link to comment
Share on other sites

Just another way to write the same thing.

It doesn't use the $m variable...so no need to add ?m= to your link. Saves a whole 3 characters ;)

 

Note also, that my code no $link variable - this is not needed - it only adds an extra processing step.

 

 

Thanks Burt for the explanation! I will make the changes and see how it performs then let you know later in the day

Link to comment
Share on other sites

It should work fine - I actually give away a little desktop based tool which "automates" adding of new links.

 

You are quite correct Burt - it does work fine.

I would also be interested in hearing more about this link automating system for adding new links.

Link to comment
Share on other sites

I would like to thank the three minds who have guided me extremely well on solving this problem. Your input has been an invaluable benefit. :thumbsup:

Link to comment
Share on other sites

I would like to thank the three minds who have guided me extremely well on solving this problem. Your input has been an invaluable benefit. :thumbsup:

 

Here, here!!!!

 

Yes, I do believe a whole LOT of people should be thanking you as the solution you presented can insure income for anyone who works with affiliates.

 

You could have probably sold it!!!

 

Can't say thank you enough,

 

 

~~~Tapuahk

Link to comment
Share on other sites

Dylan - http://www.pxcloaker.info

 

I made this script to do exactly as Tapuahk says - "insure income for anyone working with affiliates". Part of my income comes from Affiliated products and this little script comes in handy for me. Might not work for you, so if it doesn't, you've lost nothing by trying it.

 

Gary

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...