Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Referrer ID's being passed page to page

Posted on 2003-03-02
14
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

636 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