<?php

header('Access-Control-Allow-Origin: *');
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: text/plain');
if (!file_exists("include/config.php")) {
    header("Location:install.php");
    exit;
} else {
    include "_loader.php";
    $token = empty($_POST['token']) ? "" : $_POST['token'];
    if (!isset($token) || $token == "") {
        $token = empty($_GET['token']) ? "" : $_GET['token'];
    }
    if (!tok_val($token)) {
        header("Location:login.php?error=2");
        exit;
    }
}
$row_config_globale = $cnx->SqlRow("SELECT * FROM {$table_global_config}");
count($row_config_globale) > 0 ? $r = 'SUCCESS' : ($r = '');
if ($r != 'SUCCESS') {
    include "include/lang/english.php";
    echo "<div class='error'>" . translate($r) . "<br>";
    echo "</div>";
    exit;
}
if (empty($row_config_globale['language'])) {
    $row_config_globale['language'] = "english";
} else {
    echo "</div>";
    exit;
}
if (empty($row_config_globale['language'])) {
    $row_config_globale['language'] = "english";
}
include "include/lang/" . $row_config_globale['language'] . ".php";
$form_pass = empty($_POST['form_pass']) ? "" : $_POST['form_pass'];
if (!isset($form_pass) || $form_pass == "") {
    $form_pass = empty($_GET['form_pass']) ? "" : $_GET['form_pass'];
}
$token = empty($_POST['token']) ? "" : $_POST['token'];
if (!isset($token) || $token == "") {
    $token = empty($_GET['token']) ? "" : $_GET['token'];
}
if (tok_val($token)) {
    if (!checkAdminAccess($row_config_globale['admin_pass'], $form_pass) == true) {
        quick_Exit();
    }
} else {
    quick_Exit();
}
$op = empty($_GET['op']) ? "" : $_GET['op'];
$op = empty($_POST['op']) ? $op : $_POST['op'];
$list_id = empty($_GET['list_id']) ? "" : $_GET['list_id'];
$list_id = empty($_POST['list_id']) ? $list_id : $_POST['list_id'];
$action = empty($_GET['action']) ? "" : $_GET['action'];
$action = empty($_POST['action']) ? $action : $_POST['action'];
$page = empty($_GET['page']) ? "listes" : $_GET['page'];
$page = empty($_POST['page']) ? $page : $_POST['page'];
$data = empty($_GET['data']) ? "ch" : $_GET['data'];