当前位置: 首页>>代码示例>>PHP>>正文


PHP exit_fail函数代码示例

本文整理汇总了PHP中exit_fail函数的典型用法代码示例。如果您正苦于以下问题:PHP exit_fail函数的具体用法?PHP exit_fail怎么用?PHP exit_fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exit_fail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: switch

<?php

/*
	 
	 	main.php
*/
# Bringing in our sdk
require_once $_SERVER['DOCUMENT_ROOT'] . '/_includes/config.php';
# Selecting our item
switch ($_SERVER['HTTP_FUNCTION_NAME']) {
    # Sample Function
    case 'sample-function':
        require_once __DIR__ . '/_includes/sample-function.php';
        break;
        # No file to include
    # No file to include
    default:
        exit_fail('Sorry, that is an invalid function.');
}
开发者ID:nuQuery-Templates,项目名称:blank,代码行数:19,代码来源:main.php

示例2: define

# The user has turned this endpoint off for this specific session
if (isset($G_TOKEN_SESSION_DATA->{NQ_SESSION_GROUP}->access->{$_ENDPOINT})) {
    $block = !$G_TOKEN_SESSION_DATA->{NQ_SESSION_GROUP}->access->{$_ENDPOINT};
}
# If we need to block this endpoint
define('ENDPOINT_BLOCKED', $block);
# Clearing old burst rates
$query = "\tDELETE FROM\n\t\t\t\t" . NQ_TRACKING_BURST_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`seconds`<=" . (time() - NQ_BURST_RATE_LIFETIME);
mysqli_sub_query($G_CONTROLLER_DBLINK, $query);
# If our app has a burst rate
if ($G_APP_DATA['burst_rate'] > 0) {
    # Adding to our burst rate
    $time = (int) time();
    $query = "\tINSERT INTO\n\t\t\t\t\t" . NQ_TRACKING_BURST_TABLE . "\n\t\t\t\tSET\n\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . ",\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "',\n\t\t\t\t\t`seconds`\t=" . (int) $time . ",\n\t\t\t\t\t`count`\t\t=1\n\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\t`count`\t\t=`count`+1";
    mysqli_sub_query($G_CONTROLLER_DBLINK, $query);
    # Getting our burst dat
    $query = "\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . NQ_TRACKING_BURST_TABLE . "\n\t\t\t\tWHERE\n\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t\t`seconds`\t=" . (int) $time . "\n\t\t\t\tLIMIT 1";
    $burst_data = mysqli_single_result_query($G_CONTROLLER_DBLINK, $query);
    # If we have exceeded our quota
    if ($burst_data['count'] > $G_APP_DATA['burst_rate']) {
        # Adding our updating our exception
        $query = "\tINSERT INTO\n\t\t\t\t\t\t" . NQ_TRACKING_BURST_EXCEPTION_TABLE . "\n\t\t\t\t\tSET\n\t\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . ",\n\t\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "',\n\t\t\t\t\t\t`created`\t='" . date('Y-m-d H:i:s', $time) . "',\n\t\t\t\t\t\t`count`\t\t=" . (int) $burst_data['count'] . "\n\t\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\t\t`count`\t\t=" . (int) $burst_data['count'];
        mysqli_sub_query($G_CONTROLLER_DBLINK, $query);
        # Error message
        exit_fail(NQ_ERROR_BURST_LIMIT, LANG_BURST_LIMIT);
    }
}
# If we need to block from our validate file, in config file so we can respect lang settings
if (defined('ENDPOINT_BLOCKED') && ENDPOINT_BLOCKED) {
    exit_fail(NQ_ERROR_BLOCKED_ENDPOINT, LANG_ENDPOINT_BLOCKED);
}
开发者ID:nuQuery,项目名称:v1m0-api-email,代码行数:31,代码来源:validate-app.php

