コード例 #1
0
 public function __construct($argError, $argCode = NULL, $argPrevius = NULL)
 {
     // 書き換える前のエラーをロギングしておく
     logging($argError . PATH_SEPARATOR . var_export(debug_backtrace(), TRUE), 'exception');
     debug($argError);
     // 通常は500版のインターナルサーバエラー
     $msg = 'Internal Server Error';
     // RESTfulエラーコード&メッセージ定義
     if (400 === $argCode) {
         // バリデーションエラー等、必須パラメータの有無等の理由によるリクエスト自体の不正
         $msg = 'Bad Request';
     } elseif (401 === $argCode) {
         // ユーザー認証の失敗
         $msg = 'Unauthorized';
     } elseif (404 === $argCode) {
         // 許可されていない(もしくは未定義の)リソース(モデル)へのアクセス
         $msg = 'Not Found';
     } elseif (405 === $argCode) {
         // 許可されていない(もしくは未定義の)リソースメソッドの実行
         $msg = 'Method Not Allowed';
     } elseif (503 === $argCode) {
         // メンテナンスや制限ユーザー等の理由による一時利用の制限中
         $msg = 'Service Unavailable';
     }
     parent::__construct($msg, $argCode, $argPrevius);
 }
コード例 #2
0
ファイル: db_pdo.php プロジェクト: refirio/levis
/**
 * Connect to the database.
 *
 * @return void
 */
function db_driver_connect()
{
    global $_db;
    if ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_mysql') {
        $dsn = 'mysql:dbname=' . $_db['resource'][$_db['target']]['config']['name'] . ';host=' . $_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ';port=' . $_db['resource'][$_db['target']]['config']['port'] : '');
    } elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_pgsql') {
        $dsn = 'pgsql:dbname=' . $_db['resource'][$_db['target']]['config']['name'] . ';host=' . $_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ';port=' . $_db['resource'][$_db['target']]['config']['port'] : '');
    } elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite') {
        $dsn = 'sqlite:' . $_db['resource'][$_db['target']]['config']['name'];
    } elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite2') {
        $dsn = 'sqlite2:' . $_db['resource'][$_db['target']]['config']['name'];
    }
    if ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_mysql') {
        $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true);
    } elseif ($_db['resource'][$_db['target']]['config']['type'] === 'pdo_pgsql' or $_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite' or $_db['resource'][$_db['target']]['config']['type'] === 'pdo_sqlite2') {
        $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT);
    }
    try {
        $_db['resource'][$_db['target']]['dbh'] = new PDO($dsn, $_db['resource'][$_db['target']]['config']['username'], $_db['resource'][$_db['target']]['config']['password'], $options);
    } catch (PDOException $e) {
        if (LOGGING_MESSAGE) {
            logging('message', 'db: Connect error');
        }
        error('db: Connect error');
    }
    return;
}
コード例 #3
0
ファイル: controllers.php プロジェクト: nmyers/Microfolio
function ctrl_login() {
    global $cfg;
    $cfg['in_admin'] = true;
    $output['admin_title']='login';
    if (logging(getPost('username'), getPost('password'))) {
        redirect("admin/projects/");
    } else {
        output("login.html.php",$output);
    }
}
コード例 #4
0
ファイル: db_sqlite.php プロジェクト: refirio/levis
/**
 * Connect to the database.
 *
 * @return void
 */
function db_driver_connect()
{
    global $_db;
    $_db['resource'][$_db['target']]['dbh'] = sqlite_open($_db['resource'][$_db['target']]['config']['name'], 0666, $error);
    if (!$_db['resource'][$_db['target']]['dbh']) {
        if (LOGGING_MESSAGE) {
            logging('message', 'db: Connect error');
        }
        error('db: Connect error');
    }
    return;
}
コード例 #5
0
ファイル: db_pgsql.php プロジェクト: refirio/levis
/**
 * Connect to the database.
 *
 * @return void
 */
function db_driver_connect()
{
    global $_db;
    $_db['resource'][$_db['target']]['dbh'] = pg_connect('host=' . $_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ' port=' . $_db['resource'][$_db['target']]['config']['port'] : '') . ' dbname=' . $_db['resource'][$_db['target']]['config']['name'] . ' user='******'resource'][$_db['target']]['config']['username'] . ' password='******'resource'][$_db['target']]['config']['password'], true);
    if (!$_db['resource'][$_db['target']]['dbh']) {
        if (LOGGING_MESSAGE) {
            logging('message', 'db: Connect error');
        }
        error('db: Connect error');
    }
    return;
}
コード例 #6
0
 /**
  */
 protected static function _clearCacheImage($argFilePath, $argMemcacheDSN = NULL)
 {
     $DSN = NULL;
     if (NULL === $argMemcacheDSN && class_exists('Configure') && NULL !== Configure::constant('MEMCACHE_DSN')) {
         $DSN = Configure::MEMCACHE_DSN;
     } else {
         $DSN = $argMemcacheDSN;
     }
     if (NULL !== $DSN && class_exists('Memcache', FALSE)) {
         try {
             Memcached::start($DSN);
             @Memcached::delete($argFilePath);
         } catch (Exception $Exception) {
             logging(__CLASS__ . PATH_SEPARATOR . __METHOD__ . PATH_SEPARATOR . __LINE__ . PATH_SEPARATOR . $Exception->getMessage(), 'exception');
         }
     }
     return true;
 }
コード例 #7
0
ファイル: Application.php プロジェクト: radiumdigital/caramel
 public function addHandlers($hostPattern, $hostHandlers)
 {
     if ($hostPattern[0] != '^') {
         $hostPattern = '/^' . $hostPattern;
     }
     if ($hostPattern[strlen($hostPattern) - 1] != '$') {
         $hostPattern = $hostPattern . '$/';
     }
     $handlers = [];
     foreach ($hostHandlers as $spec) {
         if (in_array(count($spec), [2, 3, 4])) {
             $name = null;
             $kargs = [];
             if (count($spec) == 2) {
                 list($pattern, $handler) = $spec;
             } else {
                 if (count($spec) == 3) {
                     if (is_array($spec[2])) {
                         list($pattern, $handler, $kargs) = $spec;
                     } else {
                         list($pattern, $handler, $name) = $spec;
                     }
                 } else {
                     if (count($spec) == 4) {
                         list($pattern, $handler, $name, $kargs) = $spec;
                     }
                 }
             }
             $spec = new URLSpec($pattern, $handler, $name, $kargs);
             $handlers[] = $spec;
             if ($spec->name) {
                 if (array_key_exists($spec->name, $this->namedHandlers)) {
                     logging('Multiple handlers named ' . $spec->name . '; replacing previous value');
                 }
                 $this->namedHandlers[$spec->name] = $spec;
             }
         }
     }
     if (array_key_exists($hostPattern, $this->handlers)) {
         $this->handlers[$hostPattern] = array_merge($handlers, $this->handlers[$hostPattern]);
     } else {
         $this->handlers[$hostPattern] = $handlers;
     }
 }
コード例 #8
0
ファイル: db_mysql.php プロジェクト: refirio/levis
/**
 * Connect to the database.
 *
 * @return void
 */
function db_driver_connect()
{
    global $_db;
    $_db['resource'][$_db['target']]['dbh'] = mysql_connect($_db['resource'][$_db['target']]['config']['host'] . ($_db['resource'][$_db['target']]['config']['port'] ? ':' . $_db['resource'][$_db['target']]['config']['port'] : ''), $_db['resource'][$_db['target']]['config']['username'], $_db['resource'][$_db['target']]['config']['password'], true);
    if (!$_db['resource'][$_db['target']]['dbh']) {
        if (LOGGING_MESSAGE) {
            logging('message', 'db: Connect error');
        }
        error('db: Connect error');
    }
    $resource = mysql_select_db($_db['resource'][$_db['target']]['config']['name'], $_db['resource'][$_db['target']]['dbh']);
    if (!$resource) {
        if (LOGGING_MESSAGE) {
            logging('message', 'db: Connect error');
        }
        error('db: Select DB error');
    }
    return;
}
コード例 #9
0
ファイル: txp_prefs.php プロジェクト: bgarrels/textpattern
function pCell($item, $var, $format, $size = "", $nohelp = "")
{
    $var = stripslashes($var);
    $out = tda(gTxt($item), ' style="text-align:right;vertical-align:middle"');
    switch ($format) {
        case "radio":
            $in = yesnoradio($item, $var);
            break;
        case "input":
            $in = text_input($item, $var, $size);
            break;
        case "timeoffset":
            $in = timeoffset_select($item, $var);
            break;
        case 'commentmode':
            $in = commentmode($item, $var);
            break;
        case 'cases':
            $in = cases($item, $var);
            break;
        case 'dateformats':
            $in = dateformats($item, $var);
            break;
        case 'weeks':
            $in = weeks($item, $var);
            break;
        case 'logging':
            $in = logging($item, $var);
            break;
        case 'languages':
            $in = languages($item, $var);
            break;
        case 'text':
            $in = text($item, $var);
            break;
        case 'urlmodes':
            $in = urlmodes($item, $var);
    }
    $out .= td($in);
    $out .= $nohelp != 1 ? tda(popHelp($item), ' style="vertical-align:middle"') : td();
    return tr($out);
}
コード例 #10
0
function sendGoogleCloudMessage($data, $ids)
{
    //echo "Push\n";
    $apiKey = 'AIzaSyDOuSpNEoCGMB_5SXaA1Zj7Dtnzyyt6TPc';
    $url = 'https://gcm-http.googleapis.com/gcm/send';
    // Set GCM post variables (device IDs and push payload)
    $post = array('registration_ids' => $ids, 'data' => $data);
    // Set CURL request headers (authentication and type)
    $headers = array('Authorization: key=' . $apiKey, 'Content-Type: application/json');
    // Initialize curl handle
    $ch = curl_init();
    // Set URL to GCM endpoint
    curl_setopt($ch, CURLOPT_URL, $url);
    // Set request method to POST
    curl_setopt($ch, CURLOPT_POST, true);
    // Set our custom headers
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    // Get the response back as string instead of printing it
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    // Set JSON post data
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post));
    // echo json_encode( $headers) . "\n";
    logging("dataGCM", json_encode($post));
    //    echo "\n";
    // Actually send the push
    $result = curl_exec($ch);
    // Error handling
    if (curl_errno($ch)) {
        //echo 'GCM error: ' . curl_error( $ch );
        return 'GCM error: ' . curl_error($ch);
    }
    // Close curl handle
    curl_close($ch);
    // Debug GCM response
    //echo $result;
    return $result;
}
コード例 #11
0
ファイル: pdo_mysql.php プロジェクト: zhangzhengyu/ThinkSAAS
 /**
  * 报错
  * @param unknown $err
  */
 function error($err)
 {
     $log = "TIME:" . date('Y-m-d :H:i:s') . "\n";
     $log .= "SQL:" . $err . "\n";
     $log .= "REQUEST_URI:" . $_SERVER['REQUEST_URI'] . "\n";
     $log .= "--------------------------------------\n";
     logging(date('Ymd') . '-mysql-error.txt', $log);
 }
