SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    Mar 2003
    Location
    philly
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation using PHP to populate text links

    Currently, we have about 200,000 visitors a day coming to us across 20 different URLs.

    Each URL is almost identical, with 60 text links on each. The only difference is that every text link has a unique affiliate ID appended to the end of it.

    Each time we create a new URL, we do a “find all, replace all” and add a new affiliate ID to each text link, and then we save the page as a unique URL. This allows us to have identical sites with unique IDs in each link for each unique affiliate…

    The problem with doing this is that when we want to change our pages, we have to do it on all 20, which makes us not ever want to make any changes

    We are strongly considering placing each URL on a single page, and then adding a question mark to the URL, and php code to the end of each link. This will allow us to have all 20 of our URLS at the same URL, and each can still have unique text links…

    Will this tax our dedicated server; and slow down our site...

    Meaning, currently, our 200,000 daily visitors go to a URL with links already determined. However, if we do this, each time a user visits a URL; our server will have to populate each link based on the ID after the question mark after the URL.

    50 links, 200,000 visitors, that's adding 10 million entries a day, when we currently have none...

    Will this slow down our site, tax our server, or even take up bandwidth?

    Evan

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe an example?
    John

  3. #3
    SitePoint Member
    Join Date
    Mar 2003
    Location
    philly
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically, there is a site with 50 text links. Currently, the end of each links looks like this
    php?mt=keyword&affid=265"

    If I implement these changes, the end of each link will look like this
    php?mt=TV&affid=<?=$_GET['affid']?>"

    and then, in the URL, I will put affid=265; so that each link is populated based on what the user has inputed...

    Thanks,
    Evan

  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me see if I understand.
    You have a user come to the site and log on? Their information is retrieved and links are generated based on that information using the "?affid=[number]" suffix to each of the text links?

    And right now you have all of this links hard-coded into the pages?

    And what you want to do is generate each of these links dynamically, based on the logged in user?
    John

  5. #5
    SitePoint Member
    Join Date
    Mar 2003
    Location
    philly
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One of my partners sends me a user...
    Currnetly, I send the user to mysite.com/1.shtml and hard code all of the links onto the page
    However, I am considering sending the user to mysite.com/?&affid=1

    The second solution, with PHP allows me to have the same URL, giving me a simpler system, and I don't have to hard code any links..However, by doing it the second way, each link looks like this
    php?mt=keyword&affid=<?=$_GET['affid']?>"
    and I worry that it may slow down my server if it has to continuously populate 50 links every time a user visits my site...

    make sense?

  6. #6
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems that you can either,
    • hard code the links
    • dynamically build the links
    You've already tried the first and found that it is a bear to maintain, so try the second. After all, that is one of the major reasons such languages were created!

    If your server can't handle it, then you may need to upgrade your server or go back to the hard coding of the links.
    John

  7. #7
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If your server can't handle echoing 50 variables, then there's a problem
    Mike
    It's not who I am underneath, but what I do that defines me.

  8. #8
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got your message, and decided to reply publicly, in case someone else ran in to the same problem.

    There is another way.

    If these links only need to be generated for a new user, and they don't change for that user (unless you add a new link), you may want to write a script for your back-end that builds the pages and then SAVES them as an HTML page.

    This means that the script actually hard codes the links for the page for each individual user, and then the user accesses the hard coded pages, not the script that generates the links.

    Does that make any sense to you?
    John

  9. #9
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you may be onto something here ? This would work but based on 200,000 users/visiters ?

    The scripting wouldn't be a problem; and it proberly wouldn't add that much overhead on your server, though the problem could be the number of visiters - 200,000 is a lot since your generating a page per visiter, thus could take some storage for all those pages me thinks

  10. #10
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I thought that too. I guess it comes down to a choice between processor time or disk space.
    John

  11. #11
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Although there might be a way of using PHP and GZIP (is it ? not sure myself) to compress each page, or a number of pages ?

    The pages then would proberly be de-compressed automatically anyway by whatever browser someone has as well.

    Maybe have a look at the manual I suppose.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •