*/
require '../../model/com.gogetrich.dao/ADUserCredentialDaoImpl.php';
require '../../model/com.gogetrich.service/ADUserService.php';
require '../../model/com.gogetrich.model/ADUserVO.php';
require 'CredentialValidationService.php';
require '../../model-db-connection/config.php';
$adUserDao = new ADUserCredentialDaoImpl();
$adUserService = new ADUserService($adUserDao);
$result = $adUserService->verfyAdUsernameAndPassword($_POST['username'], $_POST['password']);
if ($result == 401) {
    header("Location: ../../view/loginError?rc=" . md5(401) . "&aRed=true");
    die;
} else {
    $loginRes = explode(":", $result);
    if ($loginRes[0] == 200) {
        $service = new CredentialValidationService();
        //Check is multiple login?
        if (!$service->checkIsMultiple($loginRes[2], $loginRes[1])) {
            $_SESSION['userIdForMultilple'] = $loginRes[1];
            header("Location: ../../view/loginMultiple");
        } else {
            if ($service->submitToken($loginRes[2], $loginRes[1]) == 200) {
                header("Location: ../../view/dashboard");
            } else {
                header("Location: ../../view/loginError?rc=" . md5(503) . "&aRed=true");
            }
        }
    } else {
        header("Location: ../../view/loginError?rc=" . md5(503) . "&aRed=true");
        die;
    }
<?php

session_start();
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.function/CredentialValidationService.php';
$serviceCheck = new CredentialValidationService();
$jsonObj = $serviceCheck->getTokenDetail($_SESSION['token']);
$jsonValue = json_decode($jsonObj, true);
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$courseHeaderId = (string) filter_input(INPUT_GET, 'cHeaderId');
$filename = uniqid() . $_FILES["productImage"]["name"];
if (move_uploaded_file($_FILES["productImage"]["tmp_name"], "../../view/assets/uploads/images/" . $filename)) {
    echo $filename;
    $sqlInsertToTmp = "INSERT INTO GTRICH_GALLERY_IMAGES_UPLOAD_TMP (IMAGE_ID,IMAGE_NAME,IMAGE_UPLOAD_DATE_TIME,REF_COURSE_HEADER_ID,DISTRIBUTOR_ID) " . "VALUES ('" . uniqid() . "','" . $filename . "',now(),'" . $courseHeaderId . "','" . $jsonValue['USERID'] . "')";
    $res = mysql_query($sqlInsertToTmp);
    if ($res) {
        echo 200;
    } else {
        echo $res;
    }
} else {
    echo 505;
}
<?php

session_start();
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../com.gogetrich.function/CredentialValidationService.php';
$now = time();
if ($now > $_SESSION['expire']) {
    $service = new CredentialValidationService();
    $result = $service->invalidToken($_SESSION['token']);
    if ($result == 200) {
        unset($_SESSION['token']);
        echo 409;
    }
} else {
    echo 200;
}
<?php

session_start();
require '../../model/com.gogetrich.function/CredentialValidationService.php';
require '../../model-db-connection/config.php';
$serviceCheck = new CredentialValidationService();
if (!isset($_SESSION['token'])) {
    echo '<script type="text/javascript">window.location.href="../../index.php";</script>';
} else {
    if ($serviceCheck->checkIsTokenValid($_SESSION['token']) == 409) {
        echo '<script type="text/javascript">window.location.href="../loginError?rc=' . md5(409) . '&aRed=true";</script>';
    } else {
        $now = time();
        if ($now > isset($_SESSION['expire'])) {
            $timeOut = $serviceCheck->invalidToken($_SESSION['token']);
            if ($timeOut == 200) {
                echo '<script type="text/javascript">' . 'window.location.href="../loginError?rc=' . md5(409) . '&aRed=true";" ' . '</script>';
            }
        } else {
            $jsonObj = $serviceCheck->getTokenDetail($_SESSION['token']);
            $jsonValue = json_decode($jsonObj, true);
        }
    }
}
$cid = (string) filter_input(INPUT_GET, 'cid');
$flag = (string) filter_input(INPUT_GET, 'f');
if ($flag == "create") {
    $sqlGetCateDetail = "SELECT * FROM GTRICH_BLOG_CATEGORY WHERE B_CATE_ID=''";
    $resultGetCateDetail = mysql_query($sqlGetCateDetail);
    //Fake input if create type
    $rowGetCateDetail = mysql_fetch_assoc($resultGetCateDetail);
<?php

session_start();
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$config = (require '../../model-db-connection/GoGetRighconf.properties.php');
require './CredentialValidationService.php';
require '../../model-db-connection/config.php';
$now = time();
$service = new CredentialValidationService();
if ($now > $_SESSION['expire']) {
    $result = $service->invalidToken($_SESSION['token']);
    if ($result == 200) {
        unset($_SESSION['token']);
        echo 409;
    }
} else {
    if (isset($_SESSION['token'])) {
        $validToken = $service->checkIsTokenValid($_SESSION['token']);
        if ($validToken == 200) {
            $_SESSION['expire'] = time() + 60 * $config['application_timeout'];
            echo 200;
        } else {
            $service->invalidToken($_SESSION['token']);
            unset($_SESSION['token']);
            echo 409;
        }
    } else {