// echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
            // echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
            //    if (file_exists("../../slider_images/" . $pname.".".$extension))
            //      {
            //      die($pname.".".$extension. " already exists. ");
            //      }
            //    else
            //      {
            //  move_uploaded_file($_FILES["file"]["tmp_name"], "../../slider_images/" . $pname.".".$extension);
            //  echo "Stored in: " . "facultyImages/" . $faculty_name.".".$extension;
            //  $imageurl="slider_images/" . $pname.".".$extension;
            list($width, $height) = getimagesize($_FILES['file']['tmp_name']);
            $newwidth = $width * 350 / $height;
            $manipulator = new ImageManipulator($_FILES['file']['tmp_name']);
            // resizing to 200x200
            $newImage = $manipulator->resample($newwidth, 350);
            // saving file to uploads folder
            $manipulator->save('../../slider_images/' . $pname . "." . $extension);
            $imageurl = "slider_images/" . $pname . "." . $extension;
            //      }
        }
    } else {
        die("Sorry, Invalid file extention or file size greater than 2 MB.");
    }
} else {
    die("Choose file.");
}
$a = new Slider_PhotoClass(NULL, $imageurl, $sc_name, $sc_caption, "0");
echo $a->UploadPhotos($imageurl, $sc_name, $sc_caption);
$l = new site_log(NULL, NULL, "visitor", $_SERVER['REMOTE_ADDR'], $sc_caption . " slider photo added");
$l->insertlog();
<?php

if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
session_start();
require_once '../../db/slider_photoClass.php';
require_once '../../db/site_log_class.php';
require_once '../../db/user_class.php';
if (!isset($_GET['id'])) {
    die("first go to slider photo management page.");
}
$ti = $_GET['id'];
$ob = Slider_PhotoClass::getImagesObject($ti);
if ($ob === 0) {
    die("invalid photo");
}
$a = Slider_PhotoClass::approveImage($ti);
$_SESSION['answer'] = $a;
$l = new site_log(NULL, NULL, $_SESSION['user']->username, $_SERVER['REMOTE_ADDR'], $ti . " slider photo approved");
$l->insertlog();
header('Location: ../../slider_photo_manage.php?catid=' . $ob->category_id);
예제 #3
0
<?php

//if(!isset($_SERVER['HTTP_REFERER'])){
//    header("location: ../../access_denied.php?data=You don't have direct access to this page");
//}
if (isset($_GET['id'])) {
    $ti = $_GET['id'];
} else {
    die("First Go to slider photo managemant page");
}
require_once 'db/slider_categor_class.php';
require_once 'db/slider_photoClass.php';
$a = Slider_CategoryClass::getAllCategories();
$ob = Slider_PhotoClass::getImagesObject($ti);
?>
<form method="post" id="updateform" enctype="multipart/form-data"  action="server/gallery/slider_photo_update_server.php">     
     
    <label for="photoId" style="display: none;">Photo ID<span style="color:red;">*</span>: </label>
    <input readonly="true" style="display: none;" id="photoId" value="<?php 
echo $ob->photo_id;
?>
" class="text ui-widget-content ui-corner-all" name="photoId" minlength="0" maxlength="15"  required />
       <br />
             <label for="Category">Category<span style="color:red;">*</span>:</label>
      <select name="Category" id="Category" class="text ui-widget-content ui-corner-all" required="true">    
        <?php 
foreach ($a as $b) {
    echo "<option value='{$b->category_id}' ";
    if ($b->category_id == $ob->category_id) {
        echo 'selected';
    }
<?php

if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
require_once '../../db/slider_photoClass.php';
require_once '../../db/site_log_class.php';
require_once '../../db/user_class.php';
session_start();
if (!isset($_GET['id'])) {
    die("first go to slider photo management page.");
}
$ti = $_GET['id'];
$ob = Slider_PhotoClass::getImagesObject($ti);
if (file_exists("../../" . $ob->url)) {
    unlink("../../" . $ob->url);
}
$a = Slider_PhotoClass::deleteImage($ti);
$_SESSION['answer'] = $a;
$l = new site_log(NULL, NULL, $_SESSION['user']->username, $_SERVER['REMOTE_ADDR'], $ti . " slider photo deleted");
$l->insertlog();
header('Location: ../../slider_photo_manage.php?catid=' . $ob->category_id);
 <?php 
if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
require_once '../../db/slider_photoClass.php';
require_once '../../db/ImageManipulator.php';
require_once '../../db/site_log_class.php';
require_once '../../db/user_class.php';
session_start();
if (isset($_POST['photoId'])) {
    $p_id = $_POST['photoId'];
    $ob = Slider_PhotoClass::getImagesObject($p_id);
} else {
    die("photo id is missing.");
}
if (isset($_POST['Category'])) {
    $sc_name = $_POST['Category'];
} else {
    die("Enter Category Name");
}
if (isset($_POST['caption'])) {
    $sc_caption = $_POST['caption'];
} else {
    die("Enter photo caption");
}
$imageurl = $ob->url;
$a = new Slider_PhotoClass($p_id, $imageurl, $sc_name, $sc_caption, "1");
echo $a->updateImage();
$l = new site_log(NULL, NULL, $_SESSION['user']->username, $_SERVER['REMOTE_ADDR'], $sc_caption . " slider photo updated");
$l->insertlog();
예제 #6
0
//    header("location: ../../access_denied.php?data=You don't have direct access to this page");
//}
require_once '../../db/slider_categor_class.php';
require_once '../../db/slider_photoClass.php';
switch ($_GET['req']) {
    case "populate_category":
        $cat = Slider_CategoryClass::getAllCategories();
        if ($cat != 0) {
            foreach ($cat as $c) {
                echo "<option value='{$c->category_id}'>{$c->category_name}</option>";
            }
        }
        break;
    case "showDetails":
        $a = Slider_PhotoClass::getAllImagescat($_GET['value'], "0");
        $b = Slider_PhotoClass::getAllImagescat($_GET['value'], "1");
        if ($a != 0 || $b != 0) {
            echo "<table>";
            echo "<tr><th>Thumbnail</th>";
            echo "<th>Photo_ID</th>";
            echo "<th>Caption</th>";
            echo "<th>Status</th><th colspan='3'>Manage Detail</th></tr>";
            if ($a != 0) {
                foreach ($a as $c) {
                    echo "<tr><td><a href = '../CMS/{$c->url}' target=_blank><img src = '../CMS/{$c->url}' height=60 width=60 align=center hspace=6 /></a></td>";
                    echo "<td>{$c->photo_id}</td>";
                    echo "<td>{$c->caption}</td>";
                    echo "<td>{$c->status}</td><td><a href='slider_photo_update_detail.php?id={$c->photo_id}'>update</a></td><td><a id='delete' href='server/gallery/slider_photo_delete_detail.php?id={$c->photo_id}'>delete</a></td>";
                    echo "<td><a href='server/gallery/slider_photo_approve_photo.php?id={$c->photo_id}'>Approve photo</a></td></ tr>";
                }
            }