コード例 #1
0
ファイル: records.php プロジェクト: manishkhanchandani/mkgxy
     $ip = !empty($_REQUEST['ip']) ? $_REQUEST['ip'] : $_SERVER['REMOTE_ADDR'];
     $q = 'select * from users_info WHERE ip = ?';
     $res = $Models_General->fetchRow($q, array($ip), TIMEBIG);
     if (empty($res)) {
         $ipDetails = iptocity($ip);
         $d = array();
         $d['ip'] = $ip;
         $d['users_info'] = json_encode($ipDetails['result']);
         $Models_General->addDetails('users_info', $d);
         $res = $Models_General->fetchRow($q, array($ip), TIMEBIG);
     }
     $arr['users_info_id'] = $res['users_info_id'];
 }
 $Models_General->addDetails('access_tokens', $arr);
 $return['data'] = $arr;
 $return['data']['valid'] = validateAccessToken($_REQUEST['access_token']);
 $request_body = file_get_contents('php://input');
 $details = array();
 if (!empty($request_body)) {
     $details = json_decode($request_body, 1);
 } else {
     if ($_REQUEST['details']) {
         $details = $_REQUEST['details'];
     }
 }
 if (!empty($details)) {
     //update if we get details
     $q = 'select * from users WHERE uid = ?';
     $res = $Models_General->fetchRow($q, array($_REQUEST['id']), 0);
     $uArr = array();
     $uArr['uid'] = $_REQUEST['id'];
コード例 #2
0
ファイル: religion.php プロジェクト: manishkhanchandani/mkgxy
<?php

/*
API URLS
*/
try {
    include 'init.php';
    //pre defined variables
    if (empty($_GET['action'])) {
        throw new Exception('empty action');
    }
    $res = validateAccessToken($_REQUEST['access_token']);
    $return['uid'] = null;
    if (!empty($res)) {
        define('UID', $res['uid']);
        $return['uid'] = $res['uid'];
    }
    switch ($_GET['action']) {
        case 'saveReligion':
            ///religion/all
            ///religion/sections/id
            $DbTools = new DbTools();
            $_REQUEST['path'] = '/religion/all';
            $arr = $DbTools->add($tableName, $tableTag, $_REQUEST);
            if (empty($arr['id'])) {
                throw new Exception('could not create, please try again later');
            }
            $id = $arr['id'];
            $d = array();
            $d['path'] = '/religion/sections/' . $id;
            $d['title'] = 'General';