nets
29-12-2005, 12:37 AM
I'm coding a guestbook using PHP and JavaScript.
I want to have some sort of BB code and display stats about the guestbook at the bottom. Once I've made the script I'll post it on here so you can all use it (if you want, not that you will).
I haven't been working on it long, but I'll post some of it:
<?PHP
$filename = "datafile.txt";
$date = date('D,M,Y');
$open = fopen($filename, 'r+');
$datecheck = fread($open, 1);
if($datecheck=="")
{
$createdate = "$date\n";
fwrite($open, $createdate);
echo "Thanks for choosing to use this guestbook, refresh the page and it *should* be ready to use.";
exit;
};
fclose($open);
$file = file($filename);
foreach($file as $key => $rowdata)
{
$data[$key] = explode("|", $rowdata);
$ents++;
}
$ents--;
while($row < sizeof($file))
{
/*Data out puts*/
$row++;
};
Just for testing purposes:
echo 'Created on: '.$data[0][0].'<br />';
echo "Current entries: $ents";
I want to have some sort of BB code and display stats about the guestbook at the bottom. Once I've made the script I'll post it on here so you can all use it (if you want, not that you will).
I haven't been working on it long, but I'll post some of it:
<?PHP
$filename = "datafile.txt";
$date = date('D,M,Y');
$open = fopen($filename, 'r+');
$datecheck = fread($open, 1);
if($datecheck=="")
{
$createdate = "$date\n";
fwrite($open, $createdate);
echo "Thanks for choosing to use this guestbook, refresh the page and it *should* be ready to use.";
exit;
};
fclose($open);
$file = file($filename);
foreach($file as $key => $rowdata)
{
$data[$key] = explode("|", $rowdata);
$ents++;
}
$ents--;
while($row < sizeof($file))
{
/*Data out puts*/
$row++;
};
Just for testing purposes:
echo 'Created on: '.$data[0][0].'<br />';
echo "Current entries: $ents";