Getting ERROR 200, When using .inc as extension ?

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
buddha
-


Joined: 19 Aug 2003
Posts: 4
Location: Sweden

PostPosted: Tue Aug 19, 2003 7:14 pm    Post subject: Getting ERROR 200, When using .inc as extension ? Reply with quote

Hi all, just love the server everything works fine but........

Cant use a include with .inc as extension ?
it works fine on my live server ( diffrent config )

This is the include:

<? include "http://localhost/scripts/menu.inc"; menu("2"); ?>

Getting this error:

Error 200
OK

--------------------------------------------------------------------------------
Abyss Web Server X1 Update 1
© Aprelium Technologies - 2001-2003


Fatal error: Call to undefined function: menu() in C:\Program\Abyss Web Server\htdocs\tjanster\index.php on line 17

Can someone please tell me whats wrong, it works fine on:

www.sitsonline.net

This is the compleate script, grab if you whant :)



<?php

function menu ($type) {
function echo_link($art, $link, $text, $type) {
$col = "#303030"; // Color of a standard entry
// $logo = "&#149";
$logo = "<img SRC=http://www.sitsonline.net/images/icons/mainnavspacer.gif border=0>"; // Pictur of standard entry
if ($art=="0") {$col = "#303030";$logo = "<img SRC=/images/12x12.gif border=0>";} // Home
if ($art=="1") {$col = "#303030";$logo = "<img SRC=/images/icons/arrowback.gif border=0>";} // Tillbaka - Upp
if ($art=="2") {$col = "#303030";$logo = "<img SRC=http://www.sitsonline.net/images/icons/mainnavspacer.gif border=0>";} // The Index-File in the directory
if ($art=="3") {$col = "#303030";$logo = "<img SRC=http://www.sitsonline.net/images/icons//mainnavspacer.gif border=0>";} // Sub-Folders
if ($art=="4") {$col = "#FF9900";$logo = "<img SRC=http://www.sitsonline.net/images/icons/selectedfile.gif border=0>";} // Currently selected File

// Die Druckspalte vertikal - printed entry for a vertical column
If ($type == "1")
echo "<tr><td align=right><a href=\"$link\">$logo</td><td><font size=\"-2\"><a href=\"$link\" style=\"text-decoration: none; color: $col;\" >$text</a></font></td></tr>\r";

// Horizontal
else
echo "<font size=\"-2\"><a href=\"$link\" style=\"text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; color: $col;\" >&nbsp;$logo&nbsp;$text</a></font>\r";
}

// -------------------- Main programm starts here ---------------------------


// *** Define horizontal or vertical layout ***
// Okay, let's open the TABLE and define size, background color etc
If ($type == "1")
echo "<table bgcolor=\"#D1D1E9\" width = \"150\" border =\" 0\"><tr><td>";
else
echo "<table bgcolor=\"F7F7F7\" width = \"100%\"><tr><td>";

// Now, the "home" and "up" link

// echo_link("0", "http://www.sitsonline.net", "Home",$type);
echo_link("1", "../", "TIllbaka",$type); // Upwards Link

/* If you're including this script from a function, you'll need
to make $SCRIPT_FILENAME a global variable. */

// if (!$SCRIPT_FILENAME)
global $SCRIPT_FILENAME;

// We'll have to loop through all the files in the current directory
$d = dir(dirname($SCRIPT_FILENAME));
while($file=$d->read()){

// ************* FILTER files and directories **************
$wahl = "J"; // not selected a standard
if (is_dir($file)) {$wahl = "J";} // Select if Directory
if (eregi("php", $file)){$wahl = "J"; } // Select if PHP3 - take HTM HTML or whatever you need
$rest = substr ($file, 0, 1);
if ($rest == "_") {$wahl = "N";} // deselect if starts with "_" or "."
if ($rest == ".") {$wahl = "N";}

if ($wahl =="J") {
// ------------- Takes Subdirectories here ----------------
if (is_dir($file))
{
$xbuild = "3"."|".$file."|".$file."|3"; // Build print line for DIRECTORY files: Sorting = 3, Type is also 3
$xline[] = $xbuild;
}
else {
// -------------------- normale file -----------------
$fp = fopen("$file", "r"); // Not a directory file -> normal file
$build = "";
$line = "";
$flag = 0;
$i = 0;
while (($i < 20)and (!feof ($fp)) ) {
$i = $i +1;

$line = fgets($fp, 1024);
$lineup = strtoupper($line); // search in uppercase string

/* The <TITLE> tag MUST be opened at the beginning of a new line */
if (ereg("^<TITLE>", $lineup))
{$flag = 1;
$build = substr($line,1,100); // Maximal 100 chars
}
if ($flag == 1)
{$build = $build.$line;
}
if (ereg("</TITLE>", $lineup))
{$flag = 0;
}
$flag = 0;

}
$lineup = strtoupper($build);
if ($build > ""):
$start = strpos($lineup,"TITLE");
$end = strpos($lineup,"</TITLE>");
$laenge = $end - $start - 6;
$build = substr($build,$start + 6,$laenge);

$xsort ="5"; // File sorting is standard
$xtype ="5"; // File type is standard

// Currently Selected File is treated differently
if ($file == basename($SCRIPT_FILENAME)){$xtype = "4";}

// Index-File File is treated differently
$pos = strpos ("1".strtoupper($file), "INDEX.");
if ($pos == 1){$xsort = "2";$xtype = "2";}

$buildline = $xsort."|".$build."|".$file."|".$xtype; // build line
// echo $buildline;
$xline[] = $buildline;

endif;
}
}
}

// and finally, close the directory
$d->close();


// ------------------ now sort the whole thing following code + Title
sort ($xline);
reset ($xline);
while (list ($key, $val) = each ($xline)) {
$pieces = explode ("|", $val); // restore original values for type, filename and title
echo_link($pieces[3], $pieces[2], $pieces[1],$type);
}

// To finish off the bar - you may add links for example
// echo_link("5", "http://www.sitsonline.net","Links",$type);

// Close Table
echo "</td></TR></table>";

};
?> :?
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Aug 20, 2003 12:23 pm    Post subject: Re: Getting ERROR 200, When using .inc as extension ? Reply with quote

This is a PHP issue. PHP sent nothing to the server so it generated error 200 to inform you about the situation.

It seems that your PHP was unable to include the URL http://localhost/scripts/menu.inc, so if this URL points to your server, it is better to use the real path of menu.inc on your hard drive:
For example:

Code:
<? include "c:/website/scripts/menu.inc"; menu("2"); ?>

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
buddha
-


Joined: 19 Aug 2003
Posts: 4
Location: Sweden

PostPosted: Wed Aug 20, 2003 6:25 pm    Post subject: Grrr :( Still cant make it work, any sugestions ! Reply with quote

Thank you verry much for a quick response !

Now getting this error:

Fatal error: Call to a member function on a non-object in C:\Program\Abyss Web Server\htdocs\scripts\menu.inc on line 46

I used:

<? include "C:/Program/Abyss Web Server/htdocs/scripts/menu.inc"; menu("2"); ?>

This is line 46:

// We'll have to loop through all the files in the current directory
$d = dir(dirname($SCRIPT_FILENAME));
//Line46// while($file=$d->read()){


Its only this include using .inc that doesnt work ??


Buuuu :( Help Some one.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Aug 21, 2003 3:26 pm    Post subject: Re: Grrr :( Still cant make it work, any sugestions ! Reply with quote

The error you get is a PHP error related to your code. It means that the object $d has no method called read().
This happens when the dir() function returns an empty object in $d because the path is was asked to deal with is not existant. So review your code and check the return value of $d before reading its contents.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group