authenticate("write"); if (!$gallery->checkAuthenticatedUser()) { $gallery->error("You do not have permission to replace photos for this account"); } $id = $_REQUEST['id']; if (!empty($id)) { $size = $_FILES['file']['size']; $filename = $_FILES['file']['tmp_name']; if (!empty($filename) && is_uploaded_file($filename) && $size > 0) { $id = $gallery->replacePhoto($filename, $id); } } header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php'); ?>