Hallo liebe Leute!
Ich habe ein kleines Problem und ich komme einfach nicht weiter, ich sehe nur mehr Fehler Codes vor meinen Augen
Also ich habe ein kleines IP BAN script geschrieben in Mysql, das restliche Script ist aber in Mysqli geschrieben.
Meine db_connect.php
Code:
<?php
$con=mysqli_connect("localalhost","user","passwort","datenbankname");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
Meine PHP Datei in Mysql geschrieben die zu Mysqli umfunktioniert werden muss!
Code:
<?php
function get_ip()
{
if(isset($_SERVER['X_FORWARDED_FOR']))
{
if(strpos($_SERVER['X_FORWARDED_FOR'], ',') === false)
{
return $_SERVER['X_FORWARDED_FOR'];
}
return trim(reset(explode(',', $_SERVER['X_FORWARDED_FOR'])));
}
return $_SERVER['REMOTE_ADDR'];
}
$ip = get_ip();
// connect to the database
include ("./include/db_connect.php");
// build query ( Zeilen die geändert werden müssen in MYSQLI wo mein Problem ist )
$sql = 'SELECT * FROM blocked_ips WHERE ip LIMIT 1`';
$result = $con->query( $sql );
if ( $result == "1" )
{
header("HTTP/1.1 403 Forbidden");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>ERROR: 403 Forbidden - You have been banned!</title>
<style type="text/css">
</style>
</head>
<body>
<h1>ERROR: 403 FORBIDDEN</h1>
<p>
It appears that your IP ( '.$ip.' ) has been banned from accessing
this sites content. If you feel that this banning is in error, feel
free to contact the sites administrator to have it removed.
</p>
<p>Admin Contact: <a href="MAILTO:'.$admin_mail.'">'.$admin_mail.'</a></p>
</body>
</html>
';
die();
}
mysql_close($con);
?>
Könnte mir vielleicht einer hier behilflich sein bevor meine Nerven noch dem Keller runter fliegen, ich versuche es nun seit Stunden wo womöglich hier jemand es in ein paar Minuten schaffen würde.
Ich Danke schonmal für die Große Hilfe
Lg PrelaYer