示例3: explode

     # Decoding our data
     $data = explode(',', fread($fsrc, filesize($tmpname)));
     $data = base64_decode($data[1]);
     fclose($fsrc);
     # Writing our decoded data
     $fh = fopen($tmpname, 'wb');
     fwrite($fh, $data);
 } else {
     # Closing our file without doing anything
     fclose($fh);
 }
 # Saving our file
 $fsrc = fopen($tmpname, 'rb');
 $fh = fopen($G_SERVER_HOST . $filepath, 'w');
 if (!$fh) {
     exit_fail(NQ_ERROR_INVALID_VALUE, LANG_ERROR_FILE_CREATE);
 }
 # Writing to our file
 fwrite($fh, fread($fsrc, filesize($tmpname)));
 fclose($fh);
 fclose($fsrc);
 # Saving our file size
 $filesize = (int) filesize($tmpname);
 $file_mime_type = mime_content_type($tmpname);
 # If we need to assign a file id
 $query = "\tUPDATE\n\t\t\t\t\t\t" . NQ_FILE_TABLE . "\n\t\t\t\t\tSET\n\t\t\t\t\t\t`file_id`\t\t=" . (int) $file_id . ",\n\t\t\t\t\t\t`filepath`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $filepath) . "',\n\t\t\t\t\t\t`filesize`\t\t=" . (int) $filesize . ",\n\t\t\t\t\t\t`meta_mime_type`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $file_mime_type) . "'\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`id`=" . (int) $insert_id . "\n\t\t\t\t\tLIMIT 1";
 mysqli_sub_query($G_STORAGE_CONTROLLER_DBLINK, $query);
 # New file upload
 if (!isset($current_file_data['id'])) {
     # Updating our directory
     $query = "\tUPDATE\n\t\t\t\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t`files`\t\t\t=`files`+1,\n\t\t\t\t\t\t\t`filesize`\t\t=`filesize`+" . (int) $filesize . ",\n\t\t\t\t\t\t\t`children_filesize`\t=`children_filesize`+" . (int) $filesize . ",\n\t\t\t\t\t\t\t`modified`\t\t=NOW()\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`id`\t\t\t=" . (int) $G_DIRECTORY_DATA['id'] . "\n\t\t\t\t\t\tLIMIT 1";
开发者ID:nuQuery,项目名称:v1m0-api-file,代码行数:31,代码来源:upload.php

示例4: get_update_query

 public function get_update_query($limit = 1, $start = false, $clear = true)
 {
     # Building the query
     $query = ["UPDATE `" . ($this->database !== false ? $this->database . '`.`' : '') . $this->table . "` SET"];
     # Columns
     $update = [];
     foreach ($this->columns_update as $key => $column) {
         if (!isset($this->blacklist_columns->{$this->table}->{$column['Field']})) {
             $update[] = $this->column_type_update($key, $column['Type'], $column['Value'], $this->table);
         }
     }
     $query[] = implode(', ', $update);
     # No columns to update, bail
     if (count($update) == 0) {
         exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_NUMBER_OF_COLUMNS);
     }
     # Where
     if (count($this->columns_where) > 0) {
         $query[] = "WHERE " . implode(' AND ', $this->columns_where);
     }
     # Order By
     if (count($this->columns_order) > 0) {
         $query[] = "ORDER BY " . implode(', ', $this->columns_order);
     }
     # Limit
     if ($limit != false) {
         if ($start != false) {
             $query[] = 'LIMIT ' . intval_ext($start) . ',' . intval_ext($limit);
         } else {
             $query[] = 'LIMIT ' . intval_ext($limit);
         }
     }
     # Clearing the update records
     if ($clear) {
         $this->clear(false);
     }
     # Returning our query
     return implode(' ', $query);
 }
开发者ID:nuQuery,项目名称:v1m0-api-all,代码行数:39,代码来源:mysql.php

示例5: mkdir

# Saving our file id and updating the version
$file_id = $current_file_data['file_id'];
$version = (int) $current_file_data['version'] + 1;
# Where we are going to save our file to
$save_path = $G_APP_DATA['id'] . '/';
if (!is_dir($savepath)) {
    mkdir($G_SERVER_HOST . $save_path);
}
$ext = explode('.', $current_file_data['filepath']);
$ext = array_splice($ext, -1);
$ext = $ext[0];
$filepath = $save_path . $file_id . '-' . $version . '.' . $ext;
# Saving the new version of the image
$error_message = '';
if (!$img->save($G_SERVER_HOST . $filepath, $G_SERVER_DATA['available_space'], $error_message)) {
    exit_fail(NQ_ERROR_SIZE_LIMIT, $error_message);
}
# Saving our file size
$filesize = (int) filesize($G_SERVER_HOST . $filepath);
$G_FILESIZE_ADDED = (int) $filesize - (int) $current_file_data['filesize'];
# Adding to the datatbase
$query = "\tINSERT INTO\n\t\t\t\t" . NQ_FILE_TABLE . "\n\t\t\tSET\n\t\t\t\t`app_id`\t\t=" . (int) $G_APP_DATA['id'] . ",\n\t\t\t\t`environment`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "',\n\t\t\t\t`directory_id`\t\t=" . (int) $G_DIRECTORY_DATA['id'] . ",\n\t\t\t\t`name`\t\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $current_file_data['name']) . "',\n\t\t\t\t`created`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $current_file_data['created']) . "',\n\t\t\t\t`modified`\t\t=NOW(),\n\t\t\t\t`version`\t\t=" . (int) $version . ",\n\t\t\t\t`file_id`\t\t=" . (int) $file_id . ",\n\t\t\t\t`filepath`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $filepath) . "',\n\t\t\t\t`filesize`\t\t=" . (int) $filesize . ",\n\t\t\t\t`host_id`\t\t=" . (int) $G_SERVER_DATA['id'] . ",\n\t\t\t\t`meta_mime_type`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $current_file_data['meta_mime_type']) . "',\n\t\t\t\t`meta_width`\t\t=" . (int) $current_file_data['meta_width'] . ",\n\t\t\t\t`meta_height`\t\t=" . (int) $current_file_data['meta_height'];
mysqli_sub_query($G_STORAGE_CONTROLLER_DBLINK, $query);
# Return object
$content = new stdClass();
$content->success = true;
$content->env = $G_APP_ENVIRONMENT;
# Sending success
PostParser::send($content, true);
/* --- Connection closed wit img->send() --- Below this point things need to be tracked and cleaned up --- */
# Updating our directory
开发者ID:nuQuery,项目名称:v1m0-api-image,代码行数:31,代码来源:modify.php

示例6: mail

        # Adding referral if possible
        if (isset($_SERVER['HTTP_REFERER'])) {
            $body .= '<div style="font-weight:bold;margin:20px 0px 10px;">
			   					Referral
			   				</div>
			   				<div style="padding:10px;background-color:#F0F0FF;border-radius:5px 5px 5px 5px;">
			   					' . $_SERVER['HTTP_REFERER'] . '
			   				</div>';
        }
        # Sending our mail
        mail(NQ_404_ERROR_EMAIL_ADDRESS, '404 Error Report', $body, $headers);
    }
}
# If we are an error with a json request
if (isset($_SERVER['HTTP_CONTENT_TYPE'])) {
    exit_fail(NQ_ERROR_FILE_NOT_FOUND, 'File not found', false);
}
# Redirecting
if (NQ_404_ERROR_REDIRECT == true) {
    header('Location: ' . NQ_404_ERROR_REDIRECT_URL);
    exit;
}
?>
<!doctype html>
	<html>
		<title>404 Page Not Found</title>
	</head>
	<body>
		<div style="position:fixed;top:50%;margin-top:-125px;left:50%;margin-left:-153px;">
			<img src="/images/404.png" style="width:306px;height:150px;margin-bottom:10px;" />
		</div>
开发者ID:nuQuery,项目名称:v1m0-api-file,代码行数:31,代码来源:error.php

示例7: exit_fail

# Invalid template
if (!isset($email_data['id'])) {
    exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_TEMPLATE);
}
# Invalid template code
$invalid_tags = [];
if (!TemplateParser::validate($_JPOST->body, $invalid_tags)) {
    exit_fail(NQ_ERROR_INVALID_VALUE, 'Validation Error');
}
# If we have any invalid tags
if (count($invalid_tags) > 0) {
    $error = [];
    foreach ($invalid_tags as $tag => $count) {
        $error[] = $tag . ' (' . $count . ')';
    }
    exit_fail(NQ_ERROR_INVALID_VALUE, 'Your template contains the following restricted HTML tags: ' . implode(', ', $error));
}
# Updating our template
$query = "\tUPDATE\n\t\t\t\t" . NQ_TEMPLATE_TABLE . "\n\t\t\tSET\n\t\t\t\t`subject`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->subject) . "',\n\t\t\t\t`body`\t\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->body) . "',\n\t\t\t\t`bcc`\t\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->bcc) . "',\n\t\t\t\t`locked`\t\t=b'" . (boolval_ext($_JPOST->locked) ? '1' : '0') . "',\n\t\t\t\t`requires_unsubscribe`\t=b'" . (boolval_ext($_JPOST->requires_unsubscribe) ? '1' : '0') . "'\n\t\t\tWHERE\n\t\t\t\t`id`\t\t\t=" . (int) $email_data['id'] . "\n\t\t\tLIMIT 1";
mysqli_sub_query($G_STORAGE_CONTROLLER_DBLINK, $query);
# We successfully updated
$content = new stdClass();
$content->success = true;
$content->updated = mysqli_affected_rows($G_STORAGE_CONTROLLER_DBLINK) > 0;
# Sending our content
PostParser::send($content);
/* --- Connection closed wit PostParser::send --- Below this point things need to be tracked and cleaned up --- */
# Closing the storage connection
mysqli_shared_close($G_STORAGE_CONTROLLER_DBLINK, $G_SHARED_DBLINKS);
# Closing controller if tracking is different
if (NQ_CONTROLLER_HOST != NQ_TRACKING_HOST) {
开发者ID:nuQuery,项目名称:v1m0-api-all,代码行数:31,代码来源:update.php

示例8: mysqli_escape_string

    $content->success = true;
    $content->path = $G_PATH_DATA->urlpath . $_JPOST->newname;
} else {
    # Making sure we have our open directories
    $query = "\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . NQ_FILE_TABLE . "\n\t\t\t\tWHERE\n\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t\t`directory_id`\t=" . (int) $G_PARENT_DIR_DATA['id'] . " AND\n\t\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->originalname) . "'\n\t\t\t\tLIMIT 1";
    $original_file_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
    # We dont have an original file
    if (!isset($original_file_data['id'])) {
        exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_FILE);
    }
    # Making sure we have our open directories
    $query = "\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . NQ_FILE_TABLE . "\n\t\t\t\tWHERE\n\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t\t`directory_id`\t=" . (int) $directory_data['id'] . " AND\n\t\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->newname) . "'\n\t\t\t\tLIMIT 1";
    $exists_file_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
    # Can't rename
    if (isset($exists_file_data['id'])) {
        exit_fail(NQ_ERROR_INVALID_VALUE, LANG_ERROR_FILE_EXISTS);
    }
    # Making sure we have our open directories
    $query = "\tUPDATE\n\t\t\t\t\t" . NQ_FILE_TABLE . "\n\t\t\t\tSET\n\t\t\t\t\t`name`='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->newname) . "'\n\t\t\t\tWHERE\n\t\t\t\t\t`id`=" . (int) $original_file_data['id'] . "\n\t\t\t\tLIMIT 1";
    mysqli_sub_query($G_STORAGE_CONTROLLER_DBLINK, $query);
    # Our return values!
    $content->success = true;
    $content->path = $G_PATH_DATA->urlpath . $_JPOST->newname;
    $content->url = NQ_DOMAIN_ROOT . '/' . $G_APP_DATA['id'] . $G_PATH_DATA->dirpath . $_JPOST->newname;
}
# We are done!
PostParser::send($content);
/* --- Connection closed wit PostParser::send --- Below this point things need to be tracked and cleaned up --- */
# Closing the storage connection
mysqli_shared_close($G_STORAGE_CONTROLLER_DBLINK, $G_SHARED_DBLINKS);
# Closing controller if tracking is different
开发者ID:nuQuery,项目名称:v1m0-api-image,代码行数:31,代码来源:rename.php

示例9: define

