Esempio n. 1
0
require_once __DIR__ . '/../../includes/helpers.php';
require_once __DIR__ . '/../../loader.php';
Session::checkSession();
$a = new Auth();
if (!$a->isLoggedIn()) {
    redirect_to('login.php');
    exit;
}
$u = User::getUser();
$msg = "";
if (isset($_POST['addPicture'])) {
    $p = new Pics();
    $p->caption = $_POST['caption'];
    $p->slug = slugify($_POST['caption']);
    $upload = $p->start($_FILES['picture']);
    if ($upload) {
        Logger::start()->add($u->username, $_SERVER['PHP_SELF'], 'File Upload');
        $msg = opmsg("Picture uploaded successfully", "success");
    } else {
        $msg = opmsg($p->errors[0], "failed");
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->