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


PHP reportError函数代码示例

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


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

示例1: updateOsmFile

function updateOsmFile($filename, $db)
{
    global $offset, $offsetfactorrels, $connection;
    $connection = connectToDatabase($db);
    // if there is no connection
    if (!$connection) {
        reportError("Cannot connect to database.");
        return false;
    }
    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    if (!($fp = fopen($filename, "r"))) {
        reportError("Cannot open file.");
        return false;
    }
    while ($data = fread($fp, 4096)) {
        if (!xml_parse($xml_parser, $data, feof($fp))) {
            reportError("XML-Error.");
            return false;
        }
    }
    xml_parser_free($xml_parser);
    fclose($fp);
    pg_close($connection);
    echo "Finished " . $db . "...\n";
    return true;
}
开发者ID:dieterdreist,项目名称:OpenLinkMap,代码行数:27,代码来源:update.php

示例2: deleteThe

 /**
  * Delete the given model entity.
  *
  * @param Model $model  Model to be deleted.
  * @param string $msg   Message for a successful delete.
  * @param string $title Title for a successful delete.
  *
  * @return array
  */
 protected function deleteThe(Model $model, $msg = 'messages.deleted', $title = 'messages.success')
 {
     if ($model->delete()) {
         return ['title' => trans("admin::{$title}"), 'msg' => trans("admin::{$msg}")];
     }
     return reportError();
 }
开发者ID:BlazOrazem,项目名称:laravel-basis,代码行数:16,代码来源:BaseController.php

示例3: connect

function connect()
{
    //global $host_db,$user_db,$password_db,$bdd_db;
    $host_db = "localhost";
    // nom de votre serveur
    $user_db = "";
    // nom d'utilisateur de connexion � votre bdd
    $password_db = "";
    // mot de passe de connexion � votre bdd
    $bdd_db = "grottoce";
    // nom de votre bdd
    $connect_db = mysql_connect($host_db, $user_db, $password_db);
    $filename = "mysql";
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
        $IP = $_SERVER['HTTP_CLIENT_IP'];
    } else {
        $IP = $_SERVER['REMOTE_ADDR'];
    }
    $content = "|" . $IP . "|" . session_id() . "|" . __FUNCTION__ . "|" . $connect_db;
    logDBToFile($content, $filename);
    if (is_resource($connect_db)) {
        mysql_select_db($bdd_db, $connect_db);
        mysql_query("SET NAMES UTF8");
        return $connect_db;
    } else {
        reportError(mysql_error(), __FILE__, "function", __FUNCTION__, 'Connection Error');
        exit;
    }
}
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:31,代码来源:config.php

示例4: executeReader

function executeReader($sql)
{
    try {
        global $odb;
        //clearError();
        return $odb->query($sql);
    } catch (Exception $ex) {
        reportError();
    }
}
开发者ID:ricain59,项目名称:fortaff,代码行数:10,代码来源:sqlite.php

