I have been trying to get this all morning, I’ve checked the PHP manual, done some googling and haven’t been able to solve the problem. Here’s what I want to do. I want to have it so that I can “ban” a particular IP address, but instead of not allowing them access, give them a login page instead. Then, only people who have the password can log on from that IP.
<?php
$bannedIP = 205.221.223.32;
$yourIP = $_SERVER['REMOTE_ADDR'];
$enteredPass = HTTP_POST_VARS['password'];
$thePassword = password;
if($bannedIP == $yourIP && enteredPass != $thePassword) {
echo "<html>
<body>
";
echo "You Must Enter a Password.<br>
";
echo "<form action="index.php">
<b>Password:</b> <input type="text" name="password"><br>
<input type="submit"" name="Submit">
";
echo "</body>
</html>";
else {
Any help would be greatly appreciated, thanks
Oh and btw, after the else is the code for the main page that should be accessed if they either have the password or are coming from a different IP
EDIT: The newlines don’t seem to show up, but that’s what those random n’s scattered about are, escaped n’s (
)