Reply to Re: Need advice on which way is the best to pass variables

Your name:

Reply:


Posted by shimmyshack on 03/21/07 01:59

On 21 Mar, 00:46, "Vince Morgan" <vin...@REMOVEoptusnet.com.au> wrote:
> "Gladen Blackshield" <gla...@verizon.net> wrote in message
>
> news:Oe_Lh.9244$zx.4647@trndny05...
>
> > Hello All!
>
> > Still very new to PHP and I was wondering about the easiest and simplest
> way
> > to go about doing something for a project I am working on. I would simply
> > like advice on what I'm asking so I can go and learn it myself through
> doing
> > (best way for me).
>
> > I am building a card game as a learning-project as it involves many (to
> most
> > of the) things that I would like to learn to do with PHP.
>
> > This project is intended to be Flat-File only, no SQL connections. I'd
> much
> > rather not use cookies for this if at all possible.
>
> > The project involves loading different pictures on the top of the page
> while
> > the game is being played. That's easy enough to do, but it forces a
> refresh
> > when the picture changes.
>
> > which brings me to needing to find the porper solution to the following:
>
> > I am needing to keep roughly 12 or so variables tracked during the game.
> > This should be automatically parsed when the user clicks on 'DEAL' or
> > whatever to go to the next turn (going to the next turn would result in a
> > different picture being shown and thus force a refresh of the page)
>
> I think you should take a look at AJAX, or simply the "httprequest" object.
> That way you can send and recieve data from the server, and display it,
> without having to refresh the page.
> You could also create a session if you want your data to persist during the
> game.
> HTH
> Vince Moran

sessions are certainly your best bet, as 2 and 3 are essentially the
same (sessions are flat files), except the hard work is done for you
already.

if you intend your game to last across sessions (browser close /
logout etc...) then you will have to serialise the session data and
write to a flat file, and deserialise back into a session later. The
way you keep track of those files is up to.

you would write your app using $_SESSION['var_name'] instead of
$var_name, it's almost as simple as that, using sessions avoids
prediction attacks which might leave your game open to cheats (if you
didn't code sufficiently randomised filenames etc...), although in a
LAN environment, sessions are not enough protection from an ARP/proxy
cheater - but it all adds to the fun huh!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация