Evo ti moj mali guestbook.
Napisao sam ga na brzinu, a ne izgleda lose ;)
samo izmeni neke textove i dobices sistem za oglase.
writeg.php
Code:
<?php
/*******************************
Software: pGuestBook
File Name : writeg.php
File Description: write.
Author : Filip Cekic
This is freeware, and you can edit code on your risk.
*********************************/
$fileguest = "data.txt";
$mail = $_POST['email'];
$name=$_POST['name'];
$msg=$_POST['msg'];
if ($name && $msg) {
if ($dat=fopen($fileguest,'a')){
$guestsi="<b>Author: <b><a href='mailto:$mail'>$name</b></a> (". date('d.m.Y , H:i') . "):</b> <br><br>$msg<br><br>--------------------------------<p>\n";
fputs($dat , $guestsi);
fclose($dat);
}
}
header("Location: index.php")
?>
index.php
Code:
<title>GuestBook</title>
<?php
/*******************************
Software: pGuestBook
File Name : index.php
File Description: guestbook.
Author : Filip Cekic
This is freeware, and you can edit code on your risk.
*********************************/
$fileguest = "data.txt";
if (file_exists($fileguest)) {
if ($dat=fopen($fileguest,'r')) {
$textm = '';
while(!feof($dat)) {
$textm = fgets($dat,4096) . $textm;
}
echo "<br><br>$textm <br><br> ";
fclose($dat);
}
}
?>
<style type="text/css">
<!--
@import url("css.css");
-->
</style>
<body bgcolor='#E5E5E5'>
<table width="50%" border="1" bordercolor="#dddddd">
<tr><td bordercolor="#FFFFFF"><div align="right"><font face="verdana,arial" size="1"><b>Name:</b></font></div></td>
<td>
<form name="email" action="writeg.php" method="POST">
<input type="text" name="name" size="16"></td></tr>
<tr><td bordercolor="#FFFFFF"><div align="right"><font face="verdana,arial" size="1"><b>Mail:</b></font></div></td>
<td>
<form name="email" action="writeg.php" method="POST">
<input type="text" name="email" size="16"></td></tr>
<tr><td valign="top" bordercolor="#FFFFFF"><div align="right"><font face="verdana,arial" size="1"><b>Message:</b></font></div></td>
<td>
<form name="email" action="writeg.php" method="POST">
<input name="msg" type="text" size="50">
<br>
<br>
<input type='submit' value='Sign'></form>
</td></tr></table></body>
<br>
<br>
<br>
<!--DON'T REMOVE THIS LINK!!!-->
<center><small>Powered by pGuestbook v1.0.2 © 2004, <a href="http://www.vr.co.yu/upload">pSoftware</a>.<small></center>
<?
?>
css.css
Code:
BODY {
CURSOR: default;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px
}
A:visited {COLOR: #006699; text-decoration:none }
A:link {COLOR: #006699; text-decoration:none }
A:hover {COLOR: #FF9933; text-decoration:underline }
A:active {COLOR: #006699; text-decoration:none }
TD {
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 12px;
}
I napravi jedan prazan fajl data.txt.
CHMOD na 777 i to je to...
poz.