Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownguestbook.php
<html>
<head><title>My OWN Guestbook</title></head>
<style>
BODY {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px}
A:link, A:active, A:visited {color:#0000FF; text-decoration:none}
A:hover {color:#CCCCCC; text-decoration:underline}
</style>
<body>
<?
include "login.inc.php";
include "config.php";
////verifie quon adresse bien un ID pour designer la page
if(isset($_GET['go'])&&($_GET['go']!="")){
$go=$_GET['go'];}
else 
if(isset($_POST['go'])&&($_POST['go']!="")){
$go=$_POST['go'];}
else echo "BAD !!";
////trouve le fichier de conf adequat
$conf_file="myownguestbook/guestbook.".$myspace[$go]['artiste'].".".$go.".xml";
if (file_exists($conf_file)) {
include $conf_file; }
else  @fopen($conf_file, "w"); /// sinon CREATION DU FICHIER DE CONF
$i=$go;
////acces a la page seulement si le user est loggué et proprietaire de la page ID
if(checklogin()&&$myspace[$i]['owner']==$rawuser) {

$db_using = "FLAT"; // choose FLAT DB
// $db_using = "SQL"; // choose SQL DB

if ($db_using == "FLAT") {
	$fields_array = array("author", "comment", "date");
	$db_info = $conf_file;
}

else
	die();


set_magic_quotes_runtime(0);

require("classes/guestbook.class.php");

$gb = new Guestbook($fields_array);
$gb->gbConfig($db_info);

if ($_GET['act'] == "sign") { // sign guestbook
	if ($_POST['go']) {
		$date = time();
		$data_array = array($_POST['author'], $_POST['comment'], $date);
		$gb->putIntoDB($data_array);
	}
}
elseif ($_GET['act'] == "delete") { // delete a record
	include "classes/example_delete.php";
}
elseif ($_GET['act'] == "edit") { // edit a record
	include "classes/example_edit.php";
}

// show records
$records_total = $gb->getRecordsTotal();
if ( $records_total > 0 ) {
	$records = $gb->getRecords("date");
	foreach ($records as $k => $row) {
		printf("<p><b>ID:</b> %s<br>", $row['id']);
		printf("<b>Author:</b> %s<br>", $row['author']);
		printf("<b>Date:</b> %s<br>", date("d/m/Y - H:i:s", $row['date']));
		printf("<b>Comment:</b><br> %s</p>", nl2br($row['comment']));
		echo "<a href='" . $PHP_SELF . "?act=edit&id=" . $row['id'] . "'>Edit</a> - <a href='" . $PHP_SELF . "?act=delete&id=" . $row['id'] . "'>Delete</a>";
		echo "<hr size='1' color='#999999'>";
	}
}
else {
	echo "<h3>Not any comment yet.</h3>";
}
}
?>

</form>
</body>
</html>
Return current item: MyOWNSpace