public function comment_mail_notification() { $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = SMTP_HOST; $mail->SMTPAuth = SMTP_AUTH; $mail->Username = SMTP_USER; $mail->Password = SMTP_PASS; $mail->SMTPSecure = SMTP_SECURE; $mail->Port = SMTP_PORT; $mail->From = SMTP_FROM; $mail->FromName = SMTP_FROM_NAME; $mail->addReplyTo(SMTP_REPLY_TO, SMTP_REPLY_TO_NAME); $mail->addAddress(SMTP_TO, SMTP_TO_NAME); $mail->isHTML(SMTP_ISHTML); $mail->Subject = SMTP_SUBJECT . strftime("%T", time()); $created = datetime_to_text($this->created); $mail_body = nl2br($this->body); $photo = Photograph::find_by_id($_GET['id']); $mail->Body = <<<EMAILBODY A new comment has been received in the Photo Gallery.<br> <br> Photograph: {$photo->filename}<br> <br> On {$created}, {$this->author} wrote:<br> <br> {$mail_body}<br> EMAILBODY; $result = $mail->send(); return $result; }
function getLikes($picID) { $sqlQuery = "SELECT photograph_id FROM votes "; $sqlQuery .= "WHERE photograph_id ={$picID}"; $photographsQuery = Photograph::find_by_sql($sqlQuery); echo sizeof($photographsQuery); }
<td>Email Address</td> <td>Admin Level</td> <td> </td> <td> </td> </tr> <?php for ($i = 0; $i < count($users); $i++) { if ($users[$i]->id != $user->id) { ?> <tr align="center"> <td> <?php $admin_level = new AdminLevel(); $pic = new Photograph(); $user_profile_picture = $pic->get_profile_picture('5', $users[$i]->id); if (!empty($user_profile_picture->filename)) { echo '<img src="../../' . $user_profile_picture->image_path() . '" width="100" class="img-rounded" />'; } else { echo '<img src="../img/default-prof-pic.jpg" width="100" class="img-rounded" alt="Please upload a profile picture" />'; } ?> </td> <td><?php echo $users[$i]->full_name(); ?> </td> <td><?php echo $users[$i]->username; ?>
<?php require_once "../includes/initialize.php"; if (empty($_GET['id'])) { $session->message("No photograph id was provided"); redirect_to(index . php); } $photo = Photograph::find_by_id($_GET['id']); if (!$photo) { $session->message("The photo could not be located"); redirect_to("index.php"); } ?> <?php include_layout_template('header.php'); ?> <a href = "index.php"> « Back </a> <br/> <div style="margin-left:20px;"> <img src = "<?php echo $photo->image_path(); ?> " /> <p> <?php echo $photo->caption;
// 1. the current page number ($current_page) $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1; // 2. records per page ($per_page) $per_page = 3; // 3. total record count ($total_count) $total_count = Photograph::count_all(); // Find all photos // use pagination instead //$photos = Photograph::find_all(); $pagination = new Pagination($page, $per_page, $total_count); // Instead of finding all records, just find the records // for this page $sql = "SELECT * FROM photographs "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $photos = Photograph::find_by_sql($sql); // Need to add ?page=$page to all links we want to // maintain the current page (or store $page in $session) ?> <?php include_layout_template('header.php'); ?> <?php foreach ($photos as $photo) { ?> <div style="float: left; margin-left: 20px;"> <a href="photo.php?id=<?php echo $photo->id; ?>
if (!isset($_GET['id'])) { redirect_to("login.php"); } $hotel = Hotel::find_by_id($_GET['id']); if (!$hotel) { redirect_to("login.php"); } if ($session->user_id != $hotel->id) { redirect_to("login.php"); } $rule = rules::find_hotel_rules($hotel->id); if (!$rule) { redirect_to("login.php"); } $rooms = $hotel->rooms(); $photos = Photograph::find_by_hotel_id($hotel->id); ?> <!DOCTYPE html> <html> <head> <title> Hotel </title> <link rel="stylesheet" type="text/css" href="../css/reset.css"> <link rel="stylesheet" type="text/css" href="../css/hotel.css"> <link rel="stylesheet" type="text/css" href="../css/demo.css"> <link href='https://fonts.googleapis.com/css?family=Droid+Serif:700,400' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600italic,700' rel='stylesheet' type='text/css'> <script src="../js/modernizr.js"></script>
$hotel->hotel_name = $_POST['hotel_name']; $hotel->address = $_POST['address']; $hotel->stars = $_POST['stars']; $hotel->info = $_POST['info']; if ($hotel->update()) { redirect_to("page.php?id={$hotel->id}"); } } else { $message = "You have to fill all the fields"; } } if (isset($_POST['submit'])) { if (isset($_FILES['slika'])) { $num = count($_FILES['slika']['name']); for ($i = 0; $i < $num; $i++) { $photo = new Photograph(); $photo->hotel_id = $hotel->id; if ($_FILES['slika']['error'][$i] == 0) { if ($photo->upload_images($_FILES['slika']['name'][$i], $_FILES['slika']['tmp_name'][$i], $_FILES['slika']['type'][$i], $_FILES['slika']['size'][$i])) { $message = "Photographs successfully uploaded"; } else { $message = join('<br>', $photo->errors); } } else { $message = "Can't upload <b>" . $_FILES['slika']['name'][$i] . "</b><br/>"; } } } } ?> <!DOCTYPE html>
<?php require_once '../includes/includes_all.php'; $cat = !empty($_GET['cat']) ? (int) $_GET['cat'] : 1; $qry = "select * from tblimages where cat_id={$cat}"; $photos = Photograph::find_by_sql($qry); ?> <html> <head> <link rel="stylesheet" type="text/css" href="stylesheets/style.css"/> <title>Wallpaper Hub</title> </head> <body> <div id="main"> <?php include_layout_template('header.php'); ?> <?php include_layout_template('menu.php'); ?> <div id="contents" > <div style="width:99%; padding:5px;" > <?php if ($session->is_logged_in()) { ?> <?php foreach ($photos as $photo) { ?> <a href="<?php echo $photo->image_path(); ?>
<?php require_once "../includes/initialize.php"; // pagination // 1. the current page number ($current_page) $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1; // 2. records per page ($per_page) $per_page = 1; // 3. total record count ($total_count) $total_count = Photograph::count_all(); //$photos = Photograph::find_all(); $pagination = new Pagination($page, $per_page, $total_count); $photos = Photograph::get_current_page($pagination); ?> <?php include_layout_template('header.php'); ?> <?php echo output_message($message); ?> <?php foreach ($photos as $photo) { ?> <div style="float: left; margin-left: 20px;"> <a href="photo.php?id=<?php echo $photo->id; ?>
<?php require_once "../includes/initialize.php"; // In an application, this could be moved to a config file $upload_errors = array(UPLOAD_ERR_OK => "No errors.", UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL => "Partial upload.", UPLOAD_ERR_NO_FILE => "No file.", UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.", UPLOAD_ERR_CANT_WRITE => "Can't write to disk.", UPLOAD_ERR_EXTENSION => "File upload stopped by extension."); if (isset($_POST['submit'])) { // process form data /* $tmp_file = $_FILES['file_upload']['tmp_name']; $target_file = basename($_FILES['file_upload']['name']); $upload_dir = dirname(__FILE__)."/uploads"; */ $photo = new Photograph(); if ($photo->attach_file($_FILES['file_upload'])) { echo "success.<br />"; echo "<pre>"; print_r($photo); echo "</pre>"; } else { echo "error.<br />"; echo "<pre>"; print_r($photo->errors); echo "</pre>"; } /* You will probably want to first use file_exists() to make sure there isn't already a file by the same name. */ /* move_uploaded_file will return false if $tmp_file is not a valid file or if it cannot be moved for any other reason. */ /* if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file)){ $message = "File uploaded successfully.";
<?php require_once '../../includes/initialize.php'; if (!$session->is_logged_in()) { redirect("login.php"); } if (empty($_GET['id'])) { $session->set_get_message("Photo's Id Not Selected"); redirect('index.php'); } $photo = Photograph::find_by_id($database->escape_value($_GET['id'])); if ($photo && $photo->destroy()) { $session->set_get_message("Photograph {$photo->filename} Deleted Successfully"); redirect('view_photograph.php'); } else { $session->set_get_message("Photograph Couldn't Be Deleted"); redirect('view_photograph.php'); }
<?php include 'header.php'; ?> <?php if (!isset($_SESSION['myid'])) { Header("Location: index.php"); } ?> <?php $getphotos = $_SESSION['myid']; $photos = Photograph::find_by_id_many($id = $getphotos); ?> <div class="main-content-wrapper clearfix"> <div class="login_main"> <div class= "login_main_inner"> <h2>My Photo Album</h2> <?php echo output_message($message); ?> <table class="bordered">
<?php $message = "TESTSET"; require_once '../../includes/photograph.php'; require_once '../../includes/functions.php'; require_once '../../includes/session.php'; if (!$session->is_logged_in()) { redirect_to("login.php"); } $max_file_size = 1048576; if (isset($_POST['submit'])) { $photo = new Photograph(); $photo->caption = $_POST['caption']; $photo->attach_file($_FILES['file_upload']); if ($photo->save()) { $message = "Photograph uploaded"; } else { $message = join("<br>", $photo->errors); } } //print_r($_FILES['file_upload']); $upload_errors = array(UPLOAD_ERR_OK => "File Uploaded.", UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL => "Partial upload.", UPLOAD_ERR_NO_FILE => "No file. Please select at least one file", UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.", UPLOAD_ERR_CANT_WRITE => "Can't write to disk.", UPLOAD_ERR_EXTENSION => "File upload stopped by extension."); //if(isset($_POST['submit'])) { // //process the form data // $tmp_file = $_FILES['file_upload']['tmp_name']; // $target_file = basename($_FILES['file_upload']['name']); // $upload_dir = "uploads"; // if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file)) // { // $message = ""; //
$result = $database->query($sql); while ($row = $result->fetch_assoc()) { ?> <h2><?php echo $row['username']; ?> </h2> <img width="200px" length="200px" src="<?php echo $row['image1']; ?> "> <?php $photos = Photograph::find_by_id_many($id = $others); $numberphotos = count($photos); ?> <a href="others_photo_album.php?set=<?php echo $others; ?> "><p>Photo Album (<?php echo $numberphotos; ?> )</p></a> <!-- <h3><?php echo $row['location']; ?> </h3> -->
<div> <h2>Photo view</h2> <?php echo Messages($message); ?> <table> <tr> <th>Photo</th> <th>Filename</th> <th>Caption</th> <th>Size</th> <th>Type</th> </tr> <?php $photos = Photograph::FindAll(); foreach ($photos as $photo) { ?> <tr> <td><img src="../<?php echo $photo->ImagePath(); ?> " width="200px;"</td> <td><?php echo $photo->filename; ?> </td> <td><?php echo $photo->caption; ?> </td>
} if (isset($_POST['update'])) { if ($_POST['old_password'] == $user->password) { $user->password = $_POST['new_password']; if ($admin_user->update()) { $session->message("Success! The password was updated. "); redirect_to('public-view-profile.php'); } else { $session->message("Error! The user details could not be updated. "); } } else { $session->message("Error! The existing password did not match. "); } } if (isset($_POST['upload'])) { $photo = new Photograph(); $photo->commuter_id = $user->id; $photo->photo_type = 9; // photo_type 9 is "User Profile" $photo->attach_file_commuter($_FILES['file_upload'], $user->id, $user->first_name, $user->last_name); if ($photo->save()) { $session->message("Success! The photo was uploaded successfully. "); redirect_to('public-view-profile.php'); } else { $message = join("<br />", $photo->errors); } } } else { //everyone else $session->message("Error! You do not have sufficient priviledges to view the requested page. "); redirect_to("index.php");
</div><!-- pets --> </div><!-- page-right --> </div><!-- page-wraper --> <?php if (isset($five_hotels) && count($five_hotels) === 5) { ?> <div class="page-wraper"> <div class="recommended clear-fix"> <h1>Hotels Around</h1> <?php foreach ($five_hotels as $hotel) { ?> <?php $photo = Photograph::first_photo($hotel->id); ?> <div class="recommended-hotel"> <div class="bg-mask"></div> <a href="#" class="hover-img"><img src="<?php echo $photo ? $photo->image_path() : "images/osnovna.jpg"; ?> "></a> <a href="page.php?id=<?php echo $hotel->id; ?> " class="hotel-link"><?php echo $hotel->hotel_name; ?> </a> </div><!-- recommended-hotel -->
<?php //init code $photo_object = new Photograph(); $admin_user_object = new AdminUser(); $bus_personnel_object = new BusPersonnel(); $route_object = new BusRoute(); $bus_object = new Bus(); $bus_bus_personnel_object = new BusBusPersonnel(); //check login if ($session->is_logged_in()) { if ($session->object_type == 5) { $session->message("The requested page is for use by Bus Personnel only. "); redirect_to("index.php"); } else { if ($session->object_type == 4) { //bus personnel $user = $bus_personnel_object->find_by_id($_SESSION['id']); $profile_picture = $photo_object->get_profile_picture($session->object_type, $user->id); if ($user->role == 1 || $user->role == 4 || $user->role == 5) { //bus_personnel that is logged in is an owner (role is 1 (Owner), 4 (Owner + Driver) or 5 (Owner + Conductor)) $buses = $bus_bus_personnel_object->get_buses_for_personnel($user->id); } else { if ($user->role == 2 || $user->role == 3) { //bus_personnel that is logged in is not an owner $buses = $bus_bus_personnel_object->get_buses_for_personnel($user->id); } } } else { //everyone else $session->message("Error! You do not have sufficient priviledges to view the requested page. ");
} $max_file_size = 1048567; $message1 = ""; $message2 = ""; $message3 = ""; $message4 = ""; if (isset($_POST['submit'])) { $photo = new Photograph(); $photo->hotel_id = $hotel->id; $photo->attach_file($_FILES['upload_file']); if ($photo->save()) { $message1 = "Photographs was successfully uploaded"; } else { $message1 = join("<br>", $photo->errors); } $photo1 = new Photograph(); $photo1->hotel_id = $hotel->id; $photo1->attach_file($_FILES['upload_file1']); if ($photo1->save()) { $message2 = "Photographs was successfully uploaded"; } else { $message2 = join("<br>", $photo1->errors); } } ?> <!DOCTYPE html> <html> <head> <title> Hotel </title>
<?php require_once '../inc/initialize.php'; $photograph = new Photograph(); $photograph_details = $photograph->find_by_id($session->applicant_id); if ($_FILES['picture']['error'] == 2) { sleep(2); echo '<h4 class="alert alert-error">Error</h4>'; echo '<hr>'; echo "Maximum File size Exceeded(250Kb)"; die; } if (!empty($photograph_details) && !empty($_FILES['picture']['name'])) { $photograph->image_id = $photograph_details->image_id; unlink(SITE_ROOT . DS . 'passport' . DS . $photograph_details->filename); } $arrayfiledetails = explode('.', $_FILES['picture']['name']); $extension = $arrayfiledetails[sizeof($arrayfiledetails) - 1]; $_FILES['picture']['name'] = $session->applicant_id . '.' . $extension; if ($photograph->attach_file($_FILES['picture'])) { $photograph->caption = User::applicant_fullname($session->applicant_id); $photograph->applicant_id = $session->applicant_id; //explode filename to get file extension $photograph->filename = $_FILES['picture']['name']; if ($photograph->save()) { $user = new User(); $user->applicant_id = $session->applicant_id; $user->updateProgress('G'); sleep(2); echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>'; echo '<hr>';
require_once '../includes/initialize.php'; ?> <?php include_layout_template("header.php"); $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $record_no = 3; $total_records = Photograph::count(); // $photo_object = new Photograph(); // $photos = $photo_object->find_all(); $pagination = new Pagination($page, $record_no, $total_records); $sql_query = "SELECT * FROM photograph "; $sql_query .= "LIMIT {$record_no} "; $sql_query .= "OFFSET {$pagination->offset()} "; $photos = Photograph::find_by_sql($sql_query); ?> <h2>Photos</h2> <?php echo output_message($session->set_get_message()); ?> <?php foreach ($photos as $photo) { ?> <div style="float:left;margin-left: 20px; display:inline;"> <a href="photo.php?id=<?php echo $photo->id; ?> "> <img src="<?php echo $photo->image_path();
<?php require_once "../../includes/initialize.php"; if (isset($_POST["submit"])) { $photograph = new Photograph(); $photograph->caption = $_POST["caption"]; $photograph->AttachFile($_FILES["upload_file"]); $photograph->SaveWithFile(); } ?> div> <section> <div> <h2>Upload photo</h2> }?> <form action="photo_upload.php" enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000" /> <p>Choose file: <input type="file" name="upload_file" /></p> <p>Caption:<input type="text" name="caption" value="" /></p> <input type="submit" name="submit" value="Upload" /> </form> </div> </section> </div> ?>
<?php require_once "../includes/database.php"; require_once "../includes/user.php"; require_once '../includes/functions.php'; require_once "../includes/photograph.php"; $photos = Photograph::find_all(); ?> <!DOCTYPE html> <html lang="en" style="background-image: url(mainpage.jpg);> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Gallery Home</title> <!-- Bootstrap Core CSS --> <link href="css2/bootstrap.min.css" rel="stylesheet"> <!-- Custom CSS --> <link href="css2/heroic-features.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { $updatedPhotograph = Photograph::update($id, $request); return view('admin.photograph.show', ['photograph_id' => $id]); }
<?php require_once "../../includes/initialize.php"; if (!$session->is_logged_in()) { redirect_to("login.php"); } else { $user = User::find_by_id($_SESSION['user_id']); } if (isset($_POST['submit'])) { $photo = new Photograph(); $photo->caption = $_POST['caption']; $photo->attach_file($_FILES['file_upload']); if ($photo->save()) { $session->message("Success! The photo was uploaded successfully. "); redirect_to('list_photos.php'); } else { $message = join("<br />", $photo->errors); } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Photo Upload · Photo Gallery</title> <?php require_once '../../includes/header.php'; ?> </head> <body>
</thead> <tbody align="center"> <?php foreach ($buses_bus_personnel as $bbp) { $assigned_bus_personnel = $bus_personnel_object->find_by_id($bbp->bus_personnel_id); ?> <tr> <td> <a href="admin-read-update-bus-personnel.php?personnelid=<?php echo $assigned_bus_personnel->id; ?> "> <?php $pic = new Photograph(); $bus_personnel_profile_picture = $pic->get_profile_picture('4', $assigned_bus_personnel->id); if (!empty($bus_personnel_profile_picture->filename)) { echo '<img src="../../' . $bus_personnel_profile_picture->image_path() . '" width="100" class="img-rounded" />'; } else { echo '<img src="../assets/img/default-prof-pic.jpg" width="100" class="img-rounded" alt="Please upload a profile picture" />'; } ?> </a> </td> <td><a class="btn btn-block btn-info" href="admin-read-update-bus-personnel.php?personnelid=<?php echo $assigned_bus_personnel->id; ?> "><?php echo $assigned_bus_personnel->full_name(); ?>
} if (isset($_POST['update'])) { if ($_POST['old_password'] == $user->password) { $user->password = $_POST['new_password']; if ($user->update()) { $session->message("Success! Your password was updated. "); redirect_to('admin-view-profile.php'); } else { $session->message("Error! Your password could not be updated. "); } } else { $session->message("Error! The existing password did not match. "); } } if (isset($_POST['upload'])) { $photo = new Photograph(); $photo->related_object_type = '4'; $photo->related_object_id = $user->id; $photo->photo_type = 9; // photo_type 9 is "User Profile" $photo->attach_file_bus_personnel($_FILES['file_upload'], $user->id, $user->first_name, $user->last_name); if ($photo->save()) { $session->message("Success! The photo was uploaded successfully. "); redirect_to('admin-view-profile.php'); } else { $message = join("<br />", $photo->errors); } } } else { //everyone else $session->message("Error! You do not have sufficient priviledges to view the requested page. ");
<?php require_once "../../includes/initialize.php"; if (!$session->is_logged_in()) { redirect_to("login.php"); } // must hve an ID if (empty($_GET['id'])) { $session->message("No photograph ID was provied."); redirect("index.php"); } // check if passed photo id exists. $photo = Photograph::find_by_id($_GET["id"]); if ($photo && $photo->destory()) { $session->message("The photo {$photo->filename} was deleted."); redirect_to("list_photos.php"); } else { $session->message("The photo could not be deleted."); redirect_to("list_photos.php"); } if (isset($database)) { $database->close_connection(); }
//bus personnel $user = $bus_personnel_object->find_by_id($_SESSION['id']); $profile_picture = $photo_object->get_profile_picture($session->object_type, $user->id); if (isset($_POST['submit'])) { $bus_to_read_update->route_id = $_POST['route_id']; $bus_to_read_update->reg_number = $_POST['reg_number']; $bus_to_read_update->name = $_POST['name']; if ($bus_to_read_update->update()) { $session->message("Success! The Bus details were updated. "); redirect_to('admin-list-buses.php'); } else { $session->message("Error! The Bus details could not be updated. "); } } if (isset($_POST['upload'])) { $photo_to_upload = new Photograph(); $photo_to_upload->related_object_type = '3'; $photo_to_upload->related_object_id = $_GET['busid']; $photo_to_upload->photo_type = $_POST['photo_type']; $photo_to_upload->attach_file_bus($_FILES['file_upload'], $photo_to_upload->bus_id, $photo_to_upload->photo_type); if ($photo_to_upload->save()) { $session->message("Success! The photo was uploaded successfully. "); redirect_to('admin-list-buses.php'); } else { $message = join("<br />", $photo_to_upload->errors); } } if (isset($_POST['assign'])) { $buses_bus_personnel_to_read_update = new BusBusPersonnel(); $buses_bus_personnel_to_read_update->bus_id = $_GET['busid']; $buses_bus_personnel_to_read_update->bus_personnel_id = $_POST['bus_personnel_id'];
} if (isset($_POST['update'])) { if ($_POST['old_password'] == $bus_personnel_to_read_update->password) { $bus_personnel_to_read_update->password = $_POST['new_password']; if ($bus_personnel_to_read_update->update()) { $session->message("Success! The user's password was updated. "); redirect_to('admin-list-bus-personnel.php'); } else { $session->message("Error! The user's password could not be updated. "); } } else { $session->message("Error! The existing password did not match. "); } } if (isset($_POST['upload'])) { $photo_to_upload = new Photograph(); $photo_to_upload->related_object_type = '4'; $photo_to_upload->related_object_id = $_GET['personnelid']; $photo_to_upload->photo_type = '9'; // photo_type 9 is "User Profile" $photo_to_upload->attach_file_bus_personnel($_FILES['file_upload'], $bus_personnel_to_read_update->id, $bus_personnel_to_read_update->first_name, $bus_personnel_to_read_update->last_name); if ($photo_to_upload->save()) { $session->message("Success! The photo was uploaded successfully. "); redirect_to('admin-list-bus-personnel.php'); } else { $message = join("<br />", $photo_to_upload->errors); } } } else { //everyone else $session->message("Error! You do not have sufficient priviledges to view the requested page. ");