|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
[trilite] fopen
Argg...
I'm banging my head on this. I'm using Win XP Pro + Apache + PHP 4.2.3 It keeps stalling when I try to do file() (it seems to only not work on http://localhost/) But, I can do fopen("http://localhost/script.php", "r"), but then I can't do fread either I can do fopen() and then a file(), but then my script gets called twice. |
|
#2
|
|||
|
|||
|
RE: [trilite] fopen
Very, very weird...
I can do fopen on a directory, but NOT on a file: $script="http://localhost/localPHP/trilite/scripta"; //will work fine $script="http://localhost/localPHP/trilite/scripta.php"; //will stall forever Now, the problem is that I can't do .../scripta/?start=1 (but I think I can do some url-rewriting in .htaccess) |
|
#3
|
|||
|
|||
|
RE: [trilite] fopen
Finally figured it out...
Using fopen, and reading line-by-line... it must not be sending a proper EOF signal; I remember I also had this problem reading from a telnet fopen. On another note, it seems Matt's judging script doesn't work correctly. Did I change too much or is the script just not working? I didn't get his logic, so I added another session variable that counts the total number of moves played... if ( !isset($_SESSION['start']) || !isset($_SESSION['count'])) die("Click <a href="$PHP_SELF?start=1">here to start</a>"); |
|
#4
|
|||
|
|||
|
RE: RE: [trilite] fopen
Quote:
how is it not working? |
|
#5
|
|||
|
|||
|
RE: [trilite] fopen
Oh, I get what you did now!
And I must say, it seems kinda hackish, lol! Incrementing 11-13, or 21-23... I think I went a bit overboard w/ OOP, though, so that's why I avoid storing multiple data into single arrays like that (at least for this contest, since run-time shouldn't be a problem) |
|
#6
|
|||
|
|||
|
RE: [trilite] fopen
I also found an error in the judge script:
Code:
if(isset($_GET['start'])) {
$j = new TriliteJudge(1);
$p = 1;
$script = $player[1] . '?start=1';
$_SESSION['start'] = 1;
} else {
$j = new TriliteJudge();
$p = $_GET['p'];
$lastmove = $_SESSION['lastmove'];
if(isset($_SESSION['start'])) {
$script = $player[$p] . "?lastmove=$lastmove&start=1";
} else {
$script = $player[$p] . "?lastmove=$lastmove";
}
}
Shuld be : Code:
if(isset($_GET['start'])) {
$j = new TriliteJudge(1);
$p = 1;
$script = $player[1] . '?start=1';
$_SESSION['start'] = 1;
} else {
$j = new TriliteJudge();
$p = $_GET['p'];
$lastmove = $_SESSION['lastmove'];
if(isset($_SESSION['start'])) {
$script = $player[$p] . "?lastmove=$lastmove&start=1";
} else {
$script = $player[$p] . "?lastmove=$lastmove";
}
unset($_SESSION['start']);
}
If this cahnge isn't done the scripts will at all time be called whit &start=1 in the url. At least this was what my computed did (PHP 4.3.0).... |
|
#7
|
|||
|
|||
|
RE: [trilite] fopen
Quote:
Sorry about that...fixed. |
|
#8
|
|||
|
|||
|
RE: RE: [trilite] fopen
Quote:
And how would you recommend implenting aging like that? |
![]() |
| Viewing: Codewalkers Forums > PHP Contests > Older Contests > [trilite] fopen |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|