Can someone help me. I want to try make referral id. Is it in every page I should always receive the referral id and post it again ? Or I just create a cookies ? Or maybe there is another way. Can someone explain to me ? Thanks
| SitePoint Sponsor |

Can someone help me. I want to try make referral id. Is it in every page I should always receive the referral id and post it again ? Or I just create a cookies ? Or maybe there is another way. Can someone explain to me ? Thanks





Explain to us exactly what you're trying to accomplish (i.e "i have a list of products, and I need to pass the product ID to the next page when a link is clicked on") etc., or something like that.
Ultimately, you're going to learn QueryStrings in this post. How to send them, how to get them. How much do you know about querystrings before-hand?
This one sounds like fun, I'm in for this lesson, I might learn something(yes, I know querystrings, but I'm not sure I KNOW them
)

whoohoo querystrings![]()
uhm...yeah...![]()





Well, jet, what are you trying to do in your site? Give us a little description. Are you linking products or articles or something like that?
edited due to stupidity.

Thanks for replying.
I want to make a homepage to sell my product. Just like Amazon.com, people register to affiliate. After that they put a banner or link in their homepage with their affiliate number (example: http://www.myhomepage.com?affiliateid=a11001). So when people interest, it'll take to my homepage.
And what I want to ask is what is the best way to keep the 'affiliateid'. So when people browsing through my homepage (not register yet), I still can find out where they came from. And when they register, the 'affiliateid' is recorded.
I know about querystring. But I'm wondering what is the convenient way to do that.
I was thinking to create the 'affiliateid' to cookies. So when they register, I just get the cookies.
Is there any better way ? Thanks for comments and suggestions.

the easiest way to do it would enter the affliateid as a sessiob objejct, and then they registed, record it into a db![]()





(edited due to a slight misunderstanding)
Well, you obviously have your users database if you're having people sign up. I would suggest, in the orders table, including an optional "affiliateid" field.
If you know about global.asa, then what you do is go into global.asa and insert this code into the Sub Session_onStart area:This will save the affiliate ID for as long as a person has your site open (a.k.a they have an 'open session' with your site). Then, when someone registers, Check to see if the session value exists. If it does, add it into that 'affiliateid' field in your sales table.Code:If NOT Request.QueryString("affiliateid") = "" then Session("affiliateid") = Request.QueryString("affiliateid") End If
If you've any questions, just let me know.
Hope this helped.

Can you explain more about this or where I can find the reference. I don't know much about sesssion. And what's the benefit using session ?

I forget something...
I use web hosting service and I don't think they will let me to modify the global.asa





Session variables require less scripting to access than cookies. I don't have to go through the process of getting cookie values, I can simply say something likeSome handy articles on Sessions can be found here:Code:<% Response.Write Session("affiliateid") %>I hope this helps a little bit. If not, Someone else has to have some links on Session variables that they can lend to you.
- Pros and Cons of Session Variables
- Good article on global.asa, which you'll need to learn.
- More cons of session variables, slightly humorous as well
Good luck. If you can't find any articles, I'll show you how to use them, though I'm not the best. They should also be used sparingly (i.e don't use 20 of them, it will slow down your performance. 1 or 2 is alright).
'Till next time..





Well, jet, they SHOULD let you edit global.asa. It's included with every one of your web applications. It's just a text file. I can copy you a blank one if you'd like to paste in your home directory.
If they don't let you edit it, there's something fishy there. If you can't use session variables, you'll have to use cookies. And that's no fun, so much extra work.

Thanks a lot for your help.![]()
I'll try to read the articles first and ask to my webhosting provider how to use the global.asa.

but cookies are fun... spcially the chocolate chip kind
jet, who is ur host?
amd if you need help with cookies, dont hesitate to ask![]()




I would recommend using Cookies.. This way you would not only increase the number of affiliates..
This is the same method as CJ have..
[method]
When a visitor clicks your affiliates banner, he visits your website. and a cookie is set on the visitors compputer.. and is valid for the next one month...
after one month the cookie expires..
In the order table and the member ship table there should be an additional field known as affiliate.. in which the affiliates field would ke inserted if any..
[/method]
Any comments on the method ??
36Host.com - $36/year web hosting [affiliates earn 30%]
* Affordable Small Business Web Hosting since 2003! *
"500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
mysql, pre-installed php scripts, 24/7 support & more...."

yeah, user has cookies turned off
cookies are good for remembering people, and saving time to log in etc. but as for retaining information that has to be taken over pages it isnt the safest way. if you cant do it thru session objects, you best with thr querystring




There is always an alternate way...
you can always put up a note that Cookies have to be enabled in order to track affiliates..
or you can always use the querystrings method..
either one would work...
it all depends on you...
' Happy Coding![]()
36Host.com - $36/year web hosting [affiliates earn 30%]
* Affordable Small Business Web Hosting since 2003! *
"500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
mysql, pre-installed php scripts, 24/7 support & more...."

I assume everybody enabled to receive cookies. But if the visitors already sign, then automatically the cookies will be delete. So when the next time they visite my homepage again. The affiliateid will no longer stay (either they sign or not sign). But this is still my theory.
About querystring, that mean in every page in my site I have to put the request.querystring("affiliateid") and <input type=hidden name="affiliateid" value="request.querystring("affiliateid")">
Is that right ?
As the discussion before, it seem session is the best way to do this job.

not really, jus make each link look likeAbout querystring, that mean in every page in my site I have to put the request.querystring("affiliateid") and <input type=hidden name="affiliateid" value="request.querystring("affiliateid")">
Is that right ?
Code:<a href="blah.asp<%if len(request.querystring("affiliateid")) > 1 then response.write("?" & request.querystring("affiliateid"))%>">Blah</a>![]()

Is that mean that I have put the
<%if len(request.querystring("affiliateid")) > 1 then response.write("?" & request.querystring("affiliateid"))%>
after every links ?

uhm... yeah... so sessions is the easiest way![]()
Bookmarks