예제 #1
0
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #2
0
<?php

include "GbookDB.class.php";
$gbook = new GbookDB();
$result = $gbook->getAll();
if (!is_array($result)) {
    $errMsg = "Произошла ошибка при выводе записей";
} else {
    echo "<p>Всего записей в Гостевой книге: " . count($result) . "</p>";
    foreach ($result as $item) {
        $id = $item['id'];
        $name = $item['name'];
        $email = $item['email'];
        $phone = $item['phone'];
        $msg = nl2br($item['msg']);
        $ip = $item['ip'];
        $datetime = date("d-m-Y H:i:s", $item['datetime'] * 1);
        echo <<<LABEL
\t\t<hr>
\t\t<p>
\t\t\t<b><a href="mailto:{$email}">{$name}</a></b> [{$ip}] @ {$datetime}
\t\t\t<br />{$msg}
\t\t</p>
\t\t<p align="right">
\t\t\t<a href="{$_SERVER['PHP_SELF']}?del={$id}">Удалить</a>
\t\t</p>
LABEL;
    }
}