Created
February 11, 2021 10:18
-
-
Save superjojo140/b44ca3a9ed27c7bf5c4fd94369f0c87a to your computer and use it in GitHub Desktop.
Controlled data access with PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$default_info = | |
"<br><b>Persönliche Daten</b><br>" | |
."<b>Name:</b> Detlef Dummy<br>"; | |
$TOKEN = "superSecretToken"; | |
$code = $_GET["code"]; | |
$name = $_GET["name"]; | |
$client_ip = $_SERVER['REMOTE_ADDR']; | |
$time = date("d.m.Y - h:i:sa"); | |
if(!isset($code) || $code != $TOKEN){ | |
echo "Kein Zugriff!"; | |
mail("[email protected]","Personal Data Info","Blockierter Zugriff von $name (ip: $client_ip) um $time."); | |
exit; | |
} | |
else{ | |
//Access allowed | |
echo $default_info; | |
echo "<br><br><i><small>Der Eigentümer dieser Website wird per Mail über den Abruf der Daten durch $name (IP: $client_ip) informiert!</small></i>"; | |
mail("[email protected]","Personal Data Info","Erfolgreicher Zugriff von $name (ip: $client_ip) um $time."); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment