I made a small system to where I can ban users from my webserver and print a reason for them getting banned.
My problem is now this:
The way my code is set up, php checks to see if the current IP address matches an IP address from the ban list. If true, print the reason and such. If false display the website.
Now of course, I want to add this to all my pages currently on my webserver including my blog.
To reformat the HTML to work with this system would definatly be a pain in the ***.
So my question is there any other way I can do this, so I don’t have to reformat the HTML? Maybe I’m just not thinking properly at the moment.
<?php
//already connected to db of course
$s = $_SERVER["REMOTE_ADDR"];
$ipbancheck = "SELECT * from banip where IP='$s'";
$result = mysql_query($ipbancheck);
$row = mysql_fetch_array($result);
if($s = $row["IP"]){
echo "<p>Your IP Address has been banned from this webserver ";
echo htmlspecialchars( stripslashes($row["IP"])).'<br>';
echo "Reason: ";
echo htmlspecialchars( stripslashes($row["REASON"]));
echo "</p>";
}else{
echo "Display Website";
// here's the problem
// i don't want to have to reformat all my html
// for php, i have many pages i want to do this for.
}
?>