// Can this page be cached on the users browser
define('PUBLIC_ENDPOINT', false);
// Can anyone can access this endpoint
# Including our configuration and app validation
require_once __DIR__ . '/_includes/config.php';
require_once __DIR__ . '/_includes/validate-app.php';
# Endpoint Specific
define('SEARCH_ACTIVE', isset($_CGET['search']) && $_CGET['search'] != '');
define('SHOW_DIRECTORIES', !isset($_CGET['nodirectories']) || !boolval_ext($_CGET['nodirectories']));
define('SHOW_FILES', !isset($_CGET['nofiles']) || !boolval_ext($_CGET['nofiles']));
# Setting up our path
$G_PATH_DATA = parse_path($_CGET['dir'], $_ENDPOINT, $G_TOKEN_SESSION_DATA);
# Fetching our parent directory
$query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t`path`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_PATH_DATA->dir) . "' AND\n\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_PATH_DATA->name) . "'\n\t\t\tLIMIT 1";
$directory_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
!isset($directory_data['id']) && exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_DIR);
# Return properties
$content = [];
$path = $directory_data['path'] . $directory_data['name'] . '/';
# If we want to search our recursive child directories
if (SEARCH_ACTIVE && SHOW_DIRECTORIES) {
    # If we are searching for something specific
    $name_search = $_CGET['search'] != '' ? ' AND `name` LIKE \'' . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_CGET['search']) . '%\'' : '';
    # Recursive or just the directory
    $recursive_search = ' AND ' . (isset($_CGET['recursive']) && $_CGET['recursive'] == 'false' ? '`parent_directory_id`=' . $directory_data['id'] : '`path` LIKE \'' . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $path) . '%\'');
    # Getting our directories
    $query = "\tSELECT\n\t\t\t\t\t`children_filesize`,\n\t\t\t\t\t`created`,\n\t\t\t\t\t`directories`,\n\t\t\t\t\t`files`,\n\t\t\t\t\t`filesize`,\n\t\t\t\t\t1 AS `is_dir`,\n\t\t\t\t\t`modified`,\n\t\t\t\t\t`name`,\n\t\t\t\t\tSUBSTRING(`path`,2) AS `path`\n\t\t\t\tFROM\n\t\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\t\tWHERE\n\t\t\t\t\t`app_id`\t\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "'" . $recursive_search . $name_search . "\n\t\t\t\tORDER BY\n\t\t\t\t\t`name`\n\t\t\t\tLIMIT 25";
    $result = mysqli_multi_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
    $content = mysqli_fetch_all($result, MYSQLI_ASSOC);
    mysqli_free_result($result);
}
开发者ID:nuQuery,项目名称:v1m0-api-image,代码行数:31,代码来源:search.php

示例10: mysqli_log_error

