edmundk Posted December 20, 2011 Report Posted December 20, 2011 Hello, i wrote an .htacess file the other day but i was wondering if i could get an image and text to display if someone were to go to my lib/skins folder or something like that.. Any ideas? Quote
Sava Posted December 20, 2011 Report Posted December 20, 2011 You can make an index.html file and put it in lib/skins to prevent directory browsing I do that. Mine says something like this: You are not allowed to view the directories due security reasons. Your IP [ip here] has been logged on our servers. You will be redirected to the home page in 5 seconds. ---- Cheers! 1 Quote
James142 Posted December 20, 2011 Report Posted December 20, 2011 or in your .htacess file, place RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://www.link-to-your-nohotlinking-image-here.com/ [L] underneath your no hotlinking code in the .htacess file. 1 Quote
edmundk Posted December 20, 2011 Author Report Posted December 20, 2011 How do you get the ip to be logged? Quote
James142 Posted December 20, 2011 Report Posted December 20, 2011 How do you get the ip to be logged? What do you mean? are you looking to block IP addresses from accessing your site? Quote
Sava Posted December 20, 2011 Report Posted December 20, 2011 I use this (full code) <html> <head> <title>Stop there!</title> <META HTTP-EQUIV=REFRESH CONTENT="5;URL=http://www.skysim.net/airserbia/"> //redirects the user, change 5 to reflect the number of seconds that take for the user to be redirected </head> <body> Dear visitor,<br> You are not allowed to view this directory for security reasons.<br> You will be redirected to the homepage in 5 seconds.<br> <?php $logfile= 'ip.html'; //the file where the logs will be saved..CHeck the privileges for the file $IP = $_SERVER['REMOTE_ADDR']; //[b]gets the IP, dont touch anything below[/b] $logdetails= date("F j, Y, g:i a O T") . ': ' . '<a href=http://www.geobytes.com/IpLocator.htm?GetLocation&ipaddress='.$_SERVER['REMOTE_ADDR'].'>' .$_SERVER['REMOTE_ADDR'].'</a>'; $fp = fopen($logfile, "a"); fwrite($fp, $logdetails); fwrite($fp, "<br>"); fclose($fp); echo("Your IP has been logged. It is $IP"); //[b]we call the IP to show up[/b] ?> </body> </html> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.