Jump to content
Larry Ullman's Book Forums

Multi-Tasks On Multi-Sites Via A Single Php Script?


Recommended Posts

Hello all,

 

I wonder how many individual tasks can be done and on how many sites via just a single php script (i.e., a URL link in php scripting).

 

Let me explain my ideas...

 

Say, the following link (a single php file) will open the homepage of this forum site:

http://www.larryullman.com/forums/index.php

 

The above php file can be in the form of a text link (like the one above), or built-in in a Flash image (like in any banner ads). Clicking on the link (or a banner ad) will open a new webpage the script is designed to do.

 

Now my question is whether the tasks #4 and #5 of the following process can BOTH be achieved at the same time (triggered by one click):

 

1. A php link is built-in in an image ad;

2. The ad is served to a participating website (Site 01) - that is, Site 01 now displays the ad on its pages;

3. A visitor to Site 01 clicks on the ad;

4. The script opens a new page on another site (say, Site 02);

5. A Session is created on Site 01, allowing "membership information of the image ad" to stay with Site 01 for a predefined period.

 

In other word, when a visitor clicks on an image ad on Site 01, the visitor will be directed to a new webpage on Site 02, and at the same time, the "click" will also create a session on Site 01 for that visitor, so that if the visitor later comes back to Site 01 and make a purchase, referral fee will be credited to the member of the image ad.

 

Any comment please!

 

Thanks,

Cofa

Link to comment
Share on other sites

Thank you Larry! Glad to know that my belief is correct - "PHP can do this!"

 

For the JavaScript part, I'll have to ask my web host to develop the script. For academic purposes of this forum please allow me to continue with the query.

 

I have tried a "possible solution" but it doesn't seem to work:

 

Please refer to "PAGE 1" of the SAMPLE SCRIPTS at the end -

Firstly, an image ad shall have a "built-in link" that contains the following two items:

"memberid" = the referrer ID of the advertiser

"newsite" = the new website the image ad is supposed to call

 

The "built-in link" of the ad will point to a specific page on the same site displaying the ad - see "PAGE 2".

 

The "specific page" (Page 2) contains a script to do the multi-tasks that I expect to be done:

The script first checks if a memberid is presented, if so it will set a session on the site.

At the same time, the script will re-direct the reader to a "new site" called by the ad.

 

The results? The script (on Page 2) did work, but only partially. It did re-direct to the "newsite" page, but the expected session was not set.

 

Can someone point out what's wrong with the process please?

 

Cofa

5/31/2012

 

 

= = = = = = = = =

SAMPLE SCRIPTS

= = = = = = = = =

 

 

PAGE 1 (/page_1.php - or can be any other page):

Link on the page or link built-in in an ad image displayed on the page

===================================================

http://www.sitename.com/page_2.php?memberid=cofa&newsite=http://www.newsite.com/

 

 

PAGE 2 (/page_2.php):

A specific page on the same site to execute the php script from Page 1

===================================================

<?php

session_start();

if (isset($_REQUEST['memberid'])) {

$_SESSION['memberid'] = $_REQUEST['memberid'];

}

if ($_REQUEST['newsite'] != '') {

$reloadURL = $_REQUEST['newsite'];

header("Location: $reloadURL");

exit();

}

else {

$reloadURL = $_SERVER['HTTP_REFERER'];

header("Location: $reloadURL");

exit();

}

?>

Link to comment
Share on other sites

No, I cannot.

 

But Larry, I have to thank you for reminding me! I have reviewed my testing process and realized that my script (in my previous post) does just fine!

 

The script can really re-direct reader to another site called for by the ad (link), and at the same time set the session. (I must have neglected something in my previous test.)

 

For those who are interested, please view the working files from this link:

 

http://www.imahjong.com/test/09_multitask.php

 

Cheers!

Cofa

6/6/2012

Link to comment
Share on other sites

 Share

×
×
  • Create New...