Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] problem z news'ami
jjarkus
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 26.08.2008

Ostrzeżenie: (0%)
-----


witam,
mam problem z newsami (IMG:http://forum.php.pl/style_emoticons/default/sadsmiley02.gif)
tu podaje kod php
CODE

<?php
if($HTTP_POST_VARS['submit']) {
if($HTTP_POST_VARS['password'] == 'password') {
if(!$HTTP_POST_VARS['name']) {
echo "You must enter a name";
exit;
}
if(!$HTTP_POST_VARS['news']) {
echo "Napisz cos baranie";
exit;
}
if(strstr($HTTP_POST_VARS['name'],"|")) {
echo "Imie nie może zawierać symbolu - |";
exit;
}
if(strstr($HTTP_POST_VARS['news'],"|")) {
echo "News nie moze zawierac symbolu - |";
exit;
}
$fp = fopen('news.txt','a');
if(!$fp) {
echo "Error opening file!";
exit;
}
$line = date("m.d.y") . "|" . $HTTP_POST_VARS['name'];
$line .= "|" . $HTTP_POST_VARS['news'];
$line = str_replace("\r\n","
",$line);
$line .= "\r\n";
fwrite($fp, $line);
if(!fclose($fp)) {
echo "Error closing file!";
exit;
}
} else {
echo "Bad Password";
}
}

?>


a tutaj część odpowiedzialną za wyświetlanie newsów
CODE

<?php
$data = file('news.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo
$pieces[2] . "<BR>" . "<b>Dodane przez " . $pieces[1] . " dnia " . $pieces[0] . "</b><BR><BR>";
}
?>


I teraz mam problem bo za chiny nie mogę dostosować wyglądu newsa (IMG:http://forum.php.pl/style_emoticons/default/sciana.gif)
Nie mogę do tego wstawić kodu php, bo za każdym razem strona znika (wyświetla się tylko białe tło)
CODE
<div class="post">
<div class="header">
<h3>ble ble</h3>
<div class="date">Tutaj powinna być data wyświetlona</div>
</div>
<div class="content">
Treść newsa i autor powinny być tutaj wyświetlone
<div>
<div>
Dzięki za pomoc (IMG:http://forum.php.pl/style_emoticons/default/czarodziej.gif)

Ten post edytował jjarkus 26.08.2008, 20:02:55
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.09.2025 - 13:18