AR
Sending a link to the exit page by:
/index.php?a=going&go=site.tld
On going page is:
elseif ($a == 'going') {
$go = $_GET['go'];
if (!isset($go) or $go == '' ) { exit; }
header('Location: http://'.$go.'/');
exit;
}
Problem is that $go can be changed via url and I don't know how to block it. Have tried some ideas but nothing.
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
Thanks mate. 🙂
Here's an example in the guest book when a visitor clicks on a posted link all is fine:
"http://mysite.tld/index.php?a=going&go=POSTED_site.tld"
but when in the address bar someone type a completely different link, the script sends it there. For example,
"http://mysite.tld/index.php?a=going&go=ANOTHER_site.tld" < There to be blocked.
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
wap2k wrote:
elseif ($a == 'going') {
$whitelist = Array(
"google.com",
"yahoo.co.uk"
);
$go = $_GET['go'];
if(!isset($go) || $go == '' || !in_array($go,$whitelist)) { exit; }
header('Location: http://'.$go.'/');
exit;
}
Just add the sites you wish to allow to the White List Array.
Thanks for reply but i can't do it this way because visitors post their links in guest book.
khan89 wrote:
u can send the data in post format. Then it will not show on address bar.
I'ld like to avoid using _post in this case.
I have tried to define the second variable and preg_match them, then false in if statement, !=, !==, return true/false... Nothing works. I have no idea.
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
$_GET is encoded automaticly, its not problem in encoding bro. 🙂 Probably some detail... I tried now define/defined, strpos and I don't know what else have tried and still can't block it.
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
something else wrote:
else if($a == 'going'){
$go = $_GET['go'];
$link = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM table_name WHERE field_name LIKE '%".$go."%'"));
if($link[0]>0&&$go!='')
header('Location: http://'.$go.'/');
else
header('Location: http://back2yourSite.con');
exit;
}
Thanks but i have no sql in this matter and can't figureout how to define needed data.
frostymarvelous wrote:
As mysterio said, what do you want? Is the page a safe redirect? A redirect to your own site? What? After all, I assume a user won't click a link he doesn't want to visit.
But I did explain in the next post...
This is not for the lavalair, I never wanted to have a forum, and probably never will. Im trying to write my site script.
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
Im sorry for bodering u guys but i think its not problem in processing data, its a problem to define the data to be processed.
One of my last attempt yesterday was to recode guest book lines, i have add new var, $linkrow to read array from file, then
foreach ($linkrow as $go) to read every row in the colon, so it can be get to matching and to display in guest book page.
Link is the same:
echo '
'.$go.'';
Now in "going" exit page is:
$go = $_GET['go'];
$link = $_GET['linkrow'];
$getgo = strpos($link, $go); // preg_match also not work
if ($getgo === true) {
header('Location: http://'.$getgo.'/');
exit;
}
else { exit; }
Of course, not work.
Im gonna eat the keybord.
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
For example, user post his link in my guest book. Posted link is coding-talk.com
Open xhtml source of guest book page and u will see:
/index.php?a=going&go=coding-talk.com
Copy-Paste it in ADDRESS BAR of your browser or use Opera option "Copy Link Address" and it looks this:
http://mysite.rs/index.php?a=going&go=coding-talk.com
Click ENTER it opens coding-talk.com
<<< PROBLEM >>>
In ADDRESS BAR change coding-talk.com WITH google.com:
http://mysite.rs/index.php?a=going&go=[B]google.com[/B]
Click ENTER it opens google.com
google.com IS NOT POSTED site link in the guest book and this request (added in address bar) must be terminated by calling exit;
I hope im understandable now. 🙂
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
Thats what im think problem is and don't know how to define it properly. Im defined it in guest book like:
$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>';
}
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
AR
frostymarvelous wrote:
If you want to redirect users to google if they click a link, simply use this at the top of your page
If (isset($_GET['go'])) // check if the go var is set
{
header('Location:http://google.com');// redirect to google no matter the url which was posted. No reason to do any checks unless you wish to substitute based on a condition.
exit;//make sure the rest of the code is not run.
}
I don't want that bro. 🙂 I used coding-talk.com and google.com links just as an example. This is exactly the problem, read the last line >>>
arnage wrote:
For example, user post his link in my guest book. Posted link is coding-talk.com
Open xhtml source of guest book page and u will see:
/index.php?a=going&go=coding-talk.com
Copy-Paste it in ADDRESS BAR of your browser or use Opera option "Copy Link Address" and it looks this:
http://mysite.rs/index.php?a=going&go=coding-talk.com
Click ENTER it opens coding-talk.com
<<< PROBLEM >>>
In ADDRESS BAR change coding-talk.com WITH google.com:
http://mysite.rs/index.php?a=going&go=google.com
Click ENTER it opens google.com
google.com IS NOT POSTED site link in the guest book and this request (added in address bar) must be terminated by calling exit;
I hope im understandable now. :)
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***