示例5: showClientWebsites

            showClientWebsites($userid);
        }
    }
} elseif ($siteid == 0 && isset($_GET['add'])) {
    if (isActive($userid)) {
        if (maxUserSites($userid) == false) {
            $_SESSION['website'] = newWebsite($userid);
            $siteid = $_SESSION['website'];
            showTemplates($siteid, 0, 0, 'select');
        } else {
            if (isUser($userid)) {
                addStaticWebsite($userid);
            } elseif (isDeveloper($userid)) {
                sysMsg(MSG00093);
                if (isDeveloper($userid)) {
                    reportError('User (U53R' . $userid . ') reached the maximum number of allowed websites.');
                }
            } else {
                sysMsg(MSG00094);
            }
            showClientWebsites($userid);
        }
    } else {
        demoMsg();
        showClientWebsites($userid);
    }
} elseif (isset($_GET['website']) && isset($_GET['delete'])) {
    // 	$siteid = cleanGet($_GET['delete']);
    if ($siteid != 0) {
        if (isActive($userid)) {
            if ($_SESSION['userid'] == '1' && $userid == '1') {
开发者ID:hscale,项目名称:SiteZilla,代码行数:31,代码来源:sz.php

示例6: getType

 /**
     Tries to find a response handler for $request->getType().
 
     $request must be one of:
 
     - A JSONRequest object. Its getType() value is used
     as the handler lookup key.
 
     - An array, in which case the JSONRequest($request)
     is called to construct a request.
 
     - A string containing '{', in which case it is assumed
     to be message JSON and is passed on to JSONRequest($request).
 
     - A string containing a lookup key. If it is found, the response
     handler is passed that key rather than a JSONRequest() object.
 
     If $f is a string and does not map to a current entry then
     paths which have been registered in addAutoloadDir() are searched
     for a file names EVENT_TYPE.inc.php. If one is found, it is
     include and the mapping is re-checked (because presumably the
     file will register a handler).
 
     Returns:
 
     If no handler is found, null is returned. If one is found,
     it is handled as described in mapResponder()
     and on success a JSONResponder is returned. If an error is encountered
     in the handling of the request, the contained response will
     be a wrapper for that error.
 */
 public static function getResponder($request)
 {
     $key = null;
     function reportError($r, $msg)
     {
         return new JSONResponder_Error($r, __CLASS__ . '::getResponder(): ' . $msg);
     }
     if (is_string($request)) {
         if (false === strpos($request, '{')) {
             $key = $request;
         } else {
             try {
                 $request = new JSONRequest($request);
                 $key = $request->getType();
             } catch (Exception $e) {
                 if (1) {
                     throw $e;
                 } else {
                     return new JSONResponder_Error(null, "EXCEPTION while creating JSONRequest from request data: " . $e->getMessage());
                 }
             }
         }
     } else {
         if ($request instanceof JSONRequest) {
             $key = $request->getType();
         } else {
             if (@is_array($request)) {
                 $request = new JSONRequest($request);
                 $key = $request->getType();
             } else {
                 // TODO: create an Exception response type to wrap this, and return it:
                 return new JSONResponder_Error(new JSONRequest(), "Illegal arguments to " . __CLASS__ . "::getResponder([unknown])");
             }
         }
     }
     $f = @self::$handlers[$key];
     $request->set('arrivalTime', $request->get('arrivalTime', JSONMessage::timestamp()));
     while (!$f) {
         foreach (self::$DispatcherPath as $dir) {
             $fn = $dir . '/' . $key . '.inc.php';
             if (@file_exists($fn)) {
                 require_once $fn;
                 $f = @self::$handlers[$key];
                 break;
             }
         }
         if (!$f) {
             return null;
         }
         //reportErr($request,"No Responder found for message type '".$key."'.");
         break;
     }
     if (is_string($f)) {
         if (class_exists($f)) {
             $x = new $f($request);
             if ($x instanceof JSONResponder) {
                 return $x;
             } else {
                 if ($x instanceof JSONResponse) {
                     return new JSONResponder_Generic($request, $x);
                 } else {
                     return reportError($r, "class mapped to [" . $key . "] is neither " . "a JSONResponder nor a JSONResponse!");
                 }
             }
         } else {
             if (function_exists($f)) {
                 $x = $f($request);
                 if ($x instanceof JSONResponder) {
                     return $x;
//.........这里部分代码省略.........
开发者ID:reidab,项目名称:wikiwym,代码行数:101,代码来源:JSONMessage.inc.php

示例7: stripcslashes

<?php 
if (isset($_POST['query'])) {
    $query = $_POST['query'];
    $query = stripcslashes($query);
    $q = strtolower($query);
    $forbidden = array('drop', 'delete', 'update', 'create', 'alter');
    foreach ($forbidden as $key) {
        if (strpos($q, $key) !== false) {
            reportError("Query modifies the data! Queries like DROP, DELETE, UPDATE, CREATE and ALTER are not supported as they change the underlying data.");
            die;
        }
    }
    $result = executeQuery($con, $query);
    if ($result == false) {
        reportError(mysqli_error($con));
        die;
    }
    ?>
    <table class="bordered">
        <thead>
        <?php 
    $numFields = mysqli_num_fields($result);
    echo '<tr>';
    for ($i = 0; $i < $numFields; $i++) {
        $field = mysqli_fetch_field_direct($result, $i);
        echo '<th>' . $field->name . '</th>';
    }
    echo '</tr>';
    ?>
        </thead>
开发者ID:sam1487,项目名称:COMP-6120,代码行数:30,代码来源:query.php

示例8: md5

                 $path = '/';
             }
             if (isset($_FILES['uploadFile']['name'])) {
                 if (!$_FILES['uploadFile']['error'] and $_FILES['uploadFile']['name'] and $_FILES['uploadFile']['size'] > 0) {
                     @ini_set('max_execution_time', '1800');
                     @set_time_limit(1800);
                     try {
                         $tempFile = APPROOT . '/cache/' . md5(mt_rand(0, 99999999) . time());
                         move_uploaded_file($_FILES['uploadFile']['tmp_name'], $tempFile);
                         $fp = fopen($tempFile, 'rb');
                         $client->putStream($fp, $path . '/' . $_FILES['uploadFile']['name']);
                         fclose($fp);
                         header('Location: options.php?command=list&path=' . urlencode($path));
                         unlink($tempFile);
                     } catch (\Vdisk\Exception $e) {
                         reportError($e);
                     }
                 } else {
                     echo 'Not a valid file selected.';
                 }
             } else {
                 include_once APPROOT . '/tpl/upload.php';
             }
         } else {
             header('Location: options.php?command=auth');
         }
     } else {
         header('Location: options.php?command=login&ref=' . urlencode($path));
     }
     break;
 case 'login':
开发者ID:slurin,项目名称:Vdisk-File-Explorer,代码行数:31,代码来源:options.php

示例9: reportError

<?php

// POST atom/add?contents=contentsStr
require_once "../common.php";
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
    reportError(HTTP_STATUS_METHOD_NOT_ARROWED, "You should use POST method to use this API.");
}
if (!isset($_REQUEST["contents"])) {
    reportError(HTTP_STATUS_BAD_REQUEST, "Argument 'contents' is not passed.");
}
$db = connectDB();
$retv = db_addAtomElement($db, $_REQUEST["contents"]);
if ($retv[0] != 0) {
    reportError(HTTP_STATUS_INTERNAL_SERVER_ERROR, $retv[1]);
}
http_response_code(HTTP_STATUS_CREATED);
elementListBegin();
echoAtomElement(UUID_ServerResponse, $retv[1]);
echoAtomElement($retv[1], $_REQUEST["contents"]);
elementListEnd();
开发者ID:hikalium,项目名称:mgdb,代码行数:20,代码来源:add.php

示例10: recoverFromMismatchedSet

 /** Not currently used */
 public function recoverFromMismatchedSet($input, $e, $follow)
 {
     if ($this->mismatchIsMissingToken($input, $follow)) {
         // System.out.println("missing token");
         reportError($e);
         // we don't know how to conjure up a token for sets yet
         return $this->getMissingSymbol($input, $e, TokenConst::$INVALID_TOKEN_TYPE, $follow);
     }
     // TODO do single token deletion like above for Token mismatch
     throw $e;
 }
开发者ID:laiello,项目名称:antlrphpruntime,代码行数:12,代码来源:BaseRecognizer.php

示例11: show_form

     break;
 case 'login':
     if (!$session->is_logged_in()) {
         show_form('login');
     }
     break;
 case 'resetpw':
     if (!isset($_SESSION['userid'])) {
         if ($index_page[1] != '0' && $index_page[1] == 'send') {
             if (isValid($_POST['email'], 'email')) {
                 if (emailExists($_POST['email'])) {
                     if (sendNewPassw($_POST['email'])) {
                         show_msg(translate('An email has been sent to your email address. Please follow the instructions in the email.', sz_config('language')));
                     } else {
                         show_msg(translate('An error has occurred while trying to reset your password.', sz_config('language')));
                         if (reportError('Unable to reset password for' . $_POST['email'])) {
                             show_msg(translate('The website developers have been notified and you will be contacted shortly.', sz_config('language')));
                         } else {
                             reportErrorManually('33215');
                         }
                     }
                 } else {
                     show_form('passreset', translate('Please enter your own email address.', sz_config('language')));
                 }
             } else {
                 show_form('passreset', translate('You have entered an invalid email address. Please try again.', sz_config('language')));
             }
         } else {
             show_form('passreset', '');
         }
     }
开发者ID:hscale,项目名称:SiteZilla,代码行数:31,代码来源:index.php

示例12: execSQL

function execSQL($sql, $frame, $file, $function)
{
    $connect_db = connect();
    $req = mysql_query($sql) or die(reportError(mysql_error(), $file, $frame, $function, 'Erreur SQL : ' . $sql));
    if ($req) {
        $id = mysql_insert_id($connect_db);
        $affected_rows = mysql_affected_rows($connect_db);
    }
    //mysql_free_result($req);
    close($connect_db);
    $array = array('mysql_query' => $req, 'mysql_insert_id' => $id, 'mysql_affected_rows' => $affected_rows);
    return $array;
}
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:13,代码来源:function.php

示例13: quizzes

    } else {
        //build query string
        $query = "INSERT INTO quizzes (question, answer1, answer2, answer3, answer4, answer5, answer6, answer7, answer8, results, url_code, multiple, ip_restrict, ip_list) ";
        $query .= "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
        //prepare and execute query
        $statement = $conn->prepare($query);
        if ($conn->error) {
            reportError($conn->error, $errors);
        }
        $statement->bind_param("ssssssssssssss", $question, $answersArray[0], $answersArray[1], $answersArray[2], $answersArray[3], $answersArray[4], $answersArray[5], $answersArray[6], $answersArray[7], $results, $quizURLcode, $multiple, $ip_restrict, $iplist);
        if ($conn->error) {
            reportError($conn->error, $errors);
        }
        $statement->execute();
        if ($conn->error) {
            reportError($conn->error, $errors);
        }
        $statement->close();
        $conn->close();
    }
    //stop execution if any page errors occurred
    verifyNoErrors($errors);
    //redirect to this page, but now with a urlcode url parameter
    header("Location: quiz.php?qid=" . $quizURLcode);
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
开发者ID:quiquiz,项目名称:quiquiz.github.io,代码行数:31,代码来源:new.php

示例14: checkAuth

function checkAuth()
{
    if (!isset($_SESSION['auth']) || $_SESSION['auth'] !== true) {
        reportError(1, __("You must authenticate to run the upgrade."));
    }
}
开发者ID:abbeet,项目名称:server39,代码行数:6,代码来源:upgrade.php

示例15: validateNewUser

function validateNewUser()
{
    $email = mysql_real_escape_string($_GET["email"]);
    $token = mysql_real_escape_string($_GET["token"]);
    $password = mysql_real_escape_string($_GET["password"]);
    $md5password = md5($password);
    $sql = "SELECT * FROM  `verification` WHERE  `email` \n          LIKE  '{$email}' AND  `token` LIKE  '{$token}'";
    $result = mysql_query($sql);
    if (mysql_num_rows($result) == 1) {
        $sql = "INSERT INTO `users` (`email`, `password`, `active`) \n          VALUES ('{$email}', '{$md5password}', '1');";
        if (!mysql_query($sql)) {
            reportError($sql);
        }
        $sql = "DELETE FROM `verification` WHERE `email` = '{$email}'";
        if (!mysql_query($sql)) {
            reportError($sql);
        } else {
            $_POST["email"] = $email;
            $_POST["password"] = $password;
            checkLogin();
            echo '1';
        }
    } else {
        echo 'Your verification values are incorrect: ' + $email + $token;
    }
}
开发者ID:Rovanion,项目名称:Yaws,代码行数:26,代码来源:operations.php


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