function mysqli_log_error($dblink, $query, $exit = true)
{
    # Our mysql error
    $mysqli_error = mysqli_error($dblink);
    # If we are logging our errors
    if (NQ_MYSQL_ERRORS_LOG) {
        # Writing our error
        $handle = fopen(NQ_MYSQL_LOG_DIRECTORY . '/' . date('Y-m-d') . '.txt', 'a');
        fwrite($handle, date('H:i:s') . ' - ' . $_SERVER['REMOTE_ADDR'] . ' - ' . $query . "\r\n");
        fclose($handle);
    }
    # If we are emailing our error
    if (NQ_MYSQL_ERROR_EMAIL) {
        # Including the formatter
        require_once __DIR__ . '/parsers/sqlformatter.php';
        # Mail headers
        $headers = ['From: nuQuery Error <' . NQ_ADMIN_EMAIL_ADDRESS . '>', 'MIME-Version: 1.0', 'Content-type:text/html;charset=iso-8859-1', 'Reply-To: MYSQL Error Report <' . NQ_MYSQL_ERROR_EMAIL_ADDRESS . '>', 'X-Mailer: PHP/' . phpversion(), 'X-Priority: 5', 'X-MSMail-Priority: Low', 'Importance: Low'];
        $headers = implode("\n", $headers);
        # Mail body
        $body = '		<div style="' . NQ_EMAIL_BLOCK_HEADER . '">
		   					Request Details
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_BODY . '">
		   					<label style="' . NQ_EMAIL_BLOCK_LABEL . '">Local Server ID:</label> ' . NQ_LOCAL_SERVER_ID . '
		   					<br />
		   					<label style="' . NQ_EMAIL_BLOCK_LABEL . '">Requested URL: </label> ' . $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] . '
		   				</div>';
        # If we are loggin, we want to let the email show it
        if (NQ_MYSQL_ERRORS_LOG) {
            $body .= '<div style="' . NQ_EMAIL_BLOCK_HEADER . '">
		   					Error Log
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_BODY . '">
		   					' . NQ_MYSQL_LOG_DIRECTORY . '/' . date('Y-m-d') . '.txt
		   				</div>';
        }
        # Our error messages
        $body .= '<div style="' . NQ_EMAIL_BLOCK_HEADER . '">
		   					MySQL Error
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_BODY . '">
		   					' . $mysqli_error . '
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_HEADER . '">
		   					MySQL Query (' . mysqli_get_host_info($dblink) . ')
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_BODY . 'white-space:pre;">' . SqlFormatter::format($query) . '</div>';
        # Our error stack trace
        $trackcount = 0;
        $body .= '<div style="' . NQ_EMAIL_BLOCK_HEADER . '">
		   					Stack Trace
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_BODY . '">';
        foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $trace) {
            $body .= '# ' . $trackcount++ . ' <b>' . $trace['function'] . '</b> <i>[' . substr($trace['file'], strlen($_SERVER['DOCUMENT_ROOT'])) . ':' . $trace['line'] . ']</i><br />';
        }
        $body .= '</div>';
        # If we are loggin, we want to let the email show it
        if (NQ_DEBUG_ENABLED && NQ_DEBUG_SEND_EMAIL) {
            global $G_DEBUG_DATA;
            $body .= '<div style="' . NQ_EMAIL_BLOCK_HEADER . '">
		   					Debug Log
		   				</div>
		   				<div style="' . NQ_EMAIL_BLOCK_BODY . 'white-space:pre;">' . json_encode($G_DEBUG_DATA, JSON_PRETTY_PRINT) . '</div>';
        }
        # Sending our mail
        queue_shutdown_email(NQ_MYSQL_ERROR_EMAIL_ADDRESS, 'MYSQL Error Report', $body, $headers);
    }
    # We want to report everything
    if (NQ_MYSQL_ERRORS_PRINT) {
        $message = 'MySQL Error : ' . $mysqli_error;
    } else {
        $message = 'There was an error with the desired request.';
    }
    # Exiting gracefully
    $exit && exit_fail(NQ_ERROR_MYSQL_ERROR, $message, false);
}
开发者ID:nuQuery,项目名称:v1m0-api-authentication,代码行数:77,代码来源:functions.common.php

示例11: exit_fail

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
		IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
		FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
		AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
		LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
		OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
		THE SOFTWARE.
*/
# Including our configuration and validate app
require_once __DIR__ . '/_includes/config.php';
require_once __DIR__ . '/_includes/validate-app.php';
# Handling our global json parsing
$_JPOST = PostParser::decode();
# A domain was not provided
if (!isset($_JPOST->domain)) {
    exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_DOMAIN);
}
# Creating our confirmation text record
$txt_record = [];
$chars = str_split('abcdefghijklmnopqrstuvwxyz1234567890');
$char_len = count($chars) - 1;
for ($i = 0; $i < 20; $i++) {
    $txt_record[] = $chars[mt_rand(0, $char_len)];
}
$txt_record = implode('', $txt_record);
# Adding our domain
$query = "\tINSERT IGNORE INTO\n\t\t\t\t" . NQ_DOMAIN_TABLE . "\n\t\t\tSET\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . ",\n\t\t\t\t`domain`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->domain) . "',\n\t\t\t\t`txt_record`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $txt_record) . "',\n\t\t\t\t`confirmed`\t=b'0'";
mysqli_sub_query($G_STORAGE_CONTROLLER_DBLINK, $query);
# The content to be returned
$content = new stdClass();
$content->success = true;
开发者ID:nuQuery,项目名称:v1m0-api-email,代码行数:31,代码来源:create_domain.php

示例12: get_whitelist_columns

