SunQuest
           Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old April 11th, 2003, 11:50 PM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[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.

Reply With Quote
  #2  
Old April 12th, 2003, 12:14 AM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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)

Reply With Quote
  #3  
Old April 12th, 2003, 12:34 AM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
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>");

Reply With Quote
  #4  
Old April 12th, 2003, 12:38 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: RE: [trilite] fopen


Quote:
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?


how is it not working?


Reply With Quote
  #5  
Old April 12th, 2003, 03:36 AM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
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)

Reply With Quote
  #6  
Old April 12th, 2003, 11:04 AM
nodream nodream is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Norway
Posts: 22 nodream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 59 sec
Reputation Power: 0
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)....


Reply With Quote
  #7  
Old April 12th, 2003, 02:06 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: [trilite] fopen

Quote:
I also found an error in the judge script:

Sorry about that...fixed.

Reply With Quote
  #8  
Old April 12th, 2003, 02:06 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: RE: [trilite] fopen


Quote:
Oh, I get what you did now!
And I must say, it seems kinda hackish, lol!


And how would you recommend implenting aging like that?

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [trilite] fopen


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway