Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Advice for passing 15-20 values across php pages

    Here's my scenario:

    I'm creating a mini-game on my site where users can compete against each other. I have an initiate page, where you get a listing of your stats and your opponent's and a link to initiate the event. This link goes to an immediately redirecting page that enters the results of the event into the database. The redirect ends up at a results page.

    event.php?initiate -> event.php?enterdb -> event.php?showresults

    Assuming that I have around 15-20 values to pass across to the enterdb and showresults pages, what is the best way to go about this?

    The options that I know of are:

    - put all the values in the url query string (which would be quite lengthy)
    - put all the values into an array and serialize/unserialize
    - put all the values into a session and destroy it upon reaching the results page
    - do one of the above to get the values to the enterdb page, and make a call to the database on the showresults page

    Things I want to take into consideration:

    - code speed/minimizing database calls
    - protecting the values coming into the enterdb page to prevent abuse (entering custom values)

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    2 & 3 , serialize the data, store it in a session, the only `errr` is how much data are we talking about? , if its 15 or 20 mostly numeric values and small strings then thats probably fine, if you had fulltext data to pass around I would probably be putting that in the DB or a seperate flatfile.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, firepages.

    Almost all of the values are numeric. How server-intensive are sessions (assuming I'm only going to keep these particular ones open for a second or two)?

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    They are not server-intensive as such (there could be some limits on the size of the session tmp directoy (unless you make your own session handler)) and you can keep lots of data in them thought they are primarily for keeping state in a stateless environment, there are better methods for storing fulltext & markup etc.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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