How to stop this?

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

24 replies · 1,438 views · started 15 years ago · 1 min read

TL;DR · summary of 24 replies
  • The problem is stopping a link from being followed if it doesn't match any of the allowed links defined in an array.
  • A possible solution was provided by wap2k using header() with appropriate headers to terminate the request and redirect to another page, which should be blocked.
  • Arnage implemented this solution by adding code similar to what wap2k suggested at the top of their script.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

7 participants
frostymarvelous Senior · 266 posts #21

Arnages, email me the script. I guess ill better understand it then. Sfroelich01 {at> gmail dot com

Perfection comes at a cost

I accept liberty!

wap2k Developer · 168 posts #22

Here is another way

Replace

$linkrow = array($row[this]);
foreach ($linkrow as $go) {
$go = str_replace('http://', null, $go);
$go = htmlentities($go, ENT_QUOTES);
echo '
<a href="/index.php?a=going&go='.urlencode($go).'"><span class="si_y">'.$go.'</span></a>';
} 

With

$linkrow = array($row[this]);
foreach ($linkrow as $go) {
$go = str_replace('http://', null, $go);
$go = htmlentities($go, ENT_QUOTES);
echo '
<a href="/index.php?a=going&go='.urlencode($go).'&key='.md5(urlencode($go)).'"><span class="si_y">'.$go.'</span></a>';
} 

and this

elseif ($a == 'going') {
$go = $_GET['go']; 

if( !isset($go) || $go == '') { exit; } 
    header('Location: http://'.$go.'/'); 
    exit;
}

with

elseif ($a == 'going') {
$go = $_GET['go']; 
$key = $_GET["key"];

if($key!==md5($go) || !isset($go) || $go == '') { exit; } 
    header('Location: http://'.$go.'/'); 
    exit;
}
something else Fellow · 2,296 posts #23

I can only guess you are wanting to do this to stop referrer information being passed ? ..... if so its still pointless as you can use any site as referrer very easily eg by posting javascript into your url bar:

javascript:window.location="http://somesite.con";

or there is a few other ways.

arnage Lead · 811 posts #24

It seems that this is the solution to my problem. Thanks Wap2k! Tomorrow I will try to implement it, for some time I have no internet at home, now I am with relatives.

I didn't know for that Something else, thanks for the info. Going to keep this in mind.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
arnage Lead · 811 posts #25

Yap thats it, thanks again. 🙂

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***

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