News Portal
First lets make the form:
Nice and easy make 3 text fields name them the following:
Title
News
Posted
Done that??
It should look like this or something like this:
<FORM action="added.php" method="POST">
Title:<INPUT TYPE="TEXT" name="title"><br>
News:<TEXTAREA WRAP=VIRTUAL NAME="news" COLS=20 ROWS=5> Nice Site! </TEXTAREA><br>
Posted by:<INPUT TYPE="text" name="poster"><br>
<INPUT TYPE="SUBMIT" name="submit" value="submit">
</FORM>
Call this add.php
Now The php part:
<?php
$da = getdate();
$date="$da[weekday] $da[mday] $da[month] $da[year]";
$news = ("<font size=\"2\" face=\"Tahoma\">
<b>$title</b> //form text box named title
<br>
$news //form text box named news (get it?)
<br>
Posted by: <b>$posted</b> On the $date
<br>
</font>");
$file = fopen("news.php", "r");
$read = fread($file, filesize("news.php"));
fclose($file);
$blah = fopen("news.php", "w"); //Leave alone look and learn, only edit if you know php
$news=stripslashes($news);
fwrite($blah, "$news $read");
fclose ($blah);
print "<meta http-equiv=\"refresh\" content=\"1;http://www.damind.net/\">"; //edit path to where the news.php file falls
?>
Save as added.php
Make a new file called
news.php
and also command the 3 files to 777!
Now just include the news.php file wheveer you want the news for example on your index page:
code = <? include "news.php";?>
I would also suggest to put a login over the add page so people cant add news your site!
Dont no how to do this go 2 simple login tutorial!