$whitelist = NQ_WHITELIST_COLUMNS ? get_whitelist_columns($G_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_TABLE_DETAILS['id'], $G_TOKEN_PRIVILEGE_DATA['id']) : [];
# Getting the table id bitmask
if (!isset($G_PARTITION_BITSIZE[$G_TABLE_DETAILS['partition_size']])) {
    exit_fail(NQ_INVALID_VALUE, LANG_TABLE_INVALID_PARTITION_SIZE);
}
$bitmask = $G_PARTITION_BITSIZE[$G_TABLE_DETAILS['partition_size']];
# Tracking
$inserted_count = 0;
$write_rows = 0;
$partitions = [];
$partitions_affected = new stdClass();
# Turning into an array
$_JPOST = is_array($_JPOST) ? $_JPOST : [$_JPOST];
# Can't be too large
if (count($_JPOST) > NQ_MAX_INSERT_ROW_COUNT) {
    exit_fail(NQ_INVALID_VALUE, LANG_TO_MANY_INSERT_ROWS);
}
# Loading all of our partitions
$partition_entries = new stdClass();
foreach ($_JPOST as $entry) {
    # Getting the appropriate partition
    $partition = get_table_partition($G_CONTROLLER_DBLINK, $G_STORAGE_CONTROLLER_DBLINK, $G_APP_DATA, $G_TABLE_DETAILS, $entry, $bitmask, $partitions, $G_SHARED_DBLINKS);
    # Cant create partition
    if ($partition === false) {
        $content->rejected[] = (object) ['errorCode' => 201, 'message' => 'Unable to create new partitions.', 'record' => $entry, 'original_id' => $original_id, 'attempted_id' => $entry->id];
        $rejected = true;
    } else {
        $partition_entries->{$partition->data['id']}[] = $entry;
    }
}
# Freeing memory
开发者ID:nuQuery,项目名称:v1m0-api-all,代码行数:31,代码来源:insert.php

示例13: define

}
# If we need to block this endpoint
define('ENDPOINT_BLOCKED', $block);
# Clearing old burst rates
$query = "\tDELETE FROM\n\t\t\t\t" . NQ_TRACKING_BURST_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`seconds`<=" . (time() - NQ_BURST_RATE_LIFETIME);
mysqli_sub_query($G_CONTROLLER_DBLINK, $query);
# If our app has a burst rate
if ($G_APP_DATA['burst_rate'] > 0) {
    # Adding to our burst rate
    $time = (int) time();
    $query = "\tINSERT INTO\n\t\t\t\t\t" . NQ_TRACKING_BURST_TABLE . "\n\t\t\t\tSET\n\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . ",\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "',\n\t\t\t\t\t`seconds`\t=" . (int) $time . ",\n\t\t\t\t\t`count`\t\t=1\n\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\t`count`\t\t=`count`+1";
    mysqli_sub_query($G_CONTROLLER_DBLINK, $query);
    # Getting our burst dat
    $query = "\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . NQ_TRACKING_BURST_TABLE . "\n\t\t\t\tWHERE\n\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t\t`seconds`\t=" . (int) $time . "\n\t\t\t\tLIMIT 1";
    $burst_data = mysqli_single_result_query($G_CONTROLLER_DBLINK, $query);
    # If we have exceeded our quota
    if ($burst_data['count'] > $G_APP_DATA['burst_rate']) {
        # Adding our updating our exception
        $query = "\tINSERT INTO\n\t\t\t\t\t\t" . NQ_TRACKING_BURST_EXCEPTION_TABLE . "\n\t\t\t\t\tSET\n\t\t\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . ",\n\t\t\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "',\n\t\t\t\t\t\t`created``\t='" . date('Y-m-d H:i:s', $time) . "',\n\t\t\t\t\t\t`count`\t\t=" . (int) $burst_data['count'] . "\n\t\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\t\t`count`\t\t=" . (int) $burst_data['count'];
        mysqli_sub_query($G_CONTROLLER_DBLINK, $query);
        # Error message
        exit_fail(NQ_ERROR_BURST_LIMIT, LANG_BURST_LIMIT);
    }
}
# If we are going to validate write space
if (defined('VALIDATE_WRITE_SPACE') && VALIDATE_WRITE_SPACE) {
    # We have exceeded the space, block
    if ($G_APP_DATA['db_size'] > $G_APP_DATA['db_quota']) {
        exit_fail(NQ_ERROR_OUT_OF_SPACE, LANG_OUT_OF_SPACE);
    }
}
开发者ID:nuQuery,项目名称:v1m0-api-all,代码行数:31,代码来源:validate-app.php