コード例 #12
0
ファイル: Auth.class.php プロジェクト: phish108/PowerTLA
 /**
  * @return the Consumer key (= app key)
  *
  *
  */
 protected function generateConsumerTokens($appId, $uuid)
 {
     global $ilDB;
     // creates a new database table for the registration if no one exists yet
     logging(" check if our table is present already ");
     if (!in_array("ui_uihk_xmob_reg", $ilDB->listTables())) {
         logging("create a new table");
         //create table that will store the app keys and any such info in the database
         //ONLY CREATE IF THE TABLE DOES NOT EXIST
         $fields = array("app_id" => array('type' => 'text', 'length' => 255), "uuid" => array('type' => 'text', 'length' => 255), "consumer_key" => array('type' => 'text', 'length' => 255), "consumer_secret" => array('type' => 'text', 'length' => 255));
         $ilDB->createTable("isnlc_reg_info", $fields);
     }
     if (in_array("ui_uihk_xmob_reg", $ilDB->listTables())) {
         //if for the specified app id and uuid an client key (= app key) already exists, use this one instead of creating a new one
         $result = $ilDB->query("SELECT consumer_key FROM ui_uihk_xmob_reg WHERE uuid = " . $ilDB->quote($uuid, "text") . " AND app_id =" . $ilDB->quote($appId, "text"));
         $fetch = $ilDB->fetchAssoc($result);
         logging("fetch: " . json_encode($fetch));
         $consumerKey = $fetch["consumer_key"];
         $consumerSecret = $fetch["consumer_secret"];
         //if no consumer
         if ($consumerKey == null && $consumerSecret == null) {
             $randomSeed = rand();
             //$consumerKey = md5($uuid . $appId . $randomSeed);
             // generate consumer key and consumer secret
             $hash = sha1(mt_rand());
             $consumerKey = substr($hash, 0, 30);
             $consumerSecret = substr($hash, 30, 10);
             //store the new client key (= app key) in the database
             $affected_rows = $ilDB->manipulateF("INSERT INTO ui_uihk_xmob_reg (app_id, uuid, consumer_key, consumer_secret) VALUES " . " (%s,%s,%s)", array("text", "text", "text", "text"), array($appId, $uuid, $consumerKey, $consumerSecret));
             // if this fails we must not return the app key
             logging("return consumer tokens " . $consumerKey . " and " . $consumerSecret);
         }
     }
     //return the consumerKey and consumerSecret in an array
     $data = array("consumerKey" => $consumerKey, "consumerSecret" => $consumerSecret);
     return $data;
 }
コード例 #13
0
                         died("Could NOT copy the file!");
                     }
                     suppr("{$bazar_dir}/{$pic_path}/{$_picture}");
                 }
             }
         }
     }
     if ($picture_del) {
         $picture = "";
         $_picture = "";
     }
     // Database Update
     $query = mysql_query("update " . $prefix . "userdata\n\t\t\t\t\t\t    set sex = '{$_POST['sex']}',\n\t\t\t\t                    newsletter = '{$_POST['newsletter']}',\n\t\t\t\t\t\t    firstname = '{$_POST['firstname']}',\n\t\t\t\t\t\t    lastname = '{$_POST['lastname']}',\n\t\t\t\t\t\t    address = '{$_POST['address']}',\n\t\t\t\t\t\t    zip = '{$_POST['zip']}',\n\t\t\t\t\t\t    city = '{$_POST['city']}',\n\t\t\t\t\t\t    state = '{$_POST['state']}',\n\t\t\t\t\t\t    country = '{$_POST['country']}',\n\t\t\t\t\t\t    phone = '{$_POST['phone']}',\n\t\t\t\t\t\t    cellphone = '{$_POST['cellphone']}',\n\t\t\t\t\t\t    icq = '{$_POST['icq']}',\n\t\t\t\t\t\t    homepage = '{$_POST['homepage']}',\n\t\t\t\t\t\t    hobbys = '{$_POST['hobbys']}',\n                                                    picture= '{$picture}',\n                                                    _picture= '{$_picture}',\n\t\t\t\t\t\t    field1 = '{$_POST['field1']}',\n\t\t\t\t\t\t    field2 = '{$_POST['field2']}',\n\t\t\t\t\t\t    field3 = '{$_POST['field3']}',\n\t\t\t\t\t\t    field4 = '{$_POST['field4']}',\n\t\t\t\t\t\t    field5 = '{$_POST['field5']}',\n\t\t\t\t\t\t    field6 = '{$_POST['field6']}',\n\t\t\t\t\t\t    field7 = '{$_POST['field7']}',\n\t\t\t\t\t\t    field8 = '{$_POST['field8']}',\n\t\t\t\t\t\t    field9 = '{$_POST['field9']}',\n\t\t\t\t\t\t    field10 = '{$_POST['field10']}',\n\t\t\t\t\t\t    timezone = '{$_POST['timezone']}',\n\t\t\t\t\t\t    dateformat = '{$_POST['dateformat']}'\n\t\t\t    where id = '{$_SESSION['suserid']}'") or died(mysql_error());
     $_SESSION[susertimezone] = $_POST[timezone];
     $_SESSION[suserdateformat] = $_POST[dateformat];
     logging("X", "{$_SESSION['suserid']}", "{$_SESSION['susername']}", "AUTH: updated data", "");
     if (!$query) {
         $m_update = $error[20];
     } else {
         $m_update = 2;
     }
 }
 if ($m_update != 2) {
     died($m_update);
     #       $errormessage=rawurlencode($m_update);
     #	header(headerstr("members.php?choice=myprofile&status=6&errormessage=$errormessage"));
     exit;
 } else {
     header(headerstr("members.php?choice=myprofile&status=5"));
     exit;
 }
コード例 #14
0
ファイル: index.php プロジェクト: pantc12/CPRTeam-TelegramBOT
header('Accept: application/json');
include_once 'config.php';
include_once 'logging.php';
include_once 'commands.php';
include_once 'tools.php';
include_once 'api.php';
// Get Telegram Hooks POST Data
$json = file_get_contents('php://input') . PHP_EOL;
$data = json_decode($json, true);
// Logging Hooks Data Raw
$time = date('Y-m-d H:i:s', time());
logging("hooks_raw", "<" . $time . ">" . PHP_EOL);
logging("hooks_raw", $json);
// Logging Hooks Data Array
logging("hooks", "<" . $time . ">" . PHP_EOL);
logging("hooks", $data);
// Global Variable
$updateID = $data['update_id'];
$messageID = $data['message']['message_id'];
$fromID = $data['message']['from']['id'];
$chatID = $data['message']['chat']['id'];
$date = $data['message']['date'];
$userName = $data['message']['from']['username'];
$message = $data['message']['text'];
if ($userName != "") {
    if ($chatID == -6205296) {
        $db = new SQLite3('bot.db');
        $db->exec("CREATE TABLE IF NOT EXISTS `CPRTeam_STAFF` (\n            `id`    INTEGER PRIMARY KEY AUTOINCREMENT,\n            `uid`   TEXT NOT NULL,\n            `username`  TEXT\n        )");
        $query = $db->query("SELECT * FROM CPRTeam_STAFF WHERE uid = '{$fromID}'");
        $i = 0;
        $row = array();
コード例 #15
0
// echo $result . "\n";
logging("ResultCompare", json_encode($_GET));
//Log file
$pathOfLog = "C:/data/log/";
$t = time();
$logName = 'CompareLog-' . date("Y-m-d", $t) . '.txt';
$logText = date("Y-m-d", $t) . '-' . date("h:i:sa") . " " . json_encode($_GET) . PHP_EOL;
file_put_contents($pathOfLog . $logName, $logText, FILE_APPEND);
if (strcmp($result, "") != 0) {
    if (strcmp($mode, "NoticeFindClue") == 0) {
        $notice_id = $input;
        $clue_id = $result;
        $clue_list = explode(",", $clue_id);
        for ($i = 0; $i < sizeof($notice_list); $i++) {
            logging("ResultGCM", prepareNotificationOneClueOneNotice($clue_list[$i], $notice_id));
        }
    } else {
        if (strcmp($mode, "ClueFindNotice") == 0) {
            $clue_id = $input;
            $notice_id = $result;
            logging("ResultGCM", prepareNotificationOneClueManyNotice($clue_id, $notice_id));
        } else {
            if (strcmp($mode, "DirectClueToNotice") == 0) {
                $clue_id = $input;
                $notice_id = $result;
                logging("ResultGCM", prepareNotificationOneClueOneNotice($clue_id, $notice_id));
            }
        }
    }
}
exit;
コード例 #16
0
 /**
  * トークンを固有識別子まで分解する
  * 分解したトークンの有効期限チェックを自動で行います
  * XXX 各システム毎に、Tokenの仕様が違う場合はこのメソッドをオーバーライドして実装を変更して下さい
  * @param string トークン文字列
  * @return mixed パースに失敗したらFALSE 成功した場合はstring 固有識別子を返す
  */
 protected static function _tokenToIdentifier($argToken, $argUncheck = FALSE)
 {
     $token = $argToken;
     // 暗号化されたトークンの本体を取得
     $encryptedToken = substr($token, 0, strlen($token) - 14);
     // トークンが発行された日時分秒文字列
     $tokenExpierd = substr($token, strlen($token) - 14, 14);
     debug('$tokenExpierd=' . $tokenExpierd . '&$encryptedToken=' . $encryptedToken);
     // トークンを複合
     $decryptToken = Utilities::doHexDecryptAES($encryptedToken, self::$_cryptKey, self::$_cryptIV);
     // XXXデフォルトのUUIDはSHA256
     $identifier = substr($decryptToken, 0, strlen($decryptToken) - 14);
     // トークンの中に含まれていた、トークンが発行された日時分秒文字列
     $tokenTRUEExpierd = substr($decryptToken, strlen($decryptToken) - 14, 14);
     debug('tokenIdentifier=' . $identifier);
     debug('$tokenTRUEExpierd=' . $tokenTRUEExpierd . '&$decryptToken=' . $decryptToken);
     // expierdの偽装チェックはココでしておく
     if (FALSE === $argUncheck && FALSE === (strlen($tokenExpierd) == 14 && $tokenExpierd == $tokenTRUEExpierd)) {
         // $tokenExpierdと$tokenTRUEExpierdが一致しない=$tokenExpierdが偽装されている!?
         // XXX ペナルティーレベルのクラッキングアクセス行為に該当
         logging(__CLASS__ . PATH_SEPARATOR . __METHOD__ . PATH_SEPARATOR . __LINE__, "hack");
         // パースに失敗したとみなす
         return FALSE;
     }
     // tokenの有効期限のチェック
     $year = substr($tokenTRUEExpierd, 0, 4);
     $month = substr($tokenTRUEExpierd, 4, 2);
     $day = substr($tokenTRUEExpierd, 6, 2);
     $hour = substr($tokenTRUEExpierd, 8, 2);
     $minute = substr($tokenTRUEExpierd, 10, 2);
     $second = substr($tokenTRUEExpierd, 12, 2);
     $tokenexpiredatetime = (int) Utilities::date('U', $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minute . ':' . $second, 'GMT');
     $expiredatetime = (int) Utilities::modifyDate("-" . (string) self::$_expiredtime . 'sec', 'U', NULL, NULL, 'GMT');
     debug('$tokenTRUEExpierd=' . $tokenTRUEExpierd . '&$tokenexpiredatetime=' . $tokenexpiredatetime . '&$expiredatetime=' . $expiredatetime);
     if (FALSE === $argUncheck && $tokenexpiredatetime < $expiredatetime) {
         return FALSE;
     }
     debug('tokenIdentifier=' . $identifier);
     return $identifier;
 }
コード例 #17
0
ファイル: project-list.php プロジェクト: iandeeph/ryoku
 // =================================================== LOGING
 foreach ($_POST['checkboxProjectList'] as $selectedIdProjectList) {
     $upprojDetQry = "SELECT \n                    project.idproject as idproject,\n                    project.name as name,\n                    project.contentWord as contentWord,\n                    project.location as location,\n                    project.date as date,\n                    project.category as category,\n                    project.product as product,\n                    client.name as clientName\n                    FROM \n                        project,\n                        client\n                    WHERE project.idclient = client.idclient AND project.idproject = '" . $selectedIdProjectList . "'";
     if ($delresultProjDetail = mysqli_query($conn, $upprojDetQry) or die("Query failed :" . mysqli_error($conn))) {
         if (mysqli_num_rows($delresultProjDetail) > 0) {
             $delrowProjDetail = mysqli_fetch_array($delresultProjDetail);
             $delidProject = $delrowProjDetail['idproject'];
             $delnameProjDetail = $delrowProjDetail['name'];
             $delcontentWordProjDetail = $delrowProjDetail['contentWord'];
             $delnameClientProjDetail = $delrowProjDetail['clientName'];
             $dellocationProjDetail = $delrowProjDetail['location'];
             $deldateProjDetail = $delrowProjDetail['date'];
             $delcatProjDetail = $delrowProjDetail['category'];
             $delprodProjDetail = $delrowProjDetail['product'];
             $logingText = "Name : " . $delnameProjDetail . "<br>Category : " . $delcatProjDetail . "<br>Location : " . $dellocationProjDetail . "<br>Date : " . $deldateProjDetail . "<br>Product : " . $delprodProjDetail . "<br>Client Name : " . $delnameClientProjDetail . "<br>Description :<br>" . $delcontentWordProjDetail;
             logging($now, $user, "Delete Project Items", $logingText, $delidProject);
         }
     }
 }
 // =================================================== LOGING
 if (mysqli_query($conn, $delProjQry)) {
     $delImagesQry = "DELETE FROM images WHERE owner = 'project' AND idowner in (" . implode($_POST['checkboxProjectList'], ',') . ")";
     if (mysqli_query($conn, $delImagesQry)) {
         $unsetImagesQry = "SELECT path FROM images WHERE owner = 'project' AND idowner in (" . implode($_POST['checkboxProjectList'], ',') . ")";
         if ($resultPathImages = mysqli_query($conn, $unsetImagesQry)) {
             if (mysqli_num_rows($resultPathImages) > 0) {
                 $rowPathImages = mysqli_fetch_array($resultPathImages);
                 $pathImages = $rowPathImages['path'];
                 unlink("../" . $pathImages);
                 header('Location: ./index.php?menu=project&cat=list');
             }
コード例 #18
0
ファイル: main.php プロジェクト: refirio/levis
import('libs/cores/info.php');
import('libs/cores/db.php');
import('libs/cores/test.php');
bootstrap();
session();
database();
normalize();
routing();
if (LOGGING_GET) {
    logging('get');
}
if (LOGGING_POST && !empty($_POST)) {
    logging('post');
}
if (LOGGING_FILES && !empty($_FILES)) {
    logging('files');
}
switch ($_REQUEST['_mode']) {
    case 'info_php':
        info_php();
        break;
    case 'info_levis':
        info_levis();
        break;
    case 'db_admin':
        db_admin();
        break;
    case 'db_migrate':
        db_migrate();
        break;
    case 'db_scaffold':
コード例 #19
0
ファイル: StoreClueData.php プロジェクト: paratab/Proj_ImgApp
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $clue_id);
while (mysqli_stmt_fetch($statement)) {
    $clue["clueId"] = $clue_id;
}
$path = "/image/clue/" . $clue_id . ".jpg";
file_put_contents(getcwd() . $path, $decodeImage);
$_POST["imageString"] = $path;
$query = "INSERT INTO clue_image(clueId, path) VALUES (?, ?)";
$statement = mysqli_prepare($con, $query);
mysqli_stmt_bind_param($statement, "ss", $clue_id, $path);
$success = mysqli_stmt_execute($statement);
if (!$success) {
    echo json_encode($clue);
    exit;
} else {
    $clue["resultStoreClueImage"] = 1;
}
//echo json_encode($clue);
mysqli_stmt_close($statement);
mysqli_close($con);
echo json_encode($clue);
$clue["logging"] = logging("Store_Clue_Data", json_encode($_POST));
if ($notice_id != -1) {
    createDatabaseImageOnly("clue", $clue_id);
    pushNotifiactionForDirectClueAdd($clue_id, $notice_id);
} else {
    $extFile = createExtFile("notice");
    callExeOfImageFindNotice("clue", $clue_id, $extFile);
    //sendToImgPart();
}
コード例 #20
0
ファイル: hook.php プロジェクト: HuangJi/SITCON-TelegramBot
function run_shell_cmd($cmd, $param, $do_sprint = true, $private = false)
{
    if ($do_sprint) {
        $cmd = sprintf($cmd, $param);
    }
    logging("Shell Command: " . $cmd);
    exec("{$cmd}", $output, $status);
    $msg = '@' . $GLOBALS['userName'] . PHP_EOL;
    foreach ($output as $line) {
        $msg .= $line . PHP_EOL;
    }
    if ($private) {
        sendPrivateMsg($msg);
    } else {
        sendMsg($msg);
    }
}
コード例 #21
0
ファイル: db.php プロジェクト: refirio/levis
/**
 * Import SQL from the file.
 *
 * @param string $file
 *
 * @return int
 */
function db_import($file)
{
    if ($fp = fopen($file, 'r')) {
        $sql = '';
        $i = 0;
        $flag = true;
        db_transaction();
        while ($line = fgets($fp)) {
            $line = str_replace("\r\n", "\n", $line);
            $line = str_replace("\r", "\n", $line);
            if ((substr_count($line, '\'') - substr_count($line, '\\\'')) % 2 !== 0) {
                $flag = !$flag;
            }
            $sql .= $line;
            if (preg_match('/;$/', trim($line)) && $flag) {
                $resource = db_query($sql);
                if (!$resource) {
                    db_rollback();
                    if (LOGGING_MESSAGE) {
                        logging('message', 'db: Query error: ' . db_error());
                    }
                    error('db: Query error' . (DEBUG_LEVEL ? ': ' . db_error() : ''));
                }
                $sql = '';
                $i++;
            }
        }
        fclose($fp);
        db_commit();
    } else {
        error('db: Import file can\'t read');
    }
    return $i;
}
コード例 #22
0
ファイル: class.bot.php プロジェクト: joancefet/Beta7
 static function log($LOG)
 {
     if (function_exists('logging')) {
         logging('bot', $LOG);
     } else {
         $handle = fopen(ROOT_PATH . 'includes/' . date('Y_m_d') . '_bot.log', 'a+');
         if ($handle !== false) {
             fwrite($handle, '[' . date('H:i:s') . '] ' . $LOG . "\n");
             fflush($handle);
             fclose($handle);
         }
     }
 }
コード例 #23
0
 /**
  * 通知(JSON)
  */
 public function pushJson($argDeviceIdentifier, $argDeviceType, $argments)
 {
     $this->_init();
     $newEndpoint = NULL;
     $deviceEndpoint = $argDeviceIdentifier;
     logging('endpoint=' . $deviceEndpoint, 'push');
     if (FALSE === strpos('arn:aws:sns:', $argDeviceIdentifier)) {
         // エンドポイント指定では無いので、先ずはAESにEndpoint登録をする
         logging('create endpoint:' . $deviceEndpoint . ':' . $argDeviceType, 'push');
         $res = $this->createPlatformEndpoint($argDeviceIdentifier, $argDeviceType);
         logging('pushJson for create endpoint res=', 'push');
         logging($res, 'push');
         if (FALSE !== $res) {
             $newEndpoint = $res['EndpointArn'];
             $deviceEndpoint = $newEndpoint;
         }
     }
     try {
         $targetPratform = 'APNS_SANDBOX';
         if (TRUE !== isTest() && TRUE === ('iOS' === $argDeviceType || 'iPhone' === $argDeviceType || 'iPad' === $argDeviceType || 'iPod' === $argDeviceType)) {
             // 本番用のiOSPush通知
             $targetPratform = 'APNS';
         } else {
             // Android用はココ!
         }
         $json = array('MessageStructure' => 'json', 'TargetArn' => trim($deviceEndpoint));
         $json['Message'] = json_encode(array($targetPratform => json_encode(array('aps' => $argments))));
         logging($json, 'push');
         $res = $this->_AWS->publish($json);
     } catch (Exception $e) {
         logging($e->__toString(), 'push');
         return FALSE;
     }
     if (!is_array($res)) {
         $res = array('res' => $res);
     }
     if (NULL !== $newEndpoint) {
         $res['endpoint'] = $newEndpoint;
     }
     return $res;
 }
コード例 #24
0
file_put_contents(getcwd() . $path, $decodeImage);
$query = "UPDATE user_detail SET name = ?,email = ?, telephone = ? WHERE username = ? AND password = ?";
$statement = mysqli_prepare($con, $query);
mysqli_stmt_bind_param($statement, "sssss", $name, $email, $telephone, $username, $password);
$success = mysqli_stmt_execute($statement);
if (!$success) {
    echo json_encode($user);
    exit;
} else {
    $user["resultUpdateUserData"] = 1;
}
$query = "SELECT path FROM user_image WHERE username = ?";
$statement = mysqli_prepare($con, $query);
mysqli_stmt_bind_param($statement, "s", $username);
$success = mysqli_stmt_execute($statement);
if (!$success) {
    echo json_encode($user);
    exit;
} else {
    $user["resultUpdateUserImage"] = 1;
}
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $path);
while (mysqli_stmt_fetch($statement)) {
    $user["imagePath"] = $path;
    $_POST["imageString"] = $path;
}
echo json_encode($user);
mysqli_close($con);
logging("Update_User_Data", json_encode($_POST));
コード例 #25
0
                } else {
                    $chemail = $error[23];
                }
            } else {
                $mdhash = substr(md5($_SESSION[suserid] . $email . $secret), 0, 10);
                $query = mysql_query("insert into " . $prefix . "confirm_email values ('{$_SESSION['suserid']}', '{$email}', '{$mdhash}', now())");
                if (!$query) {
                    $chemail = $error[20];
                } else {
                    $confirmurl = "{$url_to_start}" . "/confirm_email.php?mdhash=" . "{$mdhash}" . "&id=" . "{$_SESSION['suserid']}" . "&email=" . "{$email}";
                    $mailto = "{$email}";
                    $subject = "{$mail_msg['16']}";
                    $message = "{$mail_msg['17']}\n\n{$confirmurl}\n\n{$mail_msg['18']}";
                    $from = "From: {$admin_email}\r\nReply-to: {$admin_email}\r\n";
                    @mail($mailto, $subject, $message, $from);
                    logging("X", "{$_SESSION['suserid']}", "{$_SESSION['susername']}", "AUTH: new email change", "");
                    $chemail = 2;
                }
            }
        }
    }
    if ($chemail != 2) {
        $errormessage = rawurlencode($chemail);
        header(headerstr("members.php?status=6&errormessage={$errormessage}"));
        exit;
    } else {
        $textmessage = rawurlencode($text_msg[2]);
        header(headerstr("members.php?status=4&textmessage={$textmessage}"));
        exit;
    }
}
コード例 #26
0
ファイル: test.php プロジェクト: refirio/levis
/**
 * Output a result page for test.
 *
 */
function test_exec()
{
    global $_view;
    if (auth() === false) {
        return;
    }
    if (!file_exists(MAIN_PATH . TEST_PATH)) {
        error('test: ' . MAIN_PATH . TEST_PATH . ' is not found.');
    }
    $index = 0;
    $result = 0;
    if (isset($_GET['_test'])) {
        if ($_GET['_test'] !== '' && !regexp_match('^[0-9\\:\\;]+$', $_GET['_test'])) {
            redirect('/?_mode=test_index');
        }
        $tests = explode(';', $_GET['_test']);
        $test = $tests[count($tests) - 1];
        if ($test !== '') {
            list($index, $result) = explode(':', $test);
        }
        $i = 0;
        $flag = false;
        if ($dh = opendir(MAIN_PATH . TEST_PATH)) {
            while (($entry = readdir($dh)) !== false) {
                if (!is_file(MAIN_PATH . TEST_PATH . $entry)) {
                    continue;
                }
                if ($regexp = regexp_match('^([_a-zA-Z0-9\\-]+)\\.php$', $entry)) {
                    $_GET['target'] = $regexp[1];
                } else {
                    continue;
                }
                if ($index == $i++) {
                    $index = $i;
                    $flag = true;
                    break;
                }
            }
            closedir($dh);
        } else {
            if (LOGGING_MESSAGE) {
                logging('message', 'test: Opendir error: ' . $target);
            }
            error('test: Opendir error' . (DEBUG_LEVEL ? ': ' . $target : ''));
        }
        if ($flag === false) {
            redirect('/?_mode=test_index&_test=' . $_GET['test']);
        }
    }
    if (!regexp_match('^[_a-zA-Z0-9\\-]+$', $_GET['target'])) {
        error('test: ' . $_GET['target'] . ' is not found.');
    }
    $_view['ok'] = 0;
    $_view['ng'] = 0;
    echo "<!DOCTYPE html>\n";
    echo "<html>\n";
    echo "<head>\n";
    echo "<meta charset=\"" . t(MAIN_CHARSET, true) . "\" />\n";
    echo "<title>Test</title>\n";
    style();
    echo "</head>\n";
    echo "<body>\n";
    echo "<h1>Test</h1>\n";
    echo "<pre>";
    list($micro, $second) = explode(' ', microtime());
    $time_start = $micro + $second;
    test_import(MAIN_PATH . TEST_PATH . $_GET['target'] . '.php');
    list($micro, $second) = explode(' ', microtime());
    $time_end = $micro + $second;
    $_view['time'] = ceil(($time_end - $time_start) * 10000) / 10000;
    echo "\n";
    echo "OK: " . $_view['ok'] . "\n";
    echo "NG: " . $_view['ng'] . "\n";
    echo "Time: " . $_view['time'] . " sec.\n";
    echo "</pre>\n";
    echo "<p><a href=\"" . t(MAIN_FILE, true) . "/?_mode=test_index\">Back to Index</a></p>\n";
    if (isset($_GET['_test'])) {
        $_view['url'] = MAIN_FILE . "/?_mode=test_exec&_test=" . $_GET['_test'] . ';' . $index . ":" . ($_view['ng'] ? 0 : 1);
        echo "<script>\n";
        echo "setTimeout('window.location.href = \\'" . $_view['url'] . "\\'', 1000);\n";
        echo "</script>\n";
        echo "<noscript>\n";
        echo "<p><a href=\"" . t($_view['url'], true) . "\">next</a></p>\n";
        echo "</noscript>\n";
    }
    echo "</body>\n";
    echo "</html>\n";
    exit;
}
コード例 #27
0
ファイル: status.php プロジェクト: jasanders/os-aios
function BuildContentPage()
{
    global $groupmode, $phpvars, $page, $logpage, $postlogpage, $GroupModeRefreshInterval, $FileModeRefreshInterval, $FileModeLog, $historymode, $hasusermenu;
    if ($groupmode) {
        currently_downloading($phpvars);
        queued_downloading($phpvars, $page);
        currently_processing($phpvars, $postlogpage);
        queued_processing($phpvars);
        historymain($phpvars);
        logging($phpvars, $logpage);
    } elseif ($historymode) {
        history($phpvars, $page);
    } else {
        filelist($phpvars, $page);
        if ($FileModeLog) {
            echo '<br>';
            logging($phpvars, $logpage);
        }
    }
    serverinfobox($phpvars);
    servercommandbox($phpvars);
    if ($hasusermenu) {
        usermenu($phpvars);
    }
    echo '<div style="display: none" id="updateinterval">' . ($groupmode ? $GroupModeRefreshInterval : $FileModeRefreshInterval) . '</div>';
    echo '<div style="display: none" id="downloadlimit">' . $phpvars['status']['DownloadLimit'] / 1024 . '</div>';
    if (isset($_COOKIE['upload_status'])) {
        echo '<div style="display: none" id="uploadstatushidden">' . $_COOKIE['upload_status'] . '</div>';
    }
    if (isset($_COOKIE['newzbin_status'])) {
        echo '<div style="display: none" id="newzbinstatushidden">' . $_COOKIE['newzbin_status'] . '</div>';
    }
}
コード例 #28
0
 public function execute($transforms, $args, $kargs = [])
 {
     $this->transforms = $transforms;
     try {
         if (!in_array($this->request->method, $this->SUPPORTED_METHOD)) {
             throw new HTTPError(405);
         }
         foreach ($kargs as $name => $v) {
             $this->pathKArgs[$name] = $this->decodeArgument($v, $name);
         }
         foreach ($args as $arg) {
             $this->pathArgs[] = $this->decodeArgument($arg);
         }
         if (!in_array($this->request->method, ['GET', 'HEAD', 'OPTIONS']) && array_key_exists('xsrf_cookie', $this->application->settings)) {
             $this->checkXsrfCookie();
         }
         $result = $this->prepare();
         $method = strtolower($this->request->method);
         $result = call_user_func_array([$this, $method], [$this->pathArgs, $this->pathKArgs]);
         if ($this->autoFinish && !$this->finished) {
             $this->finish();
         }
     } catch (\Exception $e) {
         logging('(Error) Request: <' . $this->request->uri . '> ' . $e->getMessage());
         $this->handleRequestException($e);
     }
 }
コード例 #29
0
ファイル: mysql.php プロジェクト: 994837457/BreakNgThinksaas
 /**
 * 发送查询语句
 * @param unknown $sql
 * @return resource
 */
 function query($sql)
 {
     $this->arrSql = $sql;
     //echo $sql;
     $this->result = mysql_query($sql, $this->conn);
     $this->queryCount++;
     // 记录SQL错误日志并继续执行
     if (!$this->result) {
         $log = "TIME:" . date('Y-m-d :H:i:s') . "\n";
         $log .= "SQL:" . $sql . "\n";
         $log .= "ERROR:" . mysql_error() . "\n";
         $log .= "REQUEST_URI:" . $_SERVER['REQUEST_URI'] . "\n";
         $log .= "--------------------------------------\n";
         logging(date('Ymd') . '-mysql-error.txt', $log);
     }
     // 记录SQL日志
     if ($GLOBALS['TS_CF']['logs']) {
         $log = "TIME:" . date('Y-m-d :H:i:s') . "\n";
         $log .= "SQL:" . $sql . "\n";
         $log .= "--------------------------------------\n";
         logging(date('Ymd') . '-mysql.txt', $log);
     }
     return $this->result;
 }
コード例 #30
0
ファイル: api.php プロジェクト: pantc12/CPRTeam-TelegramBOT
function sendChatAction($a)
{
    $cid = $GLOBALS['chatID'];
    $action = "";
    switch ($a) {
        case "sendMsg":
        case "sendSticker":
            $action = "typing";
            break;
        case "sendPhoto":
            $action = "upload_photo";
            break;
        case "sendVideo":
            $action = "upload_video";
            break;
        case "sendAudio":
        case "sendVoice":
            $action = "upload_audio";
            break;
        case "sendDoc":
            $action = "upload_document";
            break;
        default:
            $action = "typing";
            break;
    }
    $url = "https://api.telegram.org/bot" . TOKEN . "/sendChatAction?chat_id=" . $cid;
    $url .= "&action=" . $action;
    $ch = curl_init($url);
    curl_exec($ch);
    $time = date('Y-m-d H:i:s', time());
    $log = curl_getinfo($ch);
    logging("request", "<" . $time . ">" . PHP_EOL);
    logging("request", $log);
    curl_close($ch);
}