Jestli se mezi Vámi najde nějaký génius na vytváření www stránek, tak ať mi prosím poradí, jak vytvoři jednoduché funkční fórum. Odměnou mu potom budiž zvláštní pochvala na mé stránce.
Všem moc děkuji...Bunny
Zkus to takhle:
Uděláš si 6 souborů: diskuse.php; new.php; save.php; re.php; savere.php; a do dresáře "data" soubor promenna.txt, do ktereho se bude zapisovat s jakým číslem se má vytvořit nové fórum.
Zdojaky:
diskuse.php>>
___________________________________________________________
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<style>
A:link {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:visited {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:active {FONT-SIZE: 12px; COLOR: red}; TEXT-DECORATION: none}
A:hover {FONT-SIZE: 12px; COLOR: red; TEXT-DECORATION: blink}
.nadpis {FONT-WEIGHT: bold; FONT-SIZE: 15px; COLOR: black; FONT-FAMILY: Arial}
.podnadpis {FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: BLACK; FONT-FAMILY: Arial}
.zprava {FONT-SIZE: 13px; COLOR: Black; FONT-FAMILY: Arial}
.odpoved {FONT-SIZE: 12px; COLOR: Black; FONT-FAMILY: Arial}
</style>
<title></title>
</head>
<body>
<table border="0" width="500" style="border: 1 solid #000000" cellspacing="0" cellpadding="0">
<tr>
<td width="2" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="13" class="nadpis">
<p class="nadpis"> </p>
</td>
<td width="496" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" colspan="3" height="13" class="nadpis">
<b>Diskuse</b>
</td>
</tr>
<tr>
<td width="2" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="6" class="podnadpis">
</td>
<td width="281" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="6" class="podnadpis">
<b>Název</b>
</td>
<td width="119" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="6" class="podnadpis">
<b>Autor</b>
</td>
<td width="97" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="6" class="podnadpis">
<b>Datum</b>
</td>
</tr>
<?
if ($id==""){
$fpip = "data/promena.txt";
$openip = FOpen ($fpip, "r");
$readip = fread ($openip, filesize ($fpip));
fclose ($openip);
for ($i = 1; $i <= $readip; $i++):
$fpid = "data/$i.txt";
$openid = FOpen ($fpid, "r");
$readid = fread ($openid, filesize ($fpid));
$zobrazid = explode ("|", $readid);
echo "$zobrazid[1]";
fclose ($openid);
endfor;
echo " <tr>
<td width=\"2\" bgcolor=\"#C0C0C0\" class=\"odpoved\" height=\"4\" style=\"border-top: 1 solid #000000\"> </td>
<td width=\"277\" bgcolor=\"#C0C0C0\" class=\"odpoved\" height=\"4\" style=\"border-top: 1 solid #000000\">
<p align=\"left\"> <a href=\"new.php\">založit novou diskusi</a> </td>
<td width=\"214\" bgcolor=\"#C0C0C0\" class=\"odpoved\" height=\"4\" colspan=\"2\" style=\"border-top: 1 solid #000000\"> </td>
</tr>";
}else{
$fp = "data/$id.txt";
$open = FOpen ($fp, "r");
$read = fread ($open, filesize ($fp));
$zobraz = explode ("|", $read);
echo "$zobraz[2]";
echo " <tr>
<td width=\"2\" bgcolor=\"#C0C0C0\" class=\"odpoved\" height=\"4\" style=\"border-top: 1 solid #000000\"> </td>
<td width=\"277\" bgcolor=\"#C0C0C0\" class=\"odpoved\" height=\"4\" style=\"border-top: 1 solid #000000\">
<p align=\"right\"><a href=\"diskuse.php\">zpět na hlavní stranu</a>
<a href=\"new.php\">založit novou diskusi</a> </td>
<td width=\"214\" bgcolor=\"#C0C0C0\" class=\"odpoved\" height=\"4\" colspan=\"2\" style=\"border-top: 1 solid #000000\">
<a href=\"re.php?id=$id\">odpovědět na příspěvek</a> </td>
</tr>";
fclose ($open);
}
?>
</table>
</body>
___________________________________________________________
new.php>>
___________________________________________________________
<head>
<style>
A:link {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:visited {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:active {FONT-SIZE: 12px; COLOR: red}; TEXT-DECORATION: none}
A:hover {FONT-SIZE: 12px; COLOR: red; TEXT-DECORATION: blink}
.nadpis {FONT-WEIGHT: bold; FONT-SIZE: 15px; COLOR: black; FONT-FAMILY: Arial}
.podnadpis {FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: BLACK; FONT-FAMILY: Arial}
.zprava {FONT-SIZE: 13px; COLOR: Black; FONT-FAMILY: Arial}
.odpoved {FONT-SIZE: 12px; COLOR: Black; FONT-FAMILY: Arial}
</style>
<title></title>
</head>
<body>
<form method="POST" action="save.php">
<table border="0" width="500" style="border: 1 solid #000000" cellspacing="0" cellpadding="0" height="72">
<tr>
<td width="2" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="17" class="nadpis">
<p class="nadpis"> </p>
</td>
<td width="496" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" colspan="3" height="17" class="nadpis">
<b>Diskuse</b>
</td>
</tr>
<tr>
<td width="2" bgcolor="#E6E6E6" class="zprava" style="border-bottom: 1 solid #808080" height="16">
<p class="zprava"> </p>
</td>
<td width="281" bgcolor="#E6E6E6" class="zprava" style="border-bottom: 1 solid #808080" height="16">
Založ novou diskusi
</td>
<td width="118" bgcolor="#E6E6E6" class="odpoved" style="border-bottom: 1 solid #808080" height="16"> </td>
<td width="97" bgcolor="#E6E6E6" class="odpoved" style="border-bottom: 1 solid #808080" height="16"> </td>
</tr>
<tr>
<td width="2" bgcolor="#FFFFFF" class="odpoved" height="27"> </td>
<td width="496" bgcolor="#FFFFFF" class="odpoved" height="27" colspan="3">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="13%" class="zprava" valign="top">Jméno:</td>
<td width="87%" class="zprava"><input type="text" name="jmeno" size="13" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">E-mail:</td>
<td width="87%" class="zprava"><input type="text" name="email" size="13" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">Podnázev:</td>
<td width="87%" class="zprava"><input type="text" name="podnazev" size="40" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">Text:</td>
<td width="87%" class="zprava"><textarea rows="4" name="text" cols="66" style="background-color: #FFFFFF; font-family: Arial; font-size: 10pt; border: 1 solid #000000"></textarea></td>
</tr>
<tr>
<td width="13%" class="zprava" height="30"></td>
<td width="87%" class="zprava" height="30">
<p align="right"><input type="submit" value="Odeslat" name="B1" style="background-color: #C0C0C0; font-family: Arial; color: #000000; font-size: 10pt; border: 1 solid #000000">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
___________________________________________________________
re.php>>
___________________________________________________________
<?
$fp = "data/$id.txt";
$open = FOpen ($fp, "r");
$read = fread ($open, filesize ($fp));
$zobraz = explode ("|", $read);
?>
<head>
<style>
A:link {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:visited {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:active {FONT-SIZE: 12px; COLOR: red}; TEXT-DECORATION: none}
A:hover {FONT-SIZE: 12px; COLOR: red; TEXT-DECORATION: blink}
.nadpis {FONT-WEIGHT: bold; FONT-SIZE: 15px; COLOR: black; FONT-FAMILY: Arial}
.podnadpis {FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: BLACK; FONT-FAMILY: Arial}
.zprava {FONT-SIZE: 13px; COLOR: Black; FONT-FAMILY: Arial}
.odpoved {FONT-SIZE: 12px; COLOR: Black; FONT-FAMILY: Arial}
</style>
<title></title>
</head>
<body>
<form method="POST" action="savere.php?id=<? echo"$id"; ?>">
<table border="0" width="500" style="border: 1 solid #000000" cellspacing="0" cellpadding="0" height="72">
<tr>
<td width="2" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="17" class="nadpis">
<p class="nadpis"> </p>
</td>
<td width="496" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" colspan="3" height="17" class="nadpis">
<b>Diskuse</b>
</td>
</tr>
<tr>
<td width="2" bgcolor="#E6E6E6" class="zprava" style="border-bottom: 1 solid #808080" height="16">
<p class="zprava"> </p>
</td>
<td width="281" bgcolor="#E6E6E6" class="zprava" style="border-bottom: 1 solid #808080" height="16">
Odpovědět na "<? echo "$zobraz[0]"; ?>"
</td>
<td width="118" bgcolor="#E6E6E6" class="odpoved" style="border-bottom: 1 solid #808080" height="16"> </td>
<td width="97" bgcolor="#E6E6E6" class="odpoved" style="border-bottom: 1 solid #808080" height="16"> </td>
</tr>
<tr>
<td width="2" bgcolor="#FFFFFF" class="odpoved" height="27"> </td>
<td width="496" bgcolor="#FFFFFF" class="odpoved" height="27" colspan="3">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="13%" class="zprava" valign="top">Jméno:</td>
<td width="87%" class="zprava"><input type="text" name="jmeno" size="13" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">E-mail:</td>
<td width="87%" class="zprava"><input type="text" name="email" size="13" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">Podnázev:</td>
<td width="87%" class="zprava"><input type="text" name="podnazev" size="40" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">Text:</td>
<td width="87%" class="zprava"><textarea rows="4" name="text" cols="66" style="background-color: #FFFFFF; font-family: Arial; font-size: 10pt; border: 1 solid #000000"></textarea></td>
</tr>
<tr>
<td width="13%" class="zprava" height="30"></td>
<td width="87%" class="zprava" height="30">
<p align="right"><input type="submit" value="Odeslat" name="B1" style="background-color: #C0C0C0; font-family: Arial; color: #000000; font-size: 10pt; border: 1 solid #000000">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
___________________________________________________________
savere.php>>
___________________________________________________________
<?
$text = wordwrap( $text, 45, "\n", 1 );
$text = htmlspecialchars("$text", ENT_QUOTES);
$jmeno = wordwrap( $jmeno, 45, "\n", 1 );
$jmeno = htmlspecialchars("$jmeno", ENT_QUOTES);
$email = wordwrap( $email, 45, "\n", 1 );
$email = htmlspecialchars("$email", ENT_QUOTES);
$podnazev = wordwrap( $podnazev, 45, "\n", 1 );
$podnazev = htmlspecialchars("$podnazev", ENT_QUOTES);
$fpn = "data/$id.txt";
$openn = FOpen ($fpn, "r");
$readn = fread ($openn, filesize ($fpn));
$zobraz = explode ("|", $readn);
fclose ($openn);
$open = FOpen ($fpn, "w");
$date = Date("d.m.Y");
$pod = "$zobraz[1]
<tr>
<td width=\"2\" bgcolor=\"#FFFFFF\" class=\"odpoved\" height=\"15\"> </td>
<td width=\"279\" bgcolor=\"#FFFFFF\" class=\"odpoved\" height=\"15\">- $podnazev</td>
<td width=\"118\" bgcolor=\"#FFFFFF\" class=\"odpoved\" height=\"15\"><a href=\"mailto:$email\">$jmeno</a></td>
<td width=\"96\" bgcolor=\"#FFFFFF\" class=\"odpoved\" height=\"15\">$date</td>
</tr>";
$text = "$zobraz[2]
<tr>
<td width=\"2\" bgcolor=\"#E6E6E6\" class=\"odpoved\" height=\"12\"> </td>
<td width=\"278\" bgcolor=\"#E6E6E6\" class=\"odpoved\" height=\"12\"><b>$podnazev</b></td>
<td width=\"117\" bgcolor=\"#E6E6E6\" class=\"odpoved\" height=\"12\"><a href=\"mailto:$email\">$jmeno</a></td>
<td width=\"96\" bgcolor=\"#E6E6E6\" class=\"odpoved\" height=\"12\">$date</td>
</tr>
<tr>
<td width=\"2\" bgcolor=\"#FFFFFF\" class=\"odpoved\" height=\"5\"> </td>
<td width=\"496\" bgcolor=\"#FFFFFF\" class=\"odpoved\" height=\"5\" colspan=\"3\">$text</td>
</tr>";
fputs ($open,"$zobraz[0]|$pod|$text");
fclose ($open);
header ("location: diskuse.php");
?>
___________________________________________________________
save.php>>
___________________________________________________________
<?
$fp = "data/$id.txt";
$open = FOpen ($fp, "r");
$read = fread ($open, filesize ($fp));
$zobraz = explode ("|", $read);
?>
<head>
<style>
A:link {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:visited {FONT-SIZE: 12px; COLOR: #003399; TEXT-DECORATION: none}
A:active {FONT-SIZE: 12px; COLOR: red}; TEXT-DECORATION: none}
A:hover {FONT-SIZE: 12px; COLOR: red; TEXT-DECORATION: blink}
.nadpis {FONT-WEIGHT: bold; FONT-SIZE: 15px; COLOR: black; FONT-FAMILY: Arial}
.podnadpis {FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: BLACK; FONT-FAMILY: Arial}
.zprava {FONT-SIZE: 13px; COLOR: Black; FONT-FAMILY: Arial}
.odpoved {FONT-SIZE: 12px; COLOR: Black; FONT-FAMILY: Arial}
</style>
<title></title>
</head>
<body>
<form method="POST" action="savere.php?id=<? echo"$id"; ?>">
<table border="0" width="500" style="border: 1 solid #000000" cellspacing="0" cellpadding="0" height="72">
<tr>
<td width="2" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" height="17" class="nadpis">
<p class="nadpis"> </p>
</td>
<td width="496" bgcolor="#C0C0C0" style="border-bottom: 1 solid #000000" colspan="3" height="17" class="nadpis">
<b>Diskuse</b>
</td>
</tr>
<tr>
<td width="2" bgcolor="#E6E6E6" class="zprava" style="border-bottom: 1 solid #808080" height="16">
<p class="zprava"> </p>
</td>
<td width="281" bgcolor="#E6E6E6" class="zprava" style="border-bottom: 1 solid #808080" height="16">
Odpovědět na "<? echo "$zobraz[0]"; ?>"
</td>
<td width="118" bgcolor="#E6E6E6" class="odpoved" style="border-bottom: 1 solid #808080" height="16"> </td>
<td width="97" bgcolor="#E6E6E6" class="odpoved" style="border-bottom: 1 solid #808080" height="16"> </td>
</tr>
<tr>
<td width="2" bgcolor="#FFFFFF" class="odpoved" height="27"> </td>
<td width="496" bgcolor="#FFFFFF" class="odpoved" height="27" colspan="3">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="13%" class="zprava" valign="top">Jméno:</td>
<td width="87%" class="zprava"><input type="text" name="jmeno" size="13" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">E-mail:</td>
<td width="87%" class="zprava"><input type="text" name="email" size="13" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">Podnázev:</td>
<td width="87%" class="zprava"><input type="text" name="podnazev" size="40" style="font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="13%" class="zprava" valign="top">Text:</td>
<td width="87%" class="zprava"><textarea rows="4" name="text" cols="66" style="background-color: #FFFFFF; font-family: Arial; font-size: 10pt; border: 1 solid #000000"></textarea></td>
</tr>
<tr>
<td width="13%" class="zprava" height="30"></td>
<td width="87%" class="zprava" height="30">
<p align="right"><input type="submit" value="Odeslat" name="B1" style="background-color: #C0C0C0; font-family: Arial; color: #000000; font-size: 10pt; border: 1 solid #000000">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
___________________________________________________________
data/promena.txt
___________________________________________________________
0
___________________________________________________________
Melo by to fungovat ;-)
Martin