示例14: exit_fail

    exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_SENDER_ADDRESS);
}
# Validating we have a tag
if (!isset($_JPOST->tag)) {
    exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_TEMPLATE);
}
# Getting our template
$query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_TEMPLATE_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\tIN ('*','" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "') AND\n\t\t\t\t`tag`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $_JPOST->tag) . "'\n\t\t\tLIMIT 1";
$email_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
# Error checking
if (!isset($email_data['app_id'])) {
    exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_TEMPLATE);
}
# Locked checking
if ($email_data['locked'] == '1') {
    exit_fail(NQ_ERROR_INVALID_VALUE, LANG_LOCKED_TEMPLATE);
}
# Adding our constants
$query = "\tSELECT\n\t\t\t\t`tag`,\n\t\t\t\t`text`\n\t\t\tFROM\n\t\t\t\t" . NQ_CONSTANT_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\tIN ('*','" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "')";
$result = mysqli_multi_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
$constants = mysqli_fetch_all($result, MYSQLI_ASSOC);
# Letting our user know whats going on
$content = new stdClass();
$content->success = true;
$content->sent = 0;
$content->blocked = 0;
# Sending our email
$subject = isset($_JPOST->subject) && $_JPOST->subject != '' ? $_JPOST->subject : $email_data['subject'];
$send_time = isset($_JPOST->send_time) && $_JPOST->send_time != '' ? strtotime($_JPOST->send_time) : time();
$email->personal = $email->personal == '' ? $G_APP_DATA['name'] : $email->personal;
$from = $email->personal . ' <' . $email->mailbox . '@' . $email->host . '>';
开发者ID:nuQuery,项目名称:v1m0-api-email,代码行数:31,代码来源:send.php

示例15: str_replace

                 if( $link_table_data[ 'partition_column' ] != $column->name ) {
                 	exit_fail( NQ_ERROR_INVALID_VALUE, str_replace( '%column%', $column->name, LANG_INVALID_LINK_TABLE_PARTITION ) );
                 }
                 */
                 # Invalid characters
                 if (!preg_match(NQ_COLUMN_CHAR_FILTER, $column->name)) {
                     exit_fail(NQ_ERROR_INVALID_VALUE, str_replace('%name%', $column->name, LANG_INVALID_LINK_NAME));
                 }
                 # Saving our link table id
                 $_JPOST->columns[$idx]->link_table_id = $link_table_data['id'];
                 # Checking our current table for existing link name
                 $query = "\tSELECT\n\t\t\t\t\t\t\t\t\t\t`id`\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t" . NQ_TABLE_LINKS_TABLE . "\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t`app_id`\t\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t\t\t\t\t\t`table_id` \t= " . (int) $G_TABLE_DETAILS['id'] . " AND\n\t\t\t\t\t\t\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $column->link_name) . "'\n\t\t\t\t\t\t\t\t\tLIMIT 1";
                 $link_data = mysqli_single_result_query($G_CONTROLLER_DBLINK, $query);
                 # Link name already used
                 if (isset($link_data['id'])) {
                     exit_fail(NQ_ERROR_INVALID_VALUE, str_replace('%column%', $column->name, LANG_TABLE_LINK_EXISTS));
                 }
                 break;
         }
     }
 }
 # The columns to update
 $update_columns = [];
 # Renaming if we specified
 if (isset($_JPOST->rename) && $_JPOST->rename != '') {
     $update_columns[] = "`name`='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $_JPOST->rename) . "'";
 }
 # Creating a new alias
 if (isset($_JPOST->rename_alias) && $_JPOST->rename_alias != '') {
     $update_columns[] = "`alias`='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $_JPOST->rename_alias) . "'";
 }
开发者ID:nuQuery,项目名称:v1m0-api-all,代码行数:31,代码来源:table.php


注:本文中的exit_fail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。