Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4584688
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:23:22+00:00 2026-05-21T21:23:22+00:00

I’m pretty new to PHP and MySQL. I’m interested in setting up a very

  • 0

I’m pretty new to PHP and MySQL. I’m interested in setting up a very simple affiliate program. It basically needs to be setup so that when someone clicks on the affiliate link it stays with the user until he/she signs up with my website.

So for example, I want to create some nice looking webpages that my affiliates could use to advertise my site. The URLs would look something like this (ideally).
http://www.mysite.com/splash1.php?userid=Joe

So in this case, my affiliate, Joe, could use http://www.mysite.com/splash1.php and append ?userid=Joe and he would have an affiliate link.

From here, people could click on the link in this splash page which would bring them to the home page for my website and retain that affiliate ID. Also, if the user decides to browse around my site before signing up, I would like to make sure the affiliate ID sticks with the user throughout until he/she decides to signup.

I’m familiar with reading in the userid from the URL just not to familiar with how, best to pass that userid variable from page to page.

I’m not to concerned at this point with all the functions that come into play with the affiliate program, like comissions, showing affiliate stats, and all the other fancy stuff. I just want to make sure the persons affiliate ID sticks with the user up to the point he/she clicks “submit” to signup for my website.

I know I’m going to probably have to use cookies and/or sessions. just not sure which route to go.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:23:23+00:00Added an answer on May 21, 2026 at 9:23 pm

    Building affiliate software is no small undertaking, especially for someone who is new to both PHP and MySQL. You could debate the implementations all day long, but basically the steps for how the program works are something like this:

    1. User clicks link
    2. You write cookie to user, and redirect that user to the “client.” We’ll use the term client to refer to the person or company that is actually doing something with your user. You will typically want to add something to the URL since you can’t write cookies for a domain the user is not on, and you (or other sites) can not access cookies written for another domain. (This is Browser Security Protocol).

      After this point, you will need some kind of relationship with the client, so you can tell them what data they should be looking for in order to identify a user coming for an affiliate, and know that they have to send that back to you.

    3. You then have to set up a way for your client to tell you that the user has completed a registration (or whatever other action is required, often called a conversion).

    The process itself is pretty simple, it’s just a lot of data tracking. You essentially just need to be able to track any single conversion back to a specific click, and identify where it came from to give the appropriate affiliate credit. To do this, all you need to do is be a middle-man between the click and the redirect to the client, and add something to the URL so the client can tell you if that unique ID converted.

    If you need to identify unique users within your system, outside of the client and across multiple affiliates, that’s when you’d deploy cookies. Sessions are useless, because they are also a cookie – but are much more temporal and get destroyed with the browser exits.

    If you are writing the client code (basically, accepting users from affiliates) you will want to initialize a long-term cookie (or a short term session, it depends on how much “time” you want to give your affiliate to get credit for a user which clicks their link). Once the user completes the action you want them to complete (converts) you tell the affiliate provider about it (using the unique ID they gave you) and they handle giving credit back to the affiliate.

    I hope that all make sense, and hopefully sheds some light / gets you started in the right direction. Like I said, a marginally difficult first project for a novice, but certainly not impossible. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.