<?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.
 */
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;
}