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


PHP errorMessage函数代码示例

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


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

示例1: outputImage

/**
 * Output an image together with last modified header.
 *
 * @param string $file as path to the image.
 * @param boolean $verbose if verbose mode is on or off.
 */
function outputImage($file, $verbose)
{
    $info = getimagesize($file);
    !empty($info) or errorMessage("The file doesn't seem to be an image.");
    $mime = $info['mime'];
    $lastModified = filemtime($file);
    $gmdate = gmdate("D, d M Y H:i:s", $lastModified);
    if ($verbose) {
        verbose("Memory peak: " . round(memory_get_peak_usage() / 1024 / 1024) . "M");
        verbose("Memory limit: " . ini_get('memory_limit'));
        verbose("Time is {$gmdate} GMT.");
    }
    if (!$verbose) {
        header('Last-Modified: ' . $gmdate . ' GMT');
    }
    if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
        if ($verbose) {
            verbose("Would send header 304 Not Modified, but its verbose mode.");
            exit;
        }
        //die(strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) . " not modified $lastModified");
        header('HTTP/1.0 304 Not Modified');
    } else {
        if ($verbose) {
            verbose("Would send header to deliver image with modified time: {$gmdate} GMT, but its verbose mode.");
            exit;
        }
        header('Content-type: ' . $mime);
        readfile($file);
    }
    exit;
}
开发者ID:bthurvi,项目名称:oophp,代码行数:38,代码来源:imgmos.php

示例2: RequiredFields

function RequiredFields($getvars, $requiredfields, $echoErr = true)
{
    $error_fields = '';
    if (count($getvars) < count($requiredfields)) {
        $error = implode(",", $requiredfields);
        if ($echoErr) {
            errorMessage(errorCode::$generic_param_missing . $error, errorCode::$generic_param_missing_code);
        }
        //die();
        return 0;
    }
    // echo json_encode(array(
    // 	$getvars
    // ));
    foreach ($requiredfields as $field) {
        if (!isset($getvars[$field]) || strlen(trim($getvars[$field])) <= 0) {
            $error = true;
            $error_fields .= $field . ', ';
        }
    }
    if (isset($error) && $echoErr) {
        errorMessage(errorCode::$generic_param_missing . $error_fields, errorCode::$generic_param_missing_code);
        //die();
        return 0;
    }
    return 1;
}
开发者ID:ars0709,项目名称:restlog,代码行数:27,代码来源:functions.php

示例3: isValid

/**
 *  Checks to see if the given string is nothing but letters or numbers and is
 *  shorter then a certain length.
 */
function isValid($string)
{
    for ($a = 0; $a < strlen($string); $a++) {
        $char = substr($string, $a, 1);
        $isValid = false;
        // Numbers 0-9
        for ($b = 48; $b <= 57; $b++) {
            if ($char == chr($b)) {
                $isValid = true;
            }
        }
        //Uppercase A to Z
        if (!$isValid) {
            for ($b = 65; $b <= 90; $b++) {
                if ($char == chr($b)) {
                    $isValid = true;
                }
            }
        }
        //Lowercase a to z
        if (!$isValid) {
            for ($b = 97; $b <= 122; $b++) {
                if ($char == chr($b)) {
                    $isValid = true;
                }
            }
        }
        if (!$isValid) {
            return errorMessage();
        }
    }
    return "";
}
开发者ID:papersdb,项目名称:papersdb,代码行数:37,代码来源:functions.php

示例4: processUpload

function processUpload($file, $username = null)
{
    if (!$username) {
        $username = fpCurrentUsername();
    }
    $tmpFile = $file["tmp_name"];
    $mimeType = $file["type"];
    $filename = utf8_decode($file["name"]);
    $filename = cleanupFilename($filename);
    $getcwd = getcwd();
    $freeSpace = disk_free_space("/");
    $uploaded = is_uploaded_file($tmpFile);
    $message = "OK";
    if (!$uploaded) {
        return errorMessage("Uploaded file not found.");
    }
    //verify file type
    if (!startsWith($mimeType, "image")) {
        return errorMessage("Uploaded file {$filename} is not an image. ({$mimeType})");
    }
    //move file to destination dir
    $dataRoot = getConfig("upload._diskPath");
    $dataRootUrl = getConfig("upload.baseUrl");
    createDir($dataRoot, $username);
    $uploadDir = combine($dataRoot, $username);
    $uploadedFile = combine($dataRoot, $username, $filename);
    $filesize = filesize($tmpFile);
    $success = move_uploaded_file($tmpFile, $uploadedFile);
    debug("move to {$uploadedFile}", $success);
    if (!$success) {
        return errorMessage("Cannot move file into target dir.");
    }
    return processImage($uploadDir, $filename);
}
开发者ID:araynaud,项目名称:FoodPortrait,代码行数:34,代码来源:fp_functions.php

