?
Solved

Referrer ID's being passed page to page

Posted on 2003-03-02
14
Medium Priority
?
227 Views
Last Modified: 2008-02-26
Hi,

checkout http://www.xcensus.com

I would like to be able to pass a variable such as www.xcensus.com?affid=0111 to any page on my site and for it to get picked up on the signup pages, whats the best way to achieve this, and the code needed to make the idea work ?  

Regards
0
Comment
Question by:MirageSF
  • 5
  • 4
  • 3
  • +1
14 Comments
 
LVL 15

Accepted Solution

by:
VGR earned 400 total points
ID: 8051732
possibility :
on start of each page :
if (isset($_GET["affid"])) {
  $affid=$_GET["affid"];
  Header("Location: yoursignup.php?affid=$affid");
} // if transmitted via GET (in the URI)
0
 
LVL 1

Expert Comment

by:KC_Speedball
ID: 8051740
the best and cleanest (not the easiest) way is to use session.


the code will be like this:

<?php
session_start();
register_session('affid');


$_SESSION['affid'] = 0111;

for the first page

any other page have to contain

<?php
session_start();
register_session('affid');

and than you can you $_SESSION['afid'] in the script consisting the value from the first page
0
 
LVL 1

Expert Comment

by:KC_Speedball
ID: 8051743
Again VGR *grrr* the fastest coder on earth :). Rien ne va plus! Thanks for learning from you.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:VGR
ID: 8051758
not at all the fastest 8-)
just the one working also on Sunday :D
0
 
LVL 1

Expert Comment

by:KC_Speedball
ID: 8051765
it looks like working 24 hours 7 days a week for me
0
 

Author Comment

by:MirageSF
ID: 8051768
Hmm, but surely the first method would be forgotten if they moved to another page ?  Hows about a cookie, as I would also like it to remember that affid for 30 days from when its first visited ?

Regards
0
 
LVL 1

Expert Comment

by:KC_Speedball
ID: 8051783
never worked with cookies. job for VGR
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8052202
yeah but cookie is not reliable....
but for your purpose cookie is the only solution...
regards
0
 
LVL 15

Expert Comment

by:VGR
ID: 8052400
absolutely not, carchitect !
Cookies (I mean EXPLICIT cookies) are the WORST solution I would try. Only in Despair would I use them.

Sessions ***usually*** involve cookies too (or files on the server)

if they go to another page, id doesn't change anything because you redirect to the "signup page" anyway. I thought you wanted the affid to be transmitted forward, but if you don't, no problem, it's even simplier :
if (isset($_GET["affid"])) {
 Header("Location: yoursignup.php");
} // if transmitted via GET (in the URI)

this way ANYTIME affid is sent via the (direct) URL, the browser is redirected to yoursignup.php

That's what you asked for, isn't it ? :D
0
 

Author Comment

by:MirageSF
ID: 8055408
Erm....  They will always be sent to http://www.xcensus.com/index.php?affid=(anynumber)

Then I really need this number stored for upto 30 days, so if that person visits the site during that time again without including the ?affid bit then when they move throughout the site and eventually sign up, the affid originaly number is picked up from their machine somehow.
0
 
LVL 15

Expert Comment

by:VGR
ID: 8055484
30 days --> cookies only. Nor for me.

sessions won't last that long, and are closed when changinf browser's instance, so in 30 days and given Zindoze 's ability to "blouscrine"... Around 120 sessions in 30 days :D

you could have stated this in your originalquestion. I answered it 100% and now that was not what you wanted !

"ce qui se concoit bien s'enonce clairement,
et les mots pour le dire viennent aisement."
0
 

Author Comment

by:MirageSF
ID: 8055545
Sorry, youre right, I was just tired ! :)
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8055575
VGR i know cookie is worst and i never use it personally...
ha ha
0
 
LVL 15

Expert Comment

by:VGR
ID: 8055745
thanks, I'll cool down... perhaps adding some heat sinks to my exoskeleton...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question