
April 18th, 2003, 09:11 PM
|
|
|
|
Join Date: Apr 2007
Location: Nieuw Vennep ,Netherlands
Posts: 108
Time spent in forums: < 1 sec
Reputation Power: 2
|
|
|
RE: [Trilite] newbie q :)
Question 1:
Yes it looks like your script is called from a form using the get method. Your script is called from the judge script in an url like
http://localhost/trittle.php?lastmove=1
and in your script if you put
php Code:
Original
- php Code |
|
|
|
it would print '1'
Question 2:
I think using SQL would give Matt a lot more work on the judging. he would have to create databases and give access to scripts. Make sure scripts dont use the same tables enz.
so i think SQL will not be allowed
My guess is you want SQL for storing variables that you can access the next time you run the script. So i included a script that shows ho to do that using serailize. Nothing fancy, just enough to get you started.
Good luck in the game ;)
php Code:
Original
- php Code |
|
|
|
<? $boardfilename='board.txt'; /* see if we have a file with settings */ { if (! $handle = fopen($boardfilename, 'r')) die("Cannot open file ($boardfilename)"); /* here we read the board into $board */ die("Cannot read from file ($boardfilename)"); } else { /* if the file was not there initialize the board */ $board= array(0, 0, 0, 0, 0, 0, 0, 0, 0, "turn" => 0); } /* increase turn */ $board['turn']++; /* turn should be 1 the first time you run the script and increase every run after that */ /* write our settings for next run */ if (! $handle = fopen($boardfilename, 'w')) die("Cannot open file ($boardfilename)"); die("Cannot write to file ($boardfilename)"); ?>
|