示例5: RequiredFields

function RequiredFields($getvars, $requiredfields, $echoErr = true)
{
    if (count($getvars) < count($requiredfields)) {
        $error = implode(",", $requiredfields);
        if ($echoErr) {
            errorMessage(errorCode::$generic_param_missing . $error, errorCode::$generic_param_missing_code);
        }
        //die();
        return 0;
    }
    foreach ($requiredfields as $key) {
        if (array_key_exists($key, $getvars)) {
            if (isset($getvars[$key])) {
            } else {
                $error = implode(",", $requiredfields);
            }
        } else {
            $error = implode(",", $requiredfields);
        }
    }
    if (isset($error) && $echoErr) {
        errorMessage(errorCode::$generic_param_missing . $error, errorCode::$generic_param_missing_code);
        //die();
        return 0;
    }
    return 1;
}
开发者ID:Alexander173,项目名称:angular-noCaptcha-reCaptcha,代码行数:27,代码来源:functions.php

示例6: of

/**
=head1 NAME
func_conditions.php - management of lists of constraits
=head1 SYNOPSIS
to be included once by PHP scripts that show constraints to be selected from
=head1 DESCRIPTION
When attributes are queried against that are shared between forms,
then the associated code should move into this file. The constraint themselves
are defined as an array of ("name","SQL code") pairs. This shall help to reduce
the amount of redundant code between web forms.
=head1 AUTHORS
Steffen ME<ouml>ller <moeller@inb.uni-luebeck.de>
=head1 COPYRIGHT
Universities of Rostock and LE<uuml>beck, 2003-2009
=cut
*/
function print_condition_form_element($conditionList, $prompt, $condition, $radioOrCheckbox = "checkbox")
{
    if (empty($condition)) {
        $condition = array();
    }
    echo "<p>{$prompt}<br>";
    echo "<table>";
    if ("radio" == "{$radioOrCheckbox}") {
        echo "<tr>";
        echo "<td nowrap valign=top><input type={$radioOrCheckbox} name=condition[] value=\"\"";
        if (0 == count($condition)) {
            echo " checked";
        }
        echo ">";
        echo " neither :</td><td><i>don't perform</i></td>";
        echo "</tr>\n";
    } elseif ("checkbox" != "{$radioOrCheckbox}") {
        errorMessage("print_condition_form_element: unknown type '{$radioOrCheckbox}'.");
        exit;
    }
    foreach ($conditionList as $n => $c) {
        //print_r($c);
        echo "<tr>";
        echo "<td nowrap valign=top><input type={$radioOrCheckbox} name=condition[] value=\"{$n}\"";
        if (in_array($n, $condition)) {
            echo " checked";
        }
        echo ">";
        echo " {$n} :</td><td><i>" . $c["description"] . "</i></td>";
        echo "</tr>\n";
    }
    echo "</table>\n";
    echo "</p>";
}
开发者ID:BackupTheBerlios,项目名称:eqtl,代码行数:50,代码来源:func_conditions.php

示例7: _wobi_addWebseedfiles

function _wobi_addWebseedfiles($torrent_file_path, $relative_path, $httplocation, $hash)
{
    $prefix = WOBI_PREFIX;
    $fd = fopen($torrent_file_path, "rb") or die(errorMessage() . "File upload error 1</p>");
    $alltorrent = fread($fd, filesize($torrent_file_path));
    fclose($fd);
    $array = BDecode($alltorrent);
    // Add in Bittornado HTTP seeding spec
    //
    //add information into database
    $info = $array["info"] or die("Invalid torrent file.");
    $fsbase = $relative_path;
    // We need single file only!
    mysql_query("INSERT INTO " . $prefix . "webseedfiles (info_hash,filename,startpiece,endpiece,startpieceoffset,fileorder) values (\"{$hash}\", \"" . mysql_real_escape_string($fsbase) . "\", 0, " . (strlen($array["info"]["pieces"]) / 20 - 1) . ", 0, 0)");
    // Edit torrent file
    //
    $data_array = $array;
    $data_array["httpseeds"][0] = WOBI_URL . "/seed.php";
    //$data_array["url-list"][0] = $httplocation;
    $to_write = BEncode($data_array);
    //write torrent file
    $write_httpseed = fopen($torrent_file_path, "wb");
    fwrite($write_httpseed, $to_write);
    fclose($write_httpseed);
    //add in piecelength and number of pieces
    $query = "UPDATE " . $prefix . "summary SET piecelength=\"" . $info["piece length"] . "\", numpieces=\"" . strlen($array["info"]["pieces"]) / 20 . "\" WHERE info_hash=\"" . $hash . "\"";
    quickQuery($query);
}
开发者ID:j3k0,项目名称:Wobi,代码行数:28,代码来源:wobi_functions.php

