本文整理汇总了PHP中handle_error函数的典型用法代码示例。如果您正苦于以下问题:PHP handle_error函数的具体用法?PHP handle_error怎么用?PHP handle_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了handle_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: authorize_user
function authorize_user($groups = NULL)
{
// No need to check groups if there aren't cookies set
if (!isset($_SESSION['user_id']) || !strlen($_SESSION['user_id']) > 0) {
header('Location: signin.php?' . 'error_message=You must login to see this page.');
exit;
}
// If no groups passed in, the authorization above is enough
if (is_null($groups) || empty($groups)) {
return;
}
// Set up the query string
$query_string = "SELECT ug.user_id" . " FROM user_groups ug, groups g" . " WHERE g.name = '%s'" . " AND g.id = ug.group_id" . " AND ug.user_id = " . mysql_real_escape_string($_SESSION['user_id']);
// Run through each group and check membership
foreach ($groups as $group) {
$query = sprintf($query_string, mysql_real_escape_string($group));
$result = mysql_query($query);
if (isset($result) && mysql_num_rows($result) == 1) {
// If we got a result, the user should be allowed access
// Just return so the script will continue to run
return;
}
}
// If we got here, no matches were found for any group
// The user isn't allowed access
handle_error("You are not authorized to see this page.");
exit;
}
开发者ID:artre,项目名称:study,代码行数:28,代码来源:authorize.php
示例2: set_item_data
public function set_item_data($user_id, $canceled = FALSE)
{
if (is_class($user_id, 'User')) {
$user_id = $user_id->get_id();
}
if (isset($this->index_object) && is_int($user_id) && $this->index_object->get_field('user_id') == $user_id) {
//不允許跟標註使用者相同的使用者新增
handle_error('annotation_like_collection.deny_annotation_author.exception');
return $this;
}
return parent::set_item_data($user_id, array('canceled' => $canceled));
}
开发者ID:119155012,项目名称:kals,代码行数:12,代码来源:Annotation_like_collection.php
示例3: get_referer_url
function get_referer_url($show_exception = FALSE)
{
$url = getenv("HTTP_REFERER");
if ($url !== FALSE) {
if (substr($url, -1, 1) == "/") {
$url = substr($url, 0, -1);
}
return $url;
} else {
if ($show_exception) {
handle_error('Cannot get referer url.');
}
return FALSE;
}
}
开发者ID:qcdcool,项目名称:php-file-converter,代码行数:15,代码来源:kals_helper.php
示例4: _post_update
protected function _post_update()
{
parent::_post_update();
//假如是喜歡的話……
$canceled = $this->get_field('canceled');
if ($canceled === FALSE or $canceled == 'FALSE' or $canceled == 'f') {
$annotation_id = intval($this->get_field('annotation_id'));
$user_id = intval($this->get_field('user_id'));
if ($annotation_id != 0 && $user_id != 0) {
$this->_CI_load('library', 'kals_resource/Annotation', 'annotation');
$this->_CI_load('library', 'kals_actor/User', 'user');
$trigger_resource = new Annotation($annotation_id);
$association_user = $trigger_resource->get_user();
$trigger_actor = new User($user_id);
$this->_CI_load('library', 'kals_actor/Notification_liked', 'notification_liked');
$notification = $this->CI->notification_liked->create_notification($association_user, $trigger_resource, $trigger_actor);
if (is_null($notification)) {
handle_error($this->lang->line('notification.liked.create_notification.exception'));
}
}
}
//if ($canceled == FALSE OR $canceled == 'FALSE')
}
开发者ID:119155012,项目名称:kals,代码行数:23,代码来源:Annotation_like.php
示例5: get_referer_url
function get_referer_url($show_exception = FALSE)
{
$url = getenv("HTTP_REFERER");
if ($url === FALSE) {
if (isset($GLOBALS['context']) !== FALSE) {
$url = $GLOBALS['context']->get_referer_url();
}
}
if ($url !== FALSE) {
/**
* 加入刪除多餘首頁檔案名稱的修正
* @author Pulipuli Chen 20131117
*/
$url = url_strip_index($url);
if (substr($url, -1, 1) == "/") {
$url = substr($url, 0, -1);
}
if (isset($GLOBALS['context']) !== FALSE) {
$GLOBALS['context']->set_referer_url($url);
}
$CI =& get_instance();
$localhost_domains = $CI->config->item("web_apps.localhost_domains");
$localhost_domains[] = "http://127.0.0.1/";
foreach ($localhost_domains as $key => $domain) {
if (starts_with($url, $domain)) {
$url = str_replace($domain, "http://localhost/", $url);
break;
}
}
return $url;
} else {
if ($show_exception) {
handle_error('Cannot get referer url.');
}
return FALSE;
}
}
开发者ID:119155012,项目名称:kals,代码行数:37,代码来源:kals_helper.php
示例6: IteroAPI
<?php
include 'config.php';
include 'iteroapi.php';
$contractid = $_GET['contractid'];
// Get a default self service portal URL
// from Itero for a sepcific contract
$itero = new IteroAPI($clientid, $clientsecret);
$token = $itero->get_selfservice_token($contractid);
if (!$token) {
handle_error(500, "Could not fetch token");
}
$portalurl = $token->Url;
?>
<!doctype html>
<html>
<head>
<title>Customer Portal</title>
</head>
<body>
<a href="/customers.php">Back to customer list</a>
<iframe width="100%" height="2000px" src="<?php
echo $portalurl;
?>
"></iframe>
</body>
</html>
开发者ID:billwerk,项目名称:billwerkjs-jquery-php,代码行数:28,代码来源:portal.php
示例7: _get_post_json
/**
* 取得POST的值
*
* @author Pulipuli Chen <[email protected]>
* 20131225 來自於annotation_setter
* @return String
*/
protected function _get_post_json()
{
if (isset($_POST['json'])) {
//return urldecode($_POST['json']);
//return $_POST['json'];
$json = $_POST["json"];
/**
* 20121224 Pulipuli Chen
* 移除scope中text包含\'的資料
*/
$json = str_replace("\\'", "'", $json);
return $json;
} else {
handle_error('Cannot get json data.');
}
}
开发者ID:119155012,项目名称:kals,代码行数:23,代码来源:mobile_apps_controller.php
示例8: login_require
function login_require($show_exception = TRUE)
{
$logined = FALSE;
if (isset($GLOBALS['context']) === FALSE) {
$logined = FALSE;
} else {
$user = get_context_user();
if (isset($user)) {
$domain = $user->get_domain();
$host = $domain->get_host();
if (get_referer_host(FALSE) === $host) {
$logined = TRUE;
}
}
}
if ($show_exception && $logined === FALSE) {
handle_error('login_require');
}
return $logined;
}
开发者ID:qcdcool,项目名称:php-file-converter,代码行数:20,代码来源:context_helper.php
示例9: set_project_environment
/**
* Function set_project_environment
*
* Analyses configuration and current session to identify which project area
* is to be used.
* If a project is specified in the HTTP parameters then that is used, otherwise
* the current SESSION project is used. If none of these are specified then the default
* "reports" project is used
*/
function set_project_environment()
{
global $g_project;
global $g_menu;
global $g_menu_title;
$project = session_request_item("project", "reports");
$menu = false;
$menu_title = "Set Menu Title";
// Now we now the project include the relevant config.php
$projpath = "projects/" . $project;
$configfile = $projpath . "/config.php";
$menufile = $projpath . "/menu.php";
if (!is_file($projpath)) {
find_file_to_include($projpath, $projpath);
}
if (!$projpath) {
find_file_to_include("config.php", $configfile);
if ($configfile) {
include_once $configfile;
}
$g_project = false;
$g_menu = false;
$g_menu_title = "";
$old_error_handler = set_error_handler("ErrorHandler");
handle_error("Project Directory {$project} not found. Check INCLUDE_PATH or project name");
return;
}
if (!is_file($configfile)) {
find_file_to_include($configfile, $configfile);
}
if (!is_file($menufile)) {
find_file_to_include($menufile, $menufile);
}
if ($configfile) {
include_once $configfile;
if (is_file($menufile)) {
include_once $menufile;
} else {
handle_error("Menu Definition file menu.php not found in project {$project}", E_USER_WARNING);
}
} else {
find_file_to_include("config.php", $configfile);
if ($configfile) {
include_once $configfile;
}
$g_project = false;
$g_menu = false;
$g_menu_title = "";
$old_error_handler = set_error_handler("ErrorHandler");
handle_error("Configuration Definition file config.php not found in project {$project}", E_USER_ERROR);
}
$g_project = $project;
$g_menu = $menu;
$g_menu_title = $menu_title;
return $project;
}
开发者ID:GLUD,项目名称:EcoHack,代码行数:65,代码来源:imageget.php
示例10: handle_error
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include 'config.php';
function handle_error($status = '404 Not Found', $header, $text)
{
global $config;
header('HTTP/1.0 ' . $status);
header('Status: ' . $status);
do_header();
echo '<h3>' . $header . '</h3>';
echo '<p class="warning">Sorry :-(</p>';
echo '<p>' . $text . '</p>';
echo '<p class="leave"><a href="' . $config['base'] . '">Go to ' . $config['shortener'] . '</a></p>';
do_footer();
die;
}
$short = get_params($_SERVER['PATH_INFO']);
$short_url = clean($short[0]);
if (empty($short_url)) {
go_to('/');
}
$query = mysql_query("SELECT long_url, status FROM urls WHERE short_url = CONVERT('{$short_url}' USING binary) LIMIT 1");
$result = mysql_fetch_row($query, MYSQL_ASSOC);
if (empty($result)) {
handle_error('404 Not Found', 'Not Found', 'We couldn\'t find that URL.');
}
if ($result['status'] == 'suspended') {
handle_error('403 Forbidden', 'Suspended URL', 'This URL has been suspended.');
}
$long_url = $result['long_url'];
go_to($long_url);
开发者ID:neiko,项目名称:nsamblr,代码行数:31,代码来源:go.php
示例11: _post_update
protected function _post_update()
{
parent::_post_update();
if (isset($this->index_object)) {
$members = $this->_pre_update($this->members);
foreach ($members as $trigger_resource) {
$this->_CI_load('library', 'kals_actor/User', 'user');
$association_user = $trigger_resource->get_user();
$trigger_actor = $this->index_object->get_user();
$this->_CI_load('library', 'kals_actor/Notification_responded', 'notification_responded');
$notification = $this->CI->notification_responded->create_notification($association_user, $trigger_resource, $trigger_actor);
if (is_null($notification)) {
handle_error($this->lang->line('notification.responded.create_notification.exception'));
}
}
//foreach($members AS $trigger_resource)
}
//if (isset($index_id))
return $this;
}
开发者ID:119155012,项目名称:kals,代码行数:20,代码来源:Annotation_respond_collection.php
示例12: transform_xml
function transform_xml()
{
global $bodyXML;
global $ct_style;
$bpDefDirectory = "";
$bodyStylesheetFileName = $bpDefDirectory . $ct_style;
$xsl = new DomDocument();
if (!$xsl->load($bodyStylesheetFileName)) {
$systemErrMsg = 'Unable to load batch process template: ' . $bodyStylesheetFileName;
handle_error($systemErrMsg, $outtype);
}
$stylesheet = new XsltProcessor();
$stylesheet->importStylesheet($xsl);
if (!($htmlBody = $stylesheet->transformToXML($bodyXML))) {
$systemErrMsg = 'XSL translation failed for report template: ' . $bodyStylesheetFileName;
handle_error($systemErrMsg, $outtype);
}
return $htmlBody;
}
开发者ID:yasirgit,项目名称:afids,代码行数:19,代码来源:batch_process.php
示例13: is_admin
/**
* 檢查該actor是否能夠管理該resource。也就是allow的管理版
* @param KALSActor $actor
* @return boolean
*/
function is_admin($actor = NULL)
{
if (get_ignore_authorize()) {
return TRUE;
}
$actor = $this->_filter_actor($actor);
$is_admin = FALSE;
$resource = $this->resource;
switch ($resource->get_type_id()) {
case 1:
$action = $this->action_factory->create(1);
$is_admin = $this->allow($action);
break;
case 2:
$action = $this->action_factory->create(2);
$is_admin = $this->allow($action);
break;
case 3:
$author = $resource->get_user();
$is_admin = $author->equals($actor);
if ($is_admin === FALSE && $this->throw_exception) {
handle_error($this->lang->line('action.annotation.administration.exception'));
return FALSE;
}
break;
default:
$is_admin = FALSE;
}
return $is_admin;
}
开发者ID:119155012,项目名称:kals,代码行数:35,代码来源:Authorize_manager.php
示例14: set_load_callback
/**
* 設定callback的函式名稱,並檢查此函式能否運作。callback會在第一次取用此集合的成員時,先進行讀取成員資料的動作。
* @param string $function_name
* @param string $obj_or_clss
* @return Collection
*/
public function set_load_callback($function_name, $obj_or_clss = NULL)
{
$callback = NULL;
if ($obj_or_clss) {
$callback = array($obj_or_clss, $function_name);
} else {
$callback = $function_name;
}
if (FALSE === is_callable($callback, FALSE, $callable_name)) {
//throw new Exception("$callable_name is not callable as a parameter to onload");
handle_error("{$callable_name} is not callable as a parameter to onload");
return FALSE;
}
$this->onload = $callback;
$this->is_loaded = FALSE;
return $this;
}
开发者ID:qcdcool,项目名称:php-file-converter,代码行数:23,代码来源:Collection.php
示例15: reportico_meta_sql_criteria
static function reportico_meta_sql_criteria(&$in_query, $in_string, $prev_col_value = false)
{
// Replace user parameters with values
$external_param1 = get_reportico_session_param("external_param1");
$external_param2 = get_reportico_session_param("external_param2");
$external_param3 = get_reportico_session_param("external_param3");
$external_user = get_reportico_session_param("external_user");
if ( $external_param1 ) $in_string = preg_replace ("/{EXTERNAL_PARAM1}/", "'".$external_param1."'", $in_string);
if ( $external_param2 ) $in_string = preg_replace ("/{EXTERNAL_PARAM2}/", "'".$external_param2."'", $in_string);
if ( $external_param3 ) $in_string = preg_replace ("/{EXTERNAL_PARAM3}/", "'".$external_param3."'", $in_string);
if ( $external_user ) $in_string = preg_replace ("/{FRAMEWORK_USER}/", "'".$external_user."'", $in_string);
// Replace External parameters specified by {USER_PARAM,xxxxx}
if ( preg_match_all ( "/{USER_PARAM,([^}]*)}/", $in_string, $matches ) )
{
foreach ( $matches[0] as $k => $v )
{
$param = $matches[1][$k];
if ( isset($in_query->user_parameters[$param] ) )
{
$in_string = preg_replace("/{USER_PARAM,$param}/", $in_query->user_parameters[$param], $in_string);
}
else
{
trigger_error("User parameter $param, specified but not provided to reportico", E_USER_ERROR);
}
}
}
$looping = true;
$out_string = $in_string;
$ct = 0;
while ( $looping )
{
$ct++;
if ( $ct > 100 )
{
echo "Problem with SQL cannot resolve Criteria Items<br>";
break;
}
$regpat = "/{([^}]*)/";
if ( preg_match ( $regpat, $out_string, $matches ) )
{
$crit = $matches[1];
$first = substr($crit, 0, 1);
$critexp = $crit;
if ( $first == "=" )
{
$crit = substr ( $crit, 1 );
$critexp = $crit;
if ( array_key_exists($crit, $in_query->lookup_queries) )
$clause = $in_query->lookup_queries[$crit]->get_criteria_clause(false, false, true);
else if ( $cl = get_query_column($crit, $this->query->columns ) )
if ( $prev_col_value )
$clause = $cl->old_column_value;
else
$clause = $cl->column_value;
else
{
handle_error( "Unknown Criteria Item $crit in Query $in_string");
return $in_string;
}
}
else
{
$eltype = "VALUE";
$showquotes = true;
if ( preg_match ( "/(.*),(.*),(.*)/", $crit, $critel ) )
{
$crit = $critel[1];
$eltype = $critel[2];
if ( $critel[3] == "false" )
$showquotes = false;
}
if ( preg_match ( "/(.*),(.*)/", $crit, $critel ) )
{
$crit = $critel[1];
if ( $critel[2] == "false" )
$showquotes = false;
else
$eltype = $critel[2];
}
if ( array_key_exists($crit, $in_query->lookup_queries) )
{
switch ( $eltype )
{
case "FULL" :
$clause = $in_query->lookup_queries[$crit]->get_criteria_clause(true, true, true, false, false, $showquotes);
break;
case "RANGE1" :
$clause = $in_query->lookup_queries[$crit]->get_criteria_clause(false, false, false, true, false, $showquotes);
break;
case "RANGE2" :
$clause = $in_query->lookup_queries[$crit]->get_criteria_clause(false, false, false, false, true, $showquotes);
break;
//.........这里部分代码省略.........
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:reportico.php
示例16: error
/**
* Flow controll functions.
*/
function error($o)
{
$message = "";
$trace = NULL;
if (is_a($o, "Exception")) {
$message = $o->getMessage();
$trace = $o->getTrace();
} else {
$message = $o;
$trace = $trace = debug_backtrace();
}
handle_error($message, $trace);
}
开发者ID:stefda,项目名称:pocketsail,代码行数:16,代码来源:Common.php
示例17: check_login_domain
public function check_login_domain($show_exception = TRUE)
{
$user = $this->get_current_user();
if (is_null($user)) {
return TRUE;
}
$user_domain = $user->get_domain();
if ($user_domain->get_host() != get_referer_host($show_exception)) {
if ($show_exception) {
handle_error('chech_login_domain_failed');
}
return FALSE;
}
return TRUE;
}
开发者ID:119155012,项目名称:kals,代码行数:15,代码来源:Context.php
示例18: generate_graph_image
function generate_graph_image()
{
// Create the graph.
// Set up Font Mapping Arrays
$fontfamilies = array("Font 0" => FF_FONT0, "Font 1" => FF_FONT1, "Font 2" => FF_FONT2, "Font0" => FF_FONT0, "Font1" => FF_FONT1, "Font2" => FF_FONT2, "Arial" => FF_ARIAL, "Verdana" => FF_VERDANA, "Courier" => FF_COURIER, "Comic" => FF_COMIC, "Times" => FF_TIMES, "Georgia" => FF_GEORGIA, "Trebuchet" => FF_TREBUCHE, "advent_light" => advent_light, "Bedizen" => Bedizen, "Mukti_Narrow" => Mukti_Narrow, "calibri" => calibri, "Forgotte" => Forgotte, "GeosansLight" => GeosansLight, "MankSans" => MankSans, "pf_arma_five" => pf_arma_five, "Silkscreen" => Silkscreen, "verdana" => verdana, "Vera" => FF_VERA);
$fontstyles = array("Normal" => FS_NORMAL, "Bold" => FS_BOLD, "Italic" => FS_ITALIC, "Bold+Italic" => FS_BOLDITALIC);
$this->apply_defaults();
if (!function_exists("imagecreatefromstring")) {
handle_error("Graph Option Not Available. Requires GD2");
return;
}
if ($this->plot[0]["type"] == "PIE" || $this->plot[0]["type"] == "PIE3D") {
$graph = new PieGraph($this->width_actual, $this->height_actual, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($this->marginleft_actual, $this->marginright_actual, $this->margintop_actual, $this->marginbottom_actual);
$graph->SetMarginColor($this->margincolor_actual);
$graph->img->SetAntiAliasing();
$graph->SetColor($this->graphcolor_actual);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($this->marginbottom_actual - 45);
$graph->yaxis->SetTitleMargin($this->marginleft_actual - 25);
} else {
$graph = new Graph($this->width_actual, $this->height_actual, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($this->marginleft_actual, $this->marginright_actual, $this->margintop_actual, $this->marginbottom_actual);
$graph->SetMarginColor($this->margincolor_actual);
$graph->img->SetAntiAliasing();
$graph->SetColor($this->graphcolor_actual);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($this->marginbottom_actual - 45);
$graph->yaxis->SetTitleMargin($this->marginleft_actual - 25);
}
$lplot = array();
$lplotct = 0;
foreach ($this->plot as $k => $v) {
switch ($v["type"]) {
case "PIE":
$lplot[$lplotct] = new PiePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
foreach ($xlabels as $k => $v) {
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "PIE3D":
$lplot[$lplotct] = new PiePlot3D($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
foreach ($xlabels as $k => $v) {
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "STACKEDBAR":
case "BAR":
$lplot[$lplotct] = new BarPlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
$lplot[$lplotct]->SetWidth(0.8);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
case "LINE":
default:
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$lplot[$lplotct] = new LinePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
}
$lplotct++;
}
$graph->title->Set($this->title_actual);
$graph->xaxis->title->Set($this->xtitle_actual);
$graph->yaxis->title->Set($this->ytitle_actual);
$graph->xgrid->SetColor($this->xgridcolor_actual);
$graph->ygrid->SetColor($this->ygridcolor_actual);
switch ($this->xgriddisplay_actual) {
case "all":
$graph->xgrid->Show(true, true);
break;
case "major":
$graph->xgrid->Show(true, false);
break;
case "minor":
//.........这里部分代码省略.........
开发者ID:GLUD,项目名称:EcoHack,代码行数:101,代码来源:swgraph.php
示例19: array
$image_fieldname = "userPic";
$php_errors = array(1 => 'Maximum file size in php.ini exceeded', 2 => 'Maximum file size in HTML form exceeded', 3 => 'Only part of the file was uploaded', 4 => 'No file was selected to upload.');
// Make sure we didn't have an error uploading the image
$_FILES[$image_fieldname]['error'] == 0 or handle_error("the server couldn't upload the image you selected.", $php_errors[$_FILES[$image_fieldname]['error']]);
// Is this file the result of a valid upload?
@is_uploaded_file($_FILES[$image_fieldname]['tmp_name']) or handle_error("you were trying to do something naughty. Shame on you!", "Uploaded request: file named '{$_FILES[$image_fieldname]['tmp_name']}'");
// Is this actually an image?
@getimagesize($_FILES[$image_fieldname]['tmp_name']) or handle_error("you selected a file for your picture that isn't an image.", "{$_FILES[$image_fieldname]['tmp_name']} isn't a valid image file.");
// Name the file uniquely
$now = time();
while (file_exists($upload_filename = $upload_dir . $now . '-' . $_FILES[$image_fieldname]['name'])) {
//$userpic = $_FILES[$image_fieldname]['name'];
$now++;
}
// Finally, move the file to its permanent location
@move_uploaded_file($_FILES[$image_fieldname]['tmp_name'], $upload_filename) or handle_error("we had a problem saving your image to its permanent location.", "permissions or related error moving file to {$upload_filename}");
$original_filename = str_replace($upload_dir, '/', $upload_filename);
createlargepic($originals_dir, $large_dir, $original_filename, $large_width);
createthumbs($originals_dir, $thumb_dir, $original_filename, $thumb_width);
$message = "Congratulations! You successfully uploaded an image and turned it into a thumbnail!";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PHP File upload and create thumnnail test</title>
</head>
<body>
<h1>PHP File upload and create thumnnail test</h1>
<form name="fileupload" method="post" action="<?php
开发者ID:kamalrazalatif,项目名称:teambook,代码行数:31,代码来源:a_create_thumbnails_test2.php
示例20: connect
function connect($ignore_config = false)
{
$connected = false;
if ($this->connected) {
$this->disconnect();
}
if ($ignore_config) {
$this->_conn_driver = $this->driver;
$this->_conn_user_name = $this->user_name;
$this->_conn_password = $this->password;
$this->_conn_host_name = $this->host_name;
$this->_conn_database = $this->database;
$this->_conn_server = $this->server;
$this->_conn_protocol = $this->protocol;
} else {
if (SW_DB_CONNECT_FROM_CONFIG) {
$this->_conn_driver = SW_DB_DRIVER;
if (!$this->_conn_user_name) {
$this->_conn_user_name = $this->user_name;
}
$this->_conn_password = SW_DB_PASSWORD;
if (!$this->_conn_password) {
$this->_conn_password = $this->password;
}
$this->_conn_host_name = SW_DB_HOST;
$this->_conn_database = SW_DB_DATABASE;
$this->_conn_server = SW_DB_SERVER;
$this->_conn_protocol = SW_DB_PROTOCOL;
} else {
$this->_conn_driver = $this->driver;
$this->_conn_driver = SW_DB_DRIVER;
$this->_conn_user_name = $this->user_name;
$this->_conn_password = $this->password;
$this->_conn_host_name = $this->host_name;
$this->_conn_database = SW_DB_DATABASE;
$this->_conn_server = SW_DB_SERVER;
$this->_conn_protocol = SW_DB_PROTOCOL;
}
}
if ($this->_conn_driver == "none") {
$connected = true;
}
switch ($this->_conn_driver) {
case "none":
$connected = true;
break;
case "array":
$this->ado_connection = new reportico_db_array();
$this->ado_connection->Connect($this->_conn_database);
$connected = true;
break;
case "mysql":
$this->ado_connection = NewADOConnection($this->_conn_driver);
$this->ado_connection->SetFetchMode(ADODB_FETCH_ASSOC);
$connected = $this->ado_connection->Connect($this->_conn_host_name, $this->_conn_user_name, $this->_conn_password, $this->_conn_database);
break;
case "informix":
$this->ado_connection = NewADOConnection($this->_conn_driver);
$this->ado_connection->SetFetchMode(ADODB_FETCH_ASSOC);
if (function_exists("ifx_connect")) {
$connected = $this->ado_connection->Connect($this->_conn_host_name, $this->_conn_user_name, $this->_conn_password, $this->_conn_database);
} else {
handle_error("Attempt to connect to Informix Database Failed. Informix PHP Driver is not Available");
}
break;
case "pdo_mssql":
if (class_exists('PDO', false)) {
if ($this->pdo_driver_exists("dblib")) {
$this->ado_connection = NewADOConnection("pdo");
$cnstr = "dblib:" . "host=" . $this->_conn_host_name . "; " . "username=" . $this->_conn_user_name . "; " . "password=" . $this->_conn_password . "; " . "dbname=" . $this->_conn_database;
if ($dbenc = $this->get_encoding_for_db_driver($this->_conn_driver, SW_DB_ENCODING)) {
$cnstr .= ";CharacterSet=" . $dbenc;
}
$connected = $this->ado_connection->Connect($cnstr, $this->_conn_user_name, $this->_conn_password);
} else {
if ($this->pdo_driver_exists("mssql")) {
$this->ado_connection = NewADOConnection("pdo");
$cnstr = "mssql:" . "host=" . $this->_conn_host_name . "; " . "username=" . $this->_conn_user_name . "; " . "password=" . $this->_conn_password . "; " . "dbname=" . $this->_conn_database;
if ($dbenc = $this->get_encoding_for_db_driver($this->_conn_driver, SW_DB_ENCODING)) {
$cnstr .= ";CharacterSet=" . $dbenc;
}
$connected = $this->ado_connection->Connect($cnstr, $this->_conn_user_name, $this->_conn_password);
} else {
trigger_error("PDO driver for mssql not found. Drivers \"dblib\" and \"mssql\" not found. Available drivers are " . $this->pdo_drivers_as_string());
}
}
} else {
handle_error("Attempt to connect to MSSQL Database Failed. PDO Support does not seem to be Available");
}
break;
case "pdo_mssql":
if (class_exists('PDO', false)) {
$this->ado_connection = NewADOConnection("pdo");
$cnstr = "dblib:" . "host=" . $this->_conn_host_name . "; " . "username=" . $this->_conn_user_name . "; " . "password=" . $this->_conn_password . "; " . "dbname=" . $this->_conn_database;
$connected = $this->ado_connection->Connect($cnstr, $this->_conn_user_name, $this->_conn_password);
} else {
handle_error("Attempt to connect to MSSQL Database Failed. PDO Support does not seem to be Available");
}
break;
case "pdo_sqlsrv":
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:swdb.php
注:本文中的handle_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论