<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
Put in the date:
<br>
<input type="text" name="date" size="20">
<br>
<input type="submit" name="submit1" value="Save Date">
</form>
<?php
//check for submit1
if(isset($_POST['submit1'])){
//set file to open'
$filedate = 'gndate.txt';
//open the file
$fhdate = fopen($filedate, 'w') or die('could not open the file');
//write to the file
fwrite($fhdate, "<hr>".$_POST['date']."<br />\n") or die('could not write to the file');
//close the file
fclose($fhdate);
}
?>
<br>
<br>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
Put in the text you want entered
<br>
<textarea rows="20" name="textchange" cols="40">
</textarea>
<br>
<input type="submit" name="submit2" value="Add Entry">
</form>
<?php
//check for submit2
if(isset($_POST['submit2'])){
//set file to open
$filetext = 'gntext.txt';
//open the file
$fhtext = fopen($filetext, 'a') or die('could not open the file');
//write to the file
fwrite($fhtext, "<br /><img src=\"Pictures/Goldchip.gif\" width=\"10\" height=\"10\">\n".$_POST['textchange']."<br />\n");
//close the file
fclose($fhtext);
}
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="submit4" value="Erase text file">
</form>
<?php
//check for submit4
if(isset($_POST['submit4'])){
//set file to open
$fileerase = 'gntext.txt';
//open the file
$fherase = fopen($fileerase, 'w') or die('could not open the file');
//erase the file
fwrite($fherase) or die('could not write the file');
//close the file
fclose($fherase);
}
?>
<br>
<br>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
Put in you sig
<br>
<input type="text" name="sig" size="20">
<br>
<input type="submit" name="submit3" value="Save Sig">
</form>
<?php
//check for submit3
if(isset($_POST['submit3'])){
//set the file to open
$filesig = 'gnsig.txt';
//open the file
$fhsig = fopen($filesig, 'w') or die('could not open the file');
//write the file
fwrite($fhsig, "<br /><div align=\"right\">".$_POST['sig']."</div>\n") or die('could not write the file');
//close the file
fclose($fhsig);
}
?>
<br>
<br>
<br>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="submit5" value="SEND">
</form>
<?php
//check for SEND
if(isset($_POST['submit5'])){
//set files
$add1 = 'gndate.txt';
$add2 = 'gntext.txt';
$add3 = 'gnsig.txt';
$addto = 'gnews.txt';
//open the files to add
$dataadd1 = file($add1) or die('could not oopen the file');
$dataadd2 = file($add2) or die('could not oopen the file');
$dataadd3 = file($add3) or die('could not oopen the file');
$dataaddto = file($addto) or die('could not oopen the file');
//implode the arrays to be added
$newadd1 = implode(' ', $dataadd1);
$newadd2 = implode(' ', $dataadd2);
$newadd3 = implode(' ', $dataadd3);
//add them to the news
array_unshift($dataaddto, $newadd3);
array_unshift($dataaddto, $newadd2);
array_unshift($dataaddto, $newadd1);
//implode the news array
$newaddto = implode(' ', $dataaddto);
//set the file to add the new news to
$finalnews = 'gnews.txt';
//open the file
$fhfinalnews = fopen($finalnews, 'w') or die('could not open the file');
//write the final news
fwrite($fhfinalnews, $newaddto) or die('could not write to the file');
//close the file
fclose ($fhfinalnews);
//open files
$senderase1 = 'gndate.txt';
$senderase2 = 'gntext.txt';
$senderase3 = 'gnsig.txt';
//open the files
$fhsenderase1 = fopen($senderase1, 'w') or die('could not open the file');
$fhsenderase2 = fopen($senderase2, 'w') or die('could not open the file');
$fhsenderase3 = fopen($senderase3, 'w') or die('could not open the file');
//erase the files
fwrite($fhsenderase1) or die('could not write the file');
fwrite($fhsenderase2) or die('could not write the file');
fwrite($fhsenderase3) or die('could not write the file');
//close the files
fclose($fhsenderase1);
fclose($fhsenderase2);
fclose($fhsenderase3);
}
?>
<br>
<b><u>PRIVEW</u></b>
<br>
This is what you have so far:
<?php
//set the file to open
$readdate = 'gndate.txt';
//open the file
$readdatadate = file($readdate) or die('<br />nothing in the file\'s');
//read the fileinto the browser
foreach ($readdatadate as $readdateline){
echo $readdateline;
}
//set the file to open
$readtext = 'gntext.txt';
//open the file
$readdatatext = file($readtext) or die('<br />nothing in the file\'s');
//read the file into the bowser
foreach ($readdatatext as $readtextline){
echo $readtextline;
}
//set the file to open
$readsig = 'gnsig.txt';
//open the file
$readdatasig = file($readsig) or die('<br />nothing in the file\'s');
//read the file into the browser
foreach ($readdatasig as $readsigline){
echo $readsigline;
}
?>