示例8: modulus

function modulus($a, $b)
{
    if (b == 0) {
        return "Error: You cannot divide by 0\n";
    } elseif (is_numeric($a) && is_numeric($b)) {
        return $a % $b;
    } else {
        return errorMessage($a, $b);
    }
}
开发者ID:sshaikh210,项目名称:Codeup-Web-Exercises,代码行数:10,代码来源:arithmetic.php

示例9: modulus

function modulus($a, $b)
{
    if (!validateAB($a, $b)) {
        return errorMessage($a, $b, 'not a number');
    } elseif (validateZero($b)) {
        return errorMessage($a, $b, 'dividing by zero');
    } else {
        return $a % $b;
    }
}
开发者ID:anthony87burns,项目名称:codeup-web-exercises,代码行数:10,代码来源:arithmetic.php

示例10: __construct

 public function __construct($maxWidth, $maxHeight)
 {
     //
     // Get the incoming arguments
     //
     $src = isset($_GET['src']) ? $_GET['src'] : null;
     $verbose = isset($_GET['verbose']) ? true : null;
     $saveAs = isset($_GET['save-as']) ? $_GET['save-as'] : null;
     $quality = isset($_GET['quality']) ? $_GET['quality'] : 60;
     $ignoreCache = isset($_GET['no-cache']) ? true : null;
     $newWidth = isset($_GET['width']) ? $_GET['width'] : null;
     $newHeight = isset($_GET['height']) ? $_GET['height'] : null;
     $cropToFit = isset($_GET['crop-to-fit']) ? true : null;
     $sharpen = isset($_GET['sharpen']) ? true : null;
     $grayscale = isset($_GET['grayscale']) ? true : null;
     $sepia = isset($_GET['sepia']) ? true : null;
     $pathToImage = realpath(IMG_PATH . $src);
     //
     // Validate incoming arguments
     //
     is_dir(IMG_PATH) or $this->errorMessage('The image dir is not a valid directory.');
     is_writable(CACHE_PATH) or $this->errorMessage('The cache dir is not a writable directory.');
     isset($src) or $this->errorMessage('Must set src-attribute.');
     preg_match('#^[a-z0-9A-Z-_\\.\\/]+$#', $src) or $this->errorMessage('Filename contains invalid characters.');
     substr_compare(IMG_PATH, $pathToImage, 0, strlen(IMG_PATH)) == 0 or $this->errorMessage('Security constraint: Source image is not directly below the directory IMG_PATH.');
     is_null($saveAs) or in_array($saveAs, array('png', 'jpg', 'jpeg', 'gif')) or $this->errorMessage('Not a valid extension to save image as');
     is_null($quality) or is_numeric($quality) and $quality > 0 and $quality <= 100 or $this->errorMessage('Quality out of range');
     is_null($newWidth) or is_numeric($newWidth) and $newWidth > 0 and $newWidth <= $maxWidth or $this->errorMessage('Width out of range');
     is_null($newHeight) or is_numeric($newHeight) and $newHeight > 0 and $newHeight <= $maxHeight or $this->errorMessage('Height out of range');
     is_null($cropToFit) or $cropToFit and $newWidth and $newHeight or errorMessage('Crop to fit needs both width and height to work');
     //
     // Get the incoming arguments
     //
     $this->maxWidth = $maxWidth;
     $this->maxHeight = $maxHeight;
     $this->src = $src;
     $this->verbose = $verbose;
     $this->saveAs = $saveAs;
     $this->quality = $quality;
     $this->ignoreCache = $ignoreCache;
     $this->newWidth = $newWidth;
     $this->newHeight = $newHeight;
     $this->cropToFit = $cropToFit;
     $this->sharpen = $sharpen;
     $this->grayscale = $grayscale;
     $this->sepia = $sepia;
     $this->pathToImage = $pathToImage;
     $this->fileExtension = pathinfo($pathToImage)['extension'];
 }
开发者ID:EmilSjunnesson,项目名称:rental,代码行数:49,代码来源:CImage.php

示例11: userExists

function userExists($loginDetails, $errorMsg)
{
    $DBConnection = new DBHander();
    $DBConnection->connectToDB();
    if ($DBConnection->userExists($loginDetails)) {
        $errorMsg = "";
        errorMessage($errorMsg);
        $validUser = $_POST['login'];
        $_SESSION['validUser'] = $validUser[0];
        header("Location: home.php");
    } else {
        $errorMsg = "Invalid username and/or password";
        errorMessage($errorMsg);
    }
}
开发者ID:azaeng04,项目名称:ip3shoppingcartazatra,代码行数:15,代码来源:validate-user.php

示例12: storeImages

