script error

03moscropl

Flash Freak
Messages
698
Reaction score
0
Points
0
i have a proplem with a script i modified for phpnuke rather that post nuke it comes up put in the module postion it shows.

Code:
 [b]Warning[/b]: opendir(modules//games): failed to open dir: No such file or directory in [b]/home/igamer/public_html/site/modules/MiniClip_Games/index.php[/b] on line [b]23[/b]

[b]Warning[/b]: readdir(): supplied argument is not a valid Directory resource in [b]/home/igamer/public_html/site/modules/MiniClip_Games/index.php[/b] on line [b]24[/b]

[b]Warning[/b]: closedir(): supplied argument is not a valid Directory resource in [b]/home/igamer/public_html/site/modules/MiniClip_Games/index.php[/b] on line [b]29[/b]

here is the phpfile
PHP:
<?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
	die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
$pagetitle = "mini clip games";

$modimagefolder = "modules/$ModName/images";
$modgamefolder = "modules/$ModName/games";
// Set $index = 1 to enable right column
$index = 0;
function menu() {
 global $modimagefolder, $modgamefolder, $ModName;
	include("header.php");
	OpenTable();
 $dh = opendir($modgamefolder);
 while ($dir = readdir($dh)) { 
  if (!is_dir("modules/".$dir)  && ($dir != '.') && ($dir != '..')) {
   echo " <a href=\"modules.php?op=modload&name=$ModName&file=index&game=$dir&func=playgame\"><img src=\"$modgamefolder/$dir/$dir.gif\" height=\"70\" border=\"0\"></a> ";
  }
 }  
 closedir($dh);
 echo "</td></tr><tr><td align=\"center\"><a href=\"modules.php?op=modload&name=$ModName&file=index&func=credits\">"._MINICLIPGAMESMESSAGE."</a>";
	CloseTable();
	include("footer.php");
}
function playgame() {
 global $modgamefolder, $game, $ModName;
	include("header.php");
	OpenTable();
 echo "<a href=\"modules.php?op=modload&name=$ModName&file=index\">Game Index</a> :: $game"
 ."</td></tr><tr><td align=\"center\">"
 ."<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"550\" height=\"360\">\n"
 ."<param name=\"movie\" value=\"$modgamefolder/$game/$game.swf\">"
 ."<param name=\"quality\" value=\"high\">"
 ."<embed src=\"$modgamefolder/$game/$game.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"550\" height=\"360\">\n"
 ."</embed>\n"
 ."</object>"
 ."</td></tr><tr><td align=\"center\"><a href=\"modules.php?op=modload&name=$ModName&file=index&func=credits\">"._MINICLIPGAMESMESSAGE."</a>";
	CloseTable();
	include("footer.php");
}
function modcredits() {
 include("header.php");
 OpenTable();
 echo "<p align=\"center\"><br>This module is brought to you by <a href=\"mailto:burke@dimensionquest.net\">Burke</a> @ <a href=\"http://www.dimensionquest.net\">dimensionquest.net</a>!<br><br>"
 ."These games are provided as \"Free games for your website\" by <a href=\"http://www.miniclip.com\">Miniclip.com</a><br><br>"
 ."Miniclip files were only renamed in the making of this module to provide naming consistancy between Folder/Flash/Image filenames</p><br>";
 CloseTable();
 include("footer.php");
}
switch($func) {
	default:
	menu();
	break;
	
	case "playgame":
	playgame();
	break;
 
 case "credits";
 modcredits();
 break;
}
?>
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Well obviously, the error is because the directory you are trying to open doesn't exist.

I, myself, cannot test the script and try to fix it, (Because it would take a good amount of time to set it all up and get it working.), but what did you change it in before you saved it? Like I said, it's saying teh directory could not be found, thus you get the error's from opendir(), readdir(), and closedir(). Check all of the names that you are using, and make sure you have the right names of the directories/folders.
 

ak007

Member
Messages
216
Reaction score
0
Points
16
i Don't Use That Buggy Stuff So I Dont Know What Are Are You Talking About I Mean Can You Give me More info About The Directory Structure?

BTW Heres Some Modification Version of That Script:
PHP:
 <?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
	die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
$pagetitle = "mini clip games";

$modimagefolder = "./modules/$ModName/images";
$modgamefolder = "./modules/$ModName/games";
// Set $index = 1 to enable right column
$index = 0;
function menu() {
 global $modimagefolder, $modgamefolder, $ModName;
	include("header.php");
	OpenTable();
 $dh = opendir($modgamefolder);
 while ($dir = readdir($dh)) { 
  if (!is_dir("modules/".$dir)  && ($dir != '.') && ($dir != '..')) {
   echo " <a href=\"modules.php?op=modload&name=$ModName&file=index&game=$dir&func=playgame\"><img src=\"$modgamefolder/$dir/$dir.gif\" height=\"70\" border=\"0\"></a> ";
  }
 }  
 closedir($dh);
 echo "</td></tr><tr><td align=\"center\"><a href=\"modules.php?op=modload&name=$ModName&file=index&func=credits\">"._MINICLIPGAMESMESSAGE."</a>";
	CloseTable();
	include("footer.php");
}
function playgame() {
 global $modgamefolder, $game, $ModName;
	include("header.php");
	OpenTable();
 echo "<a href=\"modules.php?op=modload&name=$ModName&file=index\">Game Index</a> :: $game"
 ."</td></tr><tr><td align=\"center\">"
 ."<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"550\" height=\"360\">\n"
 ."<param name=\"movie\" value=\"$modgamefolder/$game/$game.swf\">"
 ."<param name=\"quality\" value=\"high\">"
 ."<embed src=\"$modgamefolder/$game/$game.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"550\" height=\"360\">\n"
 ."</embed>\n"
 ."</object>"
 ."</td></tr><tr><td align=\"center\"><a href=\"modules.php?op=modload&name=$ModName&file=index&func=credits\">"._MINICLIPGAMESMESSAGE."</a>";
	CloseTable();
	include("footer.php");
}
function modcredits() {
 include("header.php");
 OpenTable();
 echo "<p align=\"center\"><br>This module is brought to you by <a href=\"mailto:burke@dimensionquest.net\">Burke</a> @ <a href=\"http://www.dimensionquest.net\">dimensionquest.net</a>!<br><br>"
 ."These games are provided as \"Free games for your website\" by <a href=\"http://www.miniclip.com\">Miniclip.com</a><br><br>"
 ."Miniclip files were only renamed in the making of this module to provide naming consistancy between Folder/Flash/Image filenames</p><br>";
 CloseTable();
 include("footer.php");
}
switch($func) {
	default:
	menu();
	break;
	
	case "playgame":
	playgame();
	break;
 
 case "credits";
 modcredits();
 break;
}
?>
 

03moscropl

Flash Freak
Messages
698
Reaction score
0
Points
0
it says
Warning: opendir(./modules//games): failed to open dir: No such file or directory in /home/igamer/public_html/site/modules/MiniClip_Games/index.php on line 17

Warning: readdir(): supplied argument is not a valid Directory resource in /home/igamer/public_html/site/modules/MiniClip_Games/index.php on line 18

Warning: closedir(): supplied argument is not a valid Directory resource in /home/igamer/public_html/site/modules/MiniClip_Games/index.php on line 23



the directory sytem works by having the foder names as the game names e.g

folder "pacman" inside are
pacman.gif
pacman.swf

then on the home page it has the image then when you clikc it it takes you to the game.

by the way if you or any one can fix it i will donate 100 points to you
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
03moscropl said:

by the way if you or any one can fix it i will donate 100 points to you

I would help, but the only thing I can think of, is to check the directories, and make sure all the names are correct. Also, I used mkdir() the other day, and found that I needed to have the FULL name of the directory, going from:

/home/nedren/public_html/

As my web root.

Maybe that's your problem?
 

03moscropl

Flash Freak
Messages
698
Reaction score
0
Points
0
i know it isnt that due to this part

PHP:
"./modules/$ModName/images";
		"./modules/$ModName/games";

is the dodule name of it and if it can find minclipgames//games folder it is mostlikly to be a script error.
 

03moscropl

Flash Freak
Messages
698
Reaction score
0
Points
0
found the bug $ModName

was causing it.


but you were the only 2 that helps so i dontated 20 points each.
 
Top