Font je Times new Roman a ja hocu da mi bude tahoma ili vedrana, kako to da odradim?
Pored ova tri fajla u php-a ima jos samo jedan folder u kom se smestaju vesti koje se upisuju.
news.php
<?php
$display = 10;
if ( $handle = opendir("news/") )
{
while ( ( $file = readdir( $handle ) ) !== false )
{
if ( $file != "." && $file != ".." )
{
$news_array[] = $file;
}
}
closedir( $handle );
}
array_multisort( $news_array, SORT_NUMERIC, SORT_DESC );
array_splice( $news_array, $display );
$num_news = ( count( $news_array ) );
foreach ( $news_array as $val )
{
$news_file = file("news/$val");
$date = $news_file[0];
$title = $news_file[1];
$author = $news_file[2];
$text = $news_file[3];
echo '<b>'.$date.'</b> - '.$title.'<br>';
echo '<small>Author: '.$author.'</small><br>';
echo $text;
echo '<hr>';
}
?>
addnews.php
<form action="postnews.php" method="post">
Author: <input type="text" name="author"><br>
Title: <input type="text" name="title"><br>
Text:<br>
<textarea name="text" cols="50" rows="10"></textarea><br>
<input type="submit" value=" Post News ">
</form>
postnews.php
<?php
$author = $_POST['author'];
$title = $_POST['title'];
$text = $_POST['text'];
$date = date("F j, Y", time());
if ( ! is_dir("news/") )
{
mkdir("news/");
}
if ( $handle = opendir("news/") )
{
while ( ( $file = readdir( $handle ) ) !== false )
{
if ( $file != "." && $file != ".." )
{
$news_array[] = $file;
}
}
closedir( $handle );
}
$num_news = ( count( $news_array ) + 1 );
touch("news/$num_news.txt");
$final = "$date\n$title\n$author\n$text";
$fp = fopen("news/$num_news.txt", "w");
flock( $fp, LOCK_EX );
fputs( $fp, $final );
flock( $fp, LOCK_UN );
fclose( $fp );
echo '<center><b>Your news article has been posted!</b></center>';
?>