I want the users with a password could only post at my newspage. But I don´t understand how to make that so simple with just a IF statement. (IF TEXTBOX="test" THEN $MESSAGE ELSE print("Wrong Password")) How to call a textbox entry?
I think its simple, but I don´t understand "IF".
<?
if ($message)
{$passw2 = $passw = "test";
if ($passw2){
$passw2 = $passw = "test";
$message = ereg_replace("\r\n\r\n", "\n<P>", $message);
$date = date("l, j M Y, H:i:s");
$message = "<tr><td>Skrivet av: <B>$name </B> -- $date<P>
$message
<hr></td></tr>";
$textfile = basename($PHP_SELF) . ".comment";
if ($fp = @fopen ($textfile, "r")) // open without complaining
{
$oldmessages = @fread($fp,filesize($textfile));
@fclose(fp);
}
// now reopen the file in write mode, with the
// pointer at the head of the file
$fp = fopen ($textfile, "w");
fwrite ($fp, $message);
fwrite ($fp, $oldmessages); // adding back the old messages
fclose ($fp);
}}
?>
<FORM method="post">
<input type="password" name="passw"><br>
<b>Namn:</b><BR><INPUT name="name" type="text" size="55"><BR>
<b>Nyheten:</b><BR><TEXTAREA name="message" rows=10 cols=55 wrap=virtual>
</TEXTAREA><BR>
<INPUT name="submit" type="submit" value="Posta Nyheten">
</FORM>