ob_start(); include '../includes/db_func.php'; include 'includes/classes/Admin.php'; include 'check_login.php'; include 'includes/classes/event.php'; include 'includes/classes/gallery.php'; $events = Event ::find_all(); if(isset($_POST['event_upload'])) { if(($_POST['event_id']) != "") { $name = $_POST['name']; $event_id = $_POST['event_id']; $desc = $_POST['desc']; $target_path = "$web_root/$event_gallery_path/"; $path_parts = pathinfo(basename($_FILES['uploadedfile']['name'])); $type = $_FILES['uploadedfile']['type']; $upload_file_name = time() . "." . $path_parts['extension'] ; $target_path = $target_path . $upload_file_name; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $params = array('event_id' => $event_id,'thumbnail_path' => $upload_file_name,'path' => $upload_file_name,'name' => $name,'type' => $type,'desc' => $desc); $gallery = new Gallery($params); $gallery->save(); } header('location:events.php'); } else { $err = "Select a Event."; } } if(isset($_POST['cancel'])) { header('location:events.php'); } $header_links = "Eevent Gallery | Add "; include 'includes/header.php'; include 'includes/side_bar.php'; include 'includes/center_start.php'; ?>