how to disable access for a specific url?

Started on the old forum in February 2015 · view the original in the archive · old links redirect here

4 replies · 144 views · started 11 years ago · 1 min read

5 participants
GumSlone Administrator Principal · 1,690 posts #2

without seeing the source code of your script its impossible to provide a proper solution,

a very simple solution would be:

if(stristr($_GET['d'],'folder/subfolder'))exit();

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

wapxtech Developer · 189 posts #3

lovebirds143 wrote: hello, please anybody tell me how to disable access to specific url my urls look like this http://domain.com/folder/?d=folder/subfolder&c=6 im using an simple load auto index script. i want to disable access for some urls

you can use base64_decode and encode in your $_GET =)

for example you fetch ?file=blablabla

<?php
if(isset($_GET['file']))
{
$encoded = base64_decode($_GET['file']);
}
else
{
$encoded ="";
}
?>

your link should be like this

<?php
$tofetch = "blablabla";
echo "<a href="".base64_encode($tofetch)."">TEST ENCODED HERE</a>";
?>

this should work =) cannot be readable by bare eyes but can easily be understand.. it will looks like a random strings but it is encoded

try to understand and you'll get it 🙂

External image (may be gone) http://wapx.amob.com Applications, Games, Wallpapers, Ringtones, Videos, Themes, Screensaver and More!!!

something else Fellow · 2,296 posts #4

mod rewrite?

RewriteEngine On
RewriteRule ^/url/you/want/to/hide.html$ index.html [L]
Ghost Senior · 366 posts #5

simiiar to gumslones solution but with protection and a redirect this is what i do add this code to top of file:

/** Prevent direct access from url to file that holds this code
      change db.php to name of fie you add this code into */
if(stristr(htmlentities($_SERVER['SCRIPT_NAME']), 'db.php')){
echo '<meta http-equiv="Refresh" content="0; url=index.php">';
die();
}
<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close