php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20375 OpenDir: Invalid argument (errno 22) when setting var to a mappend net drive
Submitted: 2002-11-11 18:19 UTC Modified: 2002-11-26 20:00 UTC
Votes:8
Avg. Score:3.5 ± 0.9
Reproduced:7 of 8 (87.5%)
Same Version:4 (57.1%)
Same OS:2 (28.6%)
From: xenosis2000 at hotmail dot com Assigned:
Status: No Feedback Package: Directory function related
PHP Version: 4.2.3 OS: Windows 2000 Adv. Server
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-11-11 18:19 UTC] xenosis2000 at hotmail dot com
Just a side note: I have tried setting $logpath to a number of different options with no success.
s:\UT2003Server\System\
s:\\UT2003Server\\System\\
s:\UT2003~2\System\
s:\UT2003~2\System
s:\\UT2003~2\\System\\
s:\\UT2003~2\\System
s:/UT2003~2/System/
s://UT2003~2//System//
s:/UT2003~2/System

The url i access is: http://myweb.com/localstats/utlogs.php?pass=mypass

Here is the relavent code to what I am running:

filename: config.inc.php
<?php

require("./utstatsdb.inc.php");
$logpath = "s:\\UT2003~2\\System\\";
$title_msg = "Unreal Tournament 2003 LocalStats Server";

?>


filename: utlogs.php
<?php

/*
    UT2003 StatsDB
    Copyright (C) 2002  Paul Gallier

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

require("config.inc.php");
require("utlogsql.php");

$magic = get_magic_quotes_gpc();
if ($magic) {
  $password = stripslashes($_GET["pass"]);
  $save = stripslashes($_GET["savelogs"]);
}
else {
  $password = $_GET["pass"];
  $save = $_GET["savelogs"];
}

if ($password == "" || $AdminPass == "" || $password != $AdminPass) {
  echo "Access error.<br>";
  exit;
}

require("utlogparse.php");
require("utlogsave.php");

$files = 0;
$logs_saved = 0;
$handle=opendir($logpath);
while (($file = readdir($handle)) != false) {
  if (strstr($file, "LocalStats_") && substr($file, -4) == ".txt") { // LocalStats format
    $tok = strtok($file, "_"); // 'LocalStats'
    if ($tok != "") {
      $tok = strtok("_"); // <port>
    if ($tok != "") {
      $tok = strtok("_"); // <year>
      $fd_year = (int) $tok;
    if ($tok != "") {
      $tok = strtok("_"); // <month>
      $fd_month = (int) $tok;
    if ($tok != "") {
      $tok = strtok("_"); // <day>
      $fd_day = (int) $tok;
    if ($tok != "") {
      $tok = strtok("_"); // <hour>
      $fd_hour = (int) $tok;
    if ($tok != "") {
      $tok = strtok("_"); // <min>
      $fd_min = (int) $tok;
    if ($tok != "") {
      $tok = strtok("."); // <sec>
      $fd_sec = (int) $tok;
      $fdate = sprintf("%04u-%02u-%02u %02u:%02u:%02u", $fd_year, $fd_month, $fd_day,
                        $fd_hour, $fd_min, $fd_sec); // 2001-12-08 18:52:15
      $logs[$files] = $file;
      $logdate[$files++] = $fdate;
    }}}}}}}
  }
  else if (strlen($file) >= 18 && strlen($file) <= 23 && substr($file, -4) == ".txt") { // MutLocalLog format
    $tok = strtok($file, "-"); // <year>
    $fd_year = (int) $tok;
    if ($tok != "") {
      $tok = strtok("-"); // <month>
      $fd_month = (int) $tok;
    if ($tok != "") {
      $tok = strtok("-"); // <day>
      $fd_day = (int) $tok;
    if ($tok != "") {
      $tok = strtok("-"); // <hour>
      $fd_hour = (int) $tok;
    if ($tok != "") {
      $tok = strtok("-"); // <min>
      $fd_min = (int) $tok;
    if ($tok != "") {
      $tok = strtok("."); // <sec>
      $fd_sec = (int) $tok;
      $fdate = sprintf("%04u-%02u-%02u %02u:%02u:%02u", $fd_year, $fd_month, $fd_day,
                        $fd_hour, $fd_min, $fd_sec); // 2001-12-08 18:52:15
      $logs[$files] = $file;
      $logdate[$files++] = $fdate;
    }}}}}
  }
}
closedir($handle); 
array_multisort($logdate, $logs, SORT_NUMERIC, SORT_ASC);

for ($i = 0; $i < $files; $i++) {
  echo "Processing log '$logs[$i]'....";
  $file = $logpath."/".$logs[$i];
  $logfile = file($file);
  if (parselog($logfile) == 1) {
    if (storedata())
      echo "game $gamenum successfully processed.<br>\n";
    else
      echo "not processed.<br>\n";
    $logs_saved++;
    if (!$save)
      unlink($file);
  } else {
    if ($i < $files - 1) {
      echo "incomplete.<br>\n";
      if (!$save)
        unlink($file);
    }
    else {
      echo "incomplete (in session?).<br>\n";
    }
  }
//  flush(); *tag*
}

if (!$files)
  echo "<br>No log files to process.<br>\n";
else {
  echo "<br>$logs_saved of $files logs processed.<br>\n";
  // Check career highs for each user
  echo "<br>Calculating Career Highs....";
  require("utcalchighs.php");
  echo "Finished.<br>\n";
}

?>





Here is the errors:

Warning: OpenDir: Invalid argument (errno 22) in c:\inetpub\wwwroot\localstats\utlogs.php on line 45

Warning: readdir(): supplied argument is not a valid Directory resource in c:\inetpub\wwwroot\localstats\utlogs.php on line 46

Warning: closedir(): supplied argument is not a valid Directory resource in c:\inetpub\wwwroot\localstats\utlogs.php on line 100

Warning: Argument 1 to array_multisort() is expected to be an array or a sort flag in c:\inetpub\wwwroot\localstats\utlogs.php on line 101

No log files to process.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-11 18:21 UTC] xenosis2000 at hotmail dot com
It is worth me saying that everthing works fine if I point it to a local drive and dir on c:

And permissions are ok because I can access the drive from a dos prompt or windows explorer and read/write files.
 [2002-11-13 20:22 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-11-26 20:00 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 02:01:23 2020 UTC