I'll try to make a script if the user is redirected to
http://example.com/?url=http://badsite.com
that the script reacts at the URL and displays an echo saying "Not secure", just like the Twitter and Google system, they also check if the URL is harmful.
I've found something, but this isn't what I was seaching for. Google couldn't help me, it gave me all vague answers.
<?php
$badsite = "http://badsite.com";
$host = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if($host == $badsite) {
echo "Secure, redirecting you";
} else {
echo "NOT SECURE";
}
?>
It isn't working as it should, it always displays "Not secure", while the link is secure. I think there's a error somewhere, but I need help fining it.
EDIT
<?php
$badsite = "http://badsite.com";
$host = $_GET['url'];
if($host == $badsite) {
echo "Secure, redirecting you";
} else {
echo "NOT SECURE";
}
?>
Ive tried, but it's still not working :(
Let me make the question a littlebit easier, how can I make it so if the url is
http://example.com/?url=Texthere
that there will be an echo on the page with "this is the page of texthere" and if "Texthere" isn't in the URL, that the echo won't be displayed?
$host = $_GET["url"];