The dreaded 'URL file-access'

apps

#1

To begin : yes I’ve used the search function, but I’m a bit overwhelmed by what I’m reading so far.

The thing is : I’m trying to use a script that has uses this php function. As dreamhost has disabled this for security reasons, a custom php compile goes out the window as far as I’m concerned.

My php skills are fairly non-existent , I’ve gained some experience from adding mods to php/punbb forums but that seems to be a LONG way from rewriting the code to a cUrl alternative.

so I’m asking the resident Php gurus for a guiding hand here :wink:

the code I’m trying to modify (among others) is as follows :

function smilies($string)
{
include “config.inc.php”;
$smilies = file("$websiteURL/lists/smilies.txt");
$num_smilies = count($smilies);
$x = 0;
while ($x < $num_smilies)
{
$array = explode(" “,$smilies[$x]);
$array[3] = ereg_replace(”\r","",$array[3]);
$array[3] = ereg_replace("\n","",$array[3]);
$string = eregi_replace($array[0],"",$string);
$x++;
}

what I’m gathering from my searches is that the

$smilies = file("$websiteURL/lists/smilies.txt");

line is the culprit, and should be replaced by something like

$smilies = file("…/lists/smilies.txt");

but then again, that seems to change nothing at all in the error messages I’m getting.

Could anyone give me a hint as to what the correct code /syntax would be? Again, I’m a total N00b as far as phpcoding goes so please go easy on me…

Any links to tutorials aimed at beginning coders would be appreciated as well, I’m willing to learn I just don’t want to foo up things beforehand :wink:


#2

Try

$smilies = file(realpath("/home/username/example.com/path/lists/smilies.txt"));

instead.

This is called hardcoding a value and while its not the best approach it will get the code working.

…/lists/smilies.txt is a relative path. Don’t use relative paths unless you know where you are starting from!

/home/username/example.com/path/lists/smilies.txt is an absolute path. It tells you exactly where the file is.

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#3

that seems to be working just fine and is much simpler than I expected. Thanks a lot!