function storeImages($sizes, $photo_id)
{
    for ($i = 0; $i < count($sizes); $i++) {
        // echo "This is sizes src : ".$sizes[$i]->src."<br></br>" ;
        // echo "This is sizes width : ".$sizes[$i]->width."<br></br>" ;
        // echo "This is sizes height : ".$sizes[$i]->height."<br></br>" ;
        // echo "This is sizes type : ".$sizes[$i]->type."<br></br>" ;
        // echo "This is sizes type : ".$photo_id."<br></br>" ;
        // echo "<img src=\"".$sizes[$i]->src."\" >";
        $sql = "INSERT INTO IMAGES (PID, SRC, WIDTH, HEIGHT, TYPE) \n    VALUES ('" . $photo_id . "','" . mysql_real_escape_string($sizes[$i]->src) . "','" . $sizes[$i]->width . "','" . $sizes[$i]->height . "','" . mysql_real_escape_string($sizes[$i]->type) . "')";
        $res = mysql_query($sql);
        $msg = $res ? successMessage("Uploaded and saved to IMAGES.") : errorMessage("Problem in saving to IMAGES");
        echo "=== : " . $photo_id . "  : " . $msg . " <br>";
    }
}
开发者ID:ansuangrytest,项目名称:vkphotos,代码行数:15,代码来源:index.php

示例13: dbConnect

/**
* Project:		positweb
* File name:	dao.php
* Description:	database access
* PHP version 5, mysql 5.0
*
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
*
* @author       Antonio Alcorn
* @copyright    Humanitarian FOSS Project@Trinity (http://hfoss.trincoll.edu), Copyright (C) 2009.
* @package		posit
* @subpackage
* @tutorial
* @license  http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
* @version
*/
function dbConnect()
{
    $host = DB_HOST;
    $user = DB_USER;
    $pass = DB_PASS;
    $db_name = DB_NAME;
    try {
        $db = new PDO("mysql:host={$host};dbname={$db_name}", $user, $pass);
    } catch (PDOException $e) {
        errorMessage("Database error: " . $e->getMessage());
        die;
    }
    mysql_connect($host, $user, $pass);
    mysql_select_db($db_name);
    return $db;
}
开发者ID:Raconeisteron,项目名称:posit-mobile,代码行数:34,代码来源:dao.php

示例14: list_markers

/**

=head1 NAME

func_phenotypes.php - helper routines to retrieve phenotype information

=head1 SYNOPSIS

functionality on retrieving phenotype data with a recurrent use

=head1 DESCRIPTION

THe classical phenotypes are frequently used as covariates, but
they also have a life ontheir own.

=cut

/
**

=head2 list_phenotypes

=over 4

=item $dbh

data base handle to the expression QTL table with the phenotype correlations

=back

=cut
*/
function list_markers($dbh)
{
    $queryMarkers = "SELECT DISTINCT marker,chr,cmorgan_rqtl as cM FROM map ORDER BY chr,cM";
    $result = mysqli_query($dbh, $queryMarkers);
    if (empty($result)) {
        mysqli_close($dbh);
        errorMessage("Error: " . mysqli_error($dbh) . "</p><p>" . $queryPhenotypes . "</p>");
        //echo "LinkLocal: "; print_r($linkLocal);
        exit;
    }
    $markers = array();
    while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)) {
        $markers[$line["marker"]] = $line["marker"] . " " . $line["chr"] . ":" . $line["cM"];
    }
    mysqli_free_result($result);
    return $markers;
}
开发者ID:BackupTheBerlios,项目名称:eqtl,代码行数:49,代码来源:func_markers.php

示例15: list_phenotypes

/**

=head1 NAME

func_phenotypes.php - helper routines to retrieve phenotype information

=head1 SYNOPSIS

functionality on retrieving phenotype data with a recurrent use

=head1 DESCRIPTION

THe classical phenotypes are frequently used as covariates, but
they also have a life ontheir own.

=cut

/
**

=head2 list_phenotypes

=over 4

=item $dbh

data base handle to the expression QTL table with the phenotype correlations

=back

=cut
*/
function list_phenotypes($dbh)
{
    $queryPhenotypes = "SELECT DISTINCT phen FROM trait_phen_cor";
    $queryPhenotypes .= " LIMIT 1000";
    # just to be on the save side
    $result = mysqli_query($dbh, $queryPhenotypes);
    if (empty($result)) {
        mysqli_close($dbh);
        errorMessage("Error: " . mysqli_error($dbh) . "</p><p>" . $queryPhenotypes . "</p>");
        //echo "LinkLocal: "; print_r($linkLocal);
        exit;
    }
    $phenotypes = array();
    while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)) {
        array_push($phenotypes, $line["phen"]);
    }
    mysqli_free_result($result);
    return $phenotypes;
}
开发者ID:BackupTheBerlios,项目名称:eqtl,代码行数:51,代码来源:func_phenotypes.php


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