Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

IP Trapped Error ?


yoyoman

Recommended Posts

Posted

I have been trying to get IP Trapped contribution working on our site as soon as i edit aplication_top i get these error messages

 

Warning: file(/home/fhlinux***/y/******.co.uk/user/htdocs/catalog/banned/IP_Trapped.txt) [function.file]: failed to open stream: No such file or directory in /home/fhlinux***/y/*****.co.uk/user/htdocs/catalog/includes/secret.php on line 3

Warning: Invalid argument supplied for foreach() in /home/fhlinux***/y/*****.co.uk/user/htdocs/catalog/includes/secret.php on line 14

 

i have of course edited out the actuall names .. i am guessin it has somthing to do with that path being incorrect .. any help would be really good as i am now completly stuck

Posted

Stupid question, but does /home/fhlinux***/y/******.co.uk/user/htdocs/catalog/banned/IP_Trapped.txt exist on your file system? I guess not since it's trying to open it and complains that it does not exist.

 

Sorry I'm not familiar with that contribution, but first check that you've specified the name of that file correctly and that it is actually present and readable by your web server (i.e. file permissions are set up correctly with read access). Perhaps you spelt the filename wrong either in the code or when you created or copied it?

 

includes/application_top.php is a bit of a red herring. PHP is complaining about the missing file from within includes/secret.php

Posted

yes it does i can open it in a browser, its just a list of banned ip address .. where as if i try to open secret.php i get similar error message .. .. even though the file is in the right place !

Posted

Well "No such file or directory in /home/fhlinux***/y/*****.co.uk/user/htdocs/catalog/includes/secret.php on line 3" is saying that on line 3 of secret.php it is trying to open the file "/home/fhlinux***/y/******.co.uk/user/htdocs/catalog/banned/IP_Trapped.txt" using function file(), but it does not exist ("failed to open stream: No such file or directory".

 

I assume your application_top.php includes secret.php somewhere and your problem started to occur when you added that include line in application_top.php?

 

I'd focus on secret.php. Can you paste the top 20 lines of it here so we can see line 3 and 14 of that file? (Line 14 is a red herring as well because it's probably falling over because it can't read the file on line 3).

Posted

Line 3 is this

 

$sandtrap = file('/home/**Username**/public_html/**catalog**/banned/IP_Trapped.txt');

 

Line 14 calls this.

 

Line 3 must be incorect

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Posted

Yup i guessed that was the case and i'm sure this is so simple like all things when we know how to do them .. my site is in catalog so i have left that in the string but i guess the username is wrong .. i got the string from my includes/config.php .. would this be the correct thing to do ? if not where would my username be found ?

 

i really have fiddled around with this for a few days on and off and still cant seem to get it working many thnaks in advance R

Posted
Yup i guessed that was the case and i'm sure this is so simple like all things when we know how to do them .. my site is in catalog so i have left that in the string but i guess the username is wrong .. i got the string from my includes/config.php .. would this be the correct thing to do ? if not where would my username be found ?

 

i really have fiddled around with this for a few days on and off and still cant seem to get it working many thnaks in advance R

Hmm, well assuming includes/application_top.php has already been included, so configure.php is already included, then you have access to the correct path variables you can use. configure.php has already defined DIR_FS_CATALOG, that should be the full path from the root of your file system all the way down to your catalog directory. You can perhaps use that and say something like:

$sandtrap = file(DIR_FS_CATALOG . 'banned/IP_Trapped.txt');

This does it in an osCommerce friendly way. If DIR_FS_CATALOG isn't defined, perhaps you can use the PHP variable $DOCUMENT_ROOT instead?

 

You could try a test to see what each of these variables is currently set to. Just put

echo "DIR_FS_CATALOG=" . DIR_FS_CATALOG ."<br>");
echo "DOCUMENT_ROOT=" . $DOCUMENT_ROOT . "<br>");

immediately before line 3 that currently stops on the error. Then fix the problem line itself according to the result of your test to use the most appropriate variable on the sandtrap line itself and remove the test lines again.

 

Hopefully that will fix your problem.

Posted

Fantastic that did work and now i can ban those buggers

 

Big thanks guys to all that helped

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...