/**
  * Метод обработки строковых данных
  *
  * @param mixed $data
  */
 public function clearStr($data)
 {
     $DataBaseObject = new DataBase();
     $connect = $DataBaseObject->Connect(self::HOST, self::USERNAME, self::PASSWORD, self::DATABASENAME);
     $data = trim(strip_tags($data));
     return mysqli_real_escape_string($connect, $data);
     //DataBase::escapeString($data);
 }
Beispiel #2
0
function TableData($Table)
{
    $DB = new DataBase();
    $DB->Connect();
    $RsData = $DB->fetchAssoc("data", $Table);
    foreach ($RsData as $ID => $Row) {
        $Type = explode("(", $Row['type']);
        $Row['type'] = $Type[0];
        $TableData[$Row['field']] = $Row['type'];
    }
    return $TableData;
}
Beispiel #3
0
<?php

include_once "../../classes/class.database.php";
include_once "../../functions/func.common.php";
/* CONECTION STARTS */
switch ($_SERVER["HTTP_HOST"]) {
    case "localhost":
        $DB = new DataBase();
        break;
    default:
        $DB = new DataBase();
        break;
}
/* REDIRECTS IF THERE WAS AN ERROR */
if (!$DB->Connect()) {
    header("Location: ../../includes/inc.error.php?error=" . $DB->Error);
}
include_dir("../../classes");
session_name("admin");
session_cache_expire(15800);
session_start();
/* SECURIRTY CHECKS */
$Security = new Security();
if ($Security->checkProfile($_SESSION['admin_id'])) {
    $Admin = new AdminData();
    $Cookies = new Login($Admin->User);
    $Cookies->setCookies();
    // $URL 	= 'http://localhost/projects/admin/files/modules/main/process.php';
    // $Meli 		= new Meli('4853777712698373', 'zhBim3Li6QKCTUht49YLnhpbT66CQwGm', $_SESSION['access_token'], $_SESSION['refresh_token']);
    // if(!$_SESSION['code'] && !$_SESSION['access_token']) {
    // 	// Redirects to ML if APP don't have access
Beispiel #4
0
<?php

session_name('testml');
session_start();
// session_destroy();
// die();
require '../../classes/class.meli.php';
require '../../classes/class.database.php';
$DB = new DataBase();
$DB->Connect();
$URL = 'https://renovatio-cheketo.c9users.io/files/modules/test/landing.php';
//$CallBack = 'https://renovatio-cheketo.c9users.io/files/modules/test/landing.php';
$Meli = new Meli('1204162705833882', '9BSgeYbRpo4PCAOaCqYzhEqPo7354DyY', $_SESSION['access_token'], $_SESSION['refresh_token']);
$UserData = $DB->fetchAssoc("admin_user", "*", "admin_id=8");
$_SESSION['code'] = $UserData[0]['code'];
$_SESSION['access_token'] = $UserData[0]['access_token'];
$_SESSION['refresh_token'] = $UserData[0]['refresh_token'];
$_SESSION['expires_in'] = $UserData[0]['expires_in'];
if (!$_SESSION['code']) {
    header("Location: " . $Meli->getAuthUrl($URL, Meli::$AUTH_URL['MLA']));
    die;
} else {
    if (!$_SESSION['access_token']) {
        // If the code was in get parameter we authorize
        $UserML = $Meli->authorize($_SESSION['code'], $URL);
        // Now we create the sessions with the authenticated user
        $_SESSION['access_token'] = $UserML['body']->access_token;
        $_SESSION['expires_in'] = time() + $UserML['body']->expires_in;
        $_SESSION['refresh_token'] = $UserML['body']->refresh_token;
        $DB->execQuery("UPDATE", "admin_user", "access_token='" . $_SESSION['access_token'] . "', refresh_token='" . $_SESSION['refresh_token'] . "', expires_in=" . $_SESSION['expires_in'], "admin_id=8");
        //echo "AT".$DB->lastQuery();