Esempio n. 1
0
            }
            $photo = Photograph::find_by_id($_GET['id']);
            if ($photo && $photo->destroy()) {
                $session_admin->message("The photo {$photo->filename} was deleted.");
                unlink($photo->filename);
                redirect_to('admin_index.php');
            } else {
                $session_admin->message("The photo could not be deleted.");
                redirect_to('admin_index.php');
            }
            break;
        case 'idd':
            if (empty($_GET['id'])) {
                $session_admin->message("No photograph ID was provided.");
                redirect_to('admin_index.php');
            }
            $photo2 = Photograph2::find_by_id($_GET['id']);
            if ($photo2 && $photo2->destroy()) {
                $session_admin->message("The photo {$photo2->filename} was deleted.");
                unlink($photo2->filename);
                redirect_to('admin_index.php');
            } else {
                $session_admin->message("The photo could not be deleted.");
                redirect_to('admin_index.php');
            }
            break;
    }
}
if (isset($database)) {
    $database->close_connection();
}
Esempio n. 2
0
require_once 'includes/initialize.php';
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
$max_file_size = 1048576;
// expressed in bytes
//     10240 =  10 KB
//    102400 = 100 KB
//   1048576 =   1 MB
//  10485760 =  10 MB
if (isset($_POST['submit']) && $_FILES['file_upload']['size'] != 0 && $_FILES['file_upload2']['size'] != 0) {
    $photo = new Photograph();
    $photo->attach_file($_FILES['file_upload']);
    $photo->description = $_POST['description'];
    $photo->category = $_POST['category'];
    $photo2 = new Photograph2();
    $photo2->attach_file($_FILES['file_upload2']);
    $photo2->category = $_POST['category'];
    if ($photo->save() && $photo2->save()) {
        // Success
        $session->message("Photographs uploaded successfully.");
        redirect_to('index.php');
    } else {
        // Failure
        $message = join("<br />Errror", $photo->errors);
    }
}
?>

<!DOCTYPE html>
<html>
Esempio n. 3
0
$total_count = mysql_result($total_count, 0);
$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 .= "WHERE category = '{$category}' ";
$sql .= "ORDER BY `photographs`.`id` DESC ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
$photos = Photograph::find_by_sql($sql);
$sql2 = "SELECT * FROM photographs2 ";
$sql2 .= "WHERE category = '{$category}' ";
$sql2 .= "ORDER BY `photographs2`.`id` DESC ";
$sql2 .= "LIMIT {$per_page} ";
$sql2 .= "OFFSET {$pagination->offset()}";
$photos2 = Photograph2::find_by_sql($sql2);
//$sql3 ="UPDATE photographs SET likes = likes + 1 where id ='28'";
//$sql3 ="SELECT likes FROM photographs where id ='28'";
//$likesomething = Photograph::find_all($sql3,0);
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
?>
        <?php 
include 'indexPictureArea.php';
?>
<br><br>
            <div id="pagination" style="clear: both;"><center>                                       
                <?php 
if ($pagination->total_pages() > 1) {
    if ($pagination->has_previous_page()) {
        echo "<a id='previousPage' href=\"categoryQuery.php?category={$category}&page=";
Esempio n. 4
0
<?php

require_once "includes/initialize_admin.php";
if (!$session_admin->is_admin_logged_in()) {
    redirect_to("admin_login.php");
}
// Find all the photos
$photos = Photograph::find_all();
$photos2 = Photograph2::find_all();
?>




<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Login</title>
        <?php 
require 'links.php';
?>
    </head>
    <body>
	<style>
	
	td{
		height:500px;
	}
	#cssTable td {text-align:center; vertical-align:middle;}
	</style>