I edited the thread title for you, forum->form.
I wanted to add on to your code so...
For the record I would have done this pretty different but I am just fixing your code. It would never work.
Index.php
<html>
<body>
<Form action='login.php' method='POST'>...
This will log each ip into a text file, does not check for duplicates.
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$d = date("d-m-y / H:i:s");
$log = $d . " -- " . $ip ."<br />";
$fopen = fopen("logs.html", "a");
fwrite($fopen, $log);
fclose($fopen);
?>
RE: Simple IP Ban
Just do something like...
<?php
$ip[] = "127.0.0.1";
$ip[] = "";
foreach($ip as $ips){
if(in_array($_SERVER['REMOTE_ADDR'], $ips))
die("banned");
}
?>
RE: Basic forum in PHP
Isn't it best to do
<?php
session_start()
if ($_SESSION['username'])
echo "Welcome, ".$_SESSION['username']."!;<br><a href='logout.php'></a>";
else
die("You must be logged in!");
?>
AS
<?php
session_start()
if (isset($_SESSION['username']))
echo "Welcome...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.