$pk = 'id';
 $id = $_POST['contentId'];
 $title = $_POST['title'];
 $category = $_POST['category'];
 $desc = $_POST['desc'];
 $area = $_POST['area'];
 $duration = $_POST['duration'];
 $featured = $_POST['featured'];
 $recommended = $_POST['recommended'];
 if ($featured == 'Yes') {
     $offer = $_POST['offer'];
 } else {
     $offer = NULL;
 }
 if (!empty($_POST['imgDelete'])) {
     $imgPath = fileCheck($_FILES['imgFile']);
     unlink($_SESSION['rootDir'] . '/' . $_POST['imgPath']);
 } else {
     $imgPath = $_POST['imgPath'];
 }
 if (!empty($imgPath)) {
     $col = 'title,category,desc,imgPath,area,duration,featured,offer,recommended';
     $info = array($title, $category, $desc, $imgPath, $area, $duration, $featured, $offer, $recommended);
     $pk = 'id';
     if ($obj_query->update($col, $info, 'trip', $pk, $id)) {
         $_SESSION['status'] = 'ok';
         $_SESSION['flashData'] = 'Record Updated';
         header('location:' . baseUrl . 'admin/tripManagement/1/');
     } else {
         $_SESSION['status'] = 'error';
         $_SESSION['flashData'] = 'Record cannot be updated';
<?php

if (!empty($_GET['target'])) {
    $target = $_GET['target'];
    if ($target == 'slideShow') {
        require '../init.php';
        $filePath = $obj_query->select_all('slider', 0, 10);
        compareImage();
    }
    if ($target == 'uploadImage') {
        require '../../init.php';
        $caption = $_POST['caption'];
        $imgFile = $_FILES['imgFile'];
        $filePath = fileCheck($imgFile);
        if (!empty($filePath)) {
            $col = array('caption', 'uploadUrl', 'enable');
            $info = array($caption, $filePath, 'no');
            if ($obj_query->insert($col, $info, 'slider')) {
                $_SESSION['status'] = 'ok';
                $_SESSION['flashData'] = 'Upload successful.';
                header('location:' . baseUrl . 'admin/showSlider/');
            } else {
                $_SESSION['status'] = 'error';
                $_SESSION['flashData'] = 'Cannot upload';
                header('location:' . baseUrl . 'admin/showSlider/');
            }
        } else {
            $_SESSION['status'] = 'error';
            $_SESSION['flashData'] = 'File path not found';
            header('location:' . baseUrl . 'admin/showSlider/');
        }
Example #3
0
if (!file_exists("{$logosPath}login_sx.png")) {
    copy(R3_WEB_DIR . "images/login_sx.png", "{$logosPath}login_sx.png");
    chmod("{$logosPath}login_sx.png", 0770);
}
if (!file_exists("{$logosPath}logo_sx.png")) {
    copy(R3_WEB_DIR . "images/logo_sx.png", "{$logosPath}logo_sx.png");
    chmod("{$logosPath}logo_sx.png", 0770);
}
if (!file_exists("{$logosPath}logo_dx.png")) {
    copy(R3_WEB_DIR . "images/logo_dx.png", "{$logosPath}logo_dx.png");
    chmod("{$logosPath}logo_dx.png", 0770);
}
dirCheck(R3_SMARTY_TEMPLATE_DIR, array('fatal' => true));
dirCheck(R3_SMARTY_TEMPLATE_C_DIR_ADMIN, array('fatal' => false, 'create' => true, 'writeable' => true));
dirCheck(R3_LOG_DIR, array('fatal' => false, 'create' => true, 'writeable' => true));
fileCheck(R3_FOP_CMD, array('fatal' => true));
// Error mail check
if (R3_ERROR_SYSLOG) {
    echo "Warning: R3_ERROR_SYSLOG is true\n";
}
if (!R3_ERROR_ERRLOG) {
    echo "Warning: R3_ERROR_SYSLOG is false\n";
}
if (!R3_ERROR_MAIL) {
    echo "Warning: R3_ERROR_MAIL is false\n";
} else {
    echo "Mail notify to " . R3_ERROR_MAIL_ADDR . " (limit to " . R3_ERROR_MAX_EMAIL . ")\n";
}
try {
    echo "Connectiong to {$dsn['dbname']} on {$dsn['dbhost']} as {$dsn['dbuser']}\n";
    $db = new PDO("{$dsn['dbtype']}:host={$dsn['dbhost']};dbname={$dsn['dbname']}", $dsn['dbuser'], $dsn['dbpass']);