Exemple #1
0
// Setup
// Session
session_start();
// Include
$inc = 'paste';
try {
    // Creating Database Connection
    $sql = new SQLLink(b1n_SQLCONFIG_FILE);
    $paste = new Paste($sql);
    if (Data::cmp($d['action'], 'add')) {
        if ($r = $paste->add($d)) {
            $inc = 'added';
        }
    } elseif (Data::cmp($d['action'], 'list')) {
        $inc = 'list';
    } elseif (Data::cmp($d['action'], 'text') && Data::checkFilled($d['id']) && ($r = $paste->getDataText($d))) {
        header("Content-type: text/plain");
        require_once b1n_PATH_INC . '/text.inc.php';
        exit;
    } elseif (Data::cmp($d['action'], 'random')) {
        $r = $paste->getDataRandom();
        $inc = 'show';
    } elseif (Data::checkFilled($d['id']) && ($r = $paste->getData($d))) {
        $inc = 'show';
    }
} catch (Exception $e) {
    $exception = $e->getMessage();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">