示例#1
0
// create our pastebin object
//
$pastebin = new Pastebin($CONF);
// clean up older posts
$pastebin->doGarbageCollection();
///////////////////////////////////////////////////////////////////////////////
// process new posting
//
$errors = array();
if (isset($_POST['paste'])) {
    session_start();
    if ($_POST['quux'] == $_SESSION['solution'] && strtolower($_POST['quux2']) == strtolower('blanc')) {
        //process posting and redirect
        $id = $pastebin->doPost($_POST);
        if ($id) {
            $pastebin->redirectToPost($id);
            exit;
        }
    }
    echo "[!?] Mauvais calcul ou erreur dans la devinette. Faites précédent, copiez votre texte et recollez-le dans un nouveau formulaire.";
}
///////////////////////////////////////////////////////////////////////////////
// process download
//
if (isset($_GET['dl'])) {
    $pid = intval($_GET['dl']);
    if (!$pastebin->doDownload($pid)) {
        //not found
        echo "Le post n° {$pid} n'existe pas ou n'est plus disponible.";
    }
    exit;