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


PHP sendError函数代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->socket = socket_create(AF_INET, SOCK_STREAM, 0);
     if ($this->socket < 0) {
         sendError('socket_create() failed: reason: ' . socket_strerror($this->socket));
     }
 }
开发者ID:nbhatti,项目名称:FreeSWITCH-panel,代码行数:7,代码来源:fspanel.php

示例2: getConnection

function getConnection()
{
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    if ($mysqli->connect_errno) {
        sendError("Error al intentar establecer la coneccion a la base");
    } else {
        $mysqli->query("SET NAMES 'utf8'");
        return $mysqli;
    }
}
开发者ID:juanmav,项目名称:angular-clases,代码行数:10,代码来源:init.php

示例3: listCategorias

function listCategorias()
{
    $c = getConnection();
    $query = "SELECT * FROM categorias";
    $categorias = array();
    if ($resultado = $c->query($query)) {
        while ($fila = $resultado->fetch_assoc()) {
            $categorias[] = $fila;
        }
        $resultado->free();
        sendResult(array("categorias" => $categorias), "Ok");
    } else {
        sendError("No se encontraron resultados");
    }
}
开发者ID:juanmav,项目名称:angular-clases,代码行数:15,代码来源:categorias.php

示例4: mysql_session_write

function mysql_session_write($SessionID, $val)
{
    #	dbg("writing session info for $SessionID");
    $SessionTableName = $GLOBALS["SessionTableName"];
    $SessionID = addslashes($SessionID);
    $val = addslashes($val);
    $SessionExists = sql_fetch_row_query("select count(*) from  {$SessionTableName} where sessionid = '{$SessionID}'");
    if ($SessionExists[0] == 0) {
        $retval = sql_query(sprintf('insert into %s (sessionid,lastactive,data) values("%s",UNIX_TIMESTAMP(NOW()),"%s")', $SessionTableName, $SessionID, $val));
    } else {
        $retval = sql_query(sprintf('update %s SET data = "%s", lastactive = UNIX_TIMESTAMP(NOW()) where sessionid = "%s"', $SessionTableName, $val, $SessionID));
        if (sql_affected_rows() < 0) {
            sendError("unable to update session data for session {$SessionID}");
        }
    }
    return $retval;
}
开发者ID:narareddy,项目名称:phplist3,代码行数:17,代码来源:sessionlib.php

示例5: onData

 public function onData($json, $client)
 {
     $data = json_decode($json, true);
     if ($data === NULL || !isset($data['type']) || !isset($this->clienId2room[$client->getId()]) && $data['type'] !== "participate") {
         $this->sendError("不正なデータを受信しました:無意味なメッセージ", $client);
         return;
     }
     try {
         switch ($data['type']) {
             case "participate":
                 if (!isset($data['roomId']) || !isset($data['userId'])) {
                     $this->sendError("ログインに必要な情報がたりません", $client);
                     return;
                 }
                 $data['roomId'] = trim($data['roomId']);
                 $data['userId'] = trim($data['userId']);
                 if (!isset($this->roomName2room[$data['roomId']])) {
                     $this->roomName2room[$data['roomId']] = new ChatRoom();
                 }
                 $this->clienId2room[$client->getId()] = $this->roomName2room[$data['roomId']];
                 $this->clienId2room[$client->getId()]->loginUser($client, $data['userId']);
                 break;
             case "message":
                 if (!isset($data['body'])) {
                     $this->sendError("不正なデータを受信しました:内容のないチャット送信", $client);
                     return;
                 }
                 $this->clienId2room[$client->getId()]->sendMessage($client, $data['body']);
                 break;
             case "logout":
                 $this->clienId2room[$client->getId()]->logoutUser($client);
                 unset($this->clienId2room[$client->getId()]);
                 break;
             default:
                 sendError("不正なデータを受信しました:無効な種類のメッセージ", $client);
                 return;
         }
     } catch (UserNotFoundException $e) {
         $this->sendError($e->getMessage(), $client);
         return;
     } catch (ConnectionAlreadyEstablishedException $e) {
         $this->sendError($e->getMessage(), $client);
         return;
     }
 }
开发者ID:nullpo-head,项目名称:Wrench-ChatApplicationDemo,代码行数:45,代码来源:ChatApplication.php

示例6: verifyCurrentPathAccess

 /**
  * @return int
  */
 public static function verifyCurrentPathAccess()
 {
     if (!isset($_POST["path"]) || !is_numeric($_POST["path"])) {
         sendError(400);
     }
     $pathID = (int) $_POST["path"];
     $allowedPaths = self::getAllowedPaths();
     if (!isset($allowedPaths[$pathID])) {
         sendError(404);
     }
     return $pathID;
 }
开发者ID:djmattyg007,项目名称:pictorials,代码行数:15,代码来源:accesscontrol.php

示例7: sendError

            sendError('Your local password is not set. Use Create Account to set a new password.');
        }
        // Verify password.
        if (!empty($user_password) && check_encrypted_password($dbHandle, $username, $password)) {
            $result = $dbHandle->query("SELECT userID,permissions FROM users WHERE username=" . $username_quoted);
            $user = $result->fetch(PDO::FETCH_ASSOC);
            $result = null;
            if (!empty($user['userID'])) {
                session_regenerate_id(true);
                $_SESSION['user_id'] = $user['userID'];
                $_SESSION['user'] = $_POST['user'];
                $_SESSION['permissions'] = $user['permissions'];
                $_SESSION['auth'] = true;
            }
        } else {
            sendError('Bad username or password.');
        }
    }
    $dbHandle = null;
}
/**
 * If user is authorized, read settings and create user-specific temp dirs.
 */
if (isset($_SESSION['auth']) && isset($_POST['form'])) {
    database_connect(IL_USER_DATABASE_PATH, 'users');
    $user_id_q = $dbHandle->quote($_SESSION['user_id']);
    // Session management.
    if ($ini_array['autosign'] == 0) {
        $session_id_q = $dbHandle->quote(session_id());
        // Save this signin in db.
        $dbHandle->exec("DELETE FROM logins" . " WHERE sessionID={$session_id_q} AND userID={$user_id_q}");
开发者ID:jamesscottbrown,项目名称:i-librarian,代码行数:31,代码来源:authenticate.php

示例8: verifyPavillon

            $error = 'Le numéro de poste doit être composé de 5 chiffres et commencé par 5 ou 9';
            break;
        case 'idPavillon':
            $pavillon = verifyPavillon(substr($info, 0, 1));
            $etage = verifyEtage(substr($info, 1));
            $boolError = $pavillon && $etage;
            $error = "Le pavillon ou l'étage est incorrect";
            break;
        case 'idLogiciel':
            $boolError = verifySoft($info);
            $error = "Le nom du logiciel ne peut pas contenir d'accents, ni de caractères spéciaux";
            break;
        default:
            throw new Exception("ID NON VALIDE");
    }
    if ($boolError === false) {
        sendError($error);
    }
} else {
    sendError("Le champs est vide");
}
/*
 * Cette fonction permet de retourner les erreurs
 */
function sendError($message)
{
    header("Content-Type : application/json");
    $erreur = array();
    $erreur["description"] = $message;
    echo json_encode($erreur);
}
开发者ID:vrajau,项目名称:Incident_CHT,代码行数:31,代码来源:verify.php

示例9: nl2br

    if (isset($_POST['check-3'])) {
        $content .= '<li>Vinduespudsning</li>';
    }
    if (isset($_POST['check-4'])) {
        $content .= '<li>Havearbejde</li>';
    }
    if (isset($_POST['check-5'])) {
        $content .= '<li>Snerydning</li>';
    }
    if (isset($_POST['check-6'])) {
        $content .= '<li>Skadeservice</li>';
    }
    $content .= '</ul>';
}
if (isset($message) && !empty($message)) {
    $content .= '<p><strong>Tilføjet besked: </strong></p><hr>';
    $content .= nl2br($message);
    $content .= '<hr>';
}
$content .= '<p style="font-size:10px;color:#888;">(' . $name . ' er sat som afsender af denne email, så du kan svare direkte tilbage på den.)</p>';
require 'mail_footer.php';
$new_post_array = array('post_content' => $content_header_white . $content, 'post_title' => $new_post_title, 'post_status' => 'private', 'post_type' => 'email');
$new = wp_insert_post($new_post_array, true);
if (is_wp_error($new)) {
    sendError($new->get_error_message());
} else {
    $response['success'] = 'oprettet med id: ' . $new;
    echo json_encode($response);
}
sendEmail($email, $receiver, 'Ny besked fra kontaktformular', $content_header_white . $content);
sendEmail('info@aa-w.dk', $email, 'Tak for din henvendelse', $content_header . $content_extra . $content);
开发者ID:JeppeSigaard,项目名称:aamann,代码行数:31,代码来源:formhandler.php

示例10: saveUserAttribute

function saveUserAttribute($userid, $attid, $data)
{
    global $usertable_prefix, $tables;
    # workaround for integration webbler/phplist
    if (!isset($usertable_prefix)) {
        $usertable_prefix = '';
    }
    if (!empty($tables["attribute"])) {
        $att_table = $usertable_prefix . $tables["attribute"];
        $user_att_table = $usertable_prefix . $tables["user_attribute"];
    } else {
        $att_table = $usertable_prefix . "attribute";
        $user_att_table = $usertable_prefix . "user_attribute";
    }
    if ($data["nodbsave"]) {
        dbg("Not saving {$attid}");
        return;
    }
    if (strtolower($data) == 'invalid attribute index') {
        return;
    }
    if ($attid == "emailcheck" || $attid == "passwordcheck") {
        dbg("Not saving {$attid}");
        return;
    }
    if (!$data["type"]) {
        $data["type"] = "textline";
    }
    if ($data["type"] == "static" || $data["type"] == "password" || $data['type'] == 'htmlpref') {
        Sql_Query(sprintf('update user set %s = "%s" where id = %d', $attid, $data["value"], $userid));
        if ($data["type"] == "password") {
            Sql_Query(sprintf('update user set passwordchanged = now() where id = %d', $userid));
        }
        return 1;
    }
    $attid_req = Sql_Fetch_Row_Query(sprintf('
    select id,type,tablename from %s where id = %d', $att_table, $attid));
    if (!$attid_req[0]) {
        $attid_req = Sql_Fetch_Row_Query(sprintf('
      select id,type,tablename from %s where name = "%s"', $att_table, $data["name"]));
        if (!$attid_req[0]) {
            if ($GLOBALS["config"]["autocreate_attributes"]) {
                Dbg("Creating new Attribute: " . $data["name"]);
                sendError("creating new attribute " . $data["name"]);
                $atttable = getNewAttributeTablename($data["name"]);
                Sql_Query(sprintf('insert into %s (name,type,tablename) values("%s","%s","%s")', $att_table, $data["name"], $data["type"], $atttable));
                $attid = Sql_Insert_Id();
            } else {
                dbg("Not creating new Attribute: " . $data["name"]);
                # sendError("Not creating new attribute ".$data["name"]);
            }
        } else {
            $attid = $attid_req[0];
            $atttable = $attid_req[2];
        }
    } else {
        $attid = $attid_req[0];
        $atttable = $attid_req[2];
    }
    if (!$atttable) {
        $atttable = getNewAttributeTablename($data["name"]);
        # fix attribute without tablename
        Sql_Query(sprintf('update %s set tablename ="%s" where id = %d', $att_table, $atttable, $attid));
        #   sendError("Attribute without Tablename $attid");
    }
    switch ($data["type"]) {
        case "static":
        case "password":
            Sql_Query(sprintf('update user set %s = "%s" where id = %d', $attid, $data["value"], $userid));
            break;
        case "select":
            $curval = Sql_Fetch_Row_Query(sprintf('select id from phplist_listattr_%s
        where name = "%s"', $atttable, $data["displayvalue"]), 1);
            if (!$curval[0] && $data['displayvalue'] && $data['displayvalue'] != '') {
                Sql_Query(sprintf('insert into phplist_listattr_%s (name) values("%s")', $atttable, $data["displayvalue"]));
                sendError("Added " . $data["displayvalue"] . " to {$atttable}");
                $valid = Sql_Insert_id();
            } else {
                $valid = $curval[0];
            }
            Sql_Query(sprintf('replace into %s (userid,attributeid,value)
        values(%d,%d,"%s")', $user_att_table, $userid, $attid, $valid));
            break;
        case 'avatar':
            if (is_array($_FILES)) {
                ## only avatars are files
                $formfield = 'attribute' . $attid . '_file';
                ## the name of the fileupload element
                if (!empty($_FILES[$formfield]['name'])) {
                    $tmpnam = $_FILES[$formfield]['tmp_name'];
                    move_uploaded_file($tmpnam, '/tmp/avatar' . $userid . '.jpg');
                    if (function_exists('resizeImageFile')) {
                        resizeImageFile('/tmp/avatar' . $userid . '.jpg', 250, 1);
                    }
                    $size = filesize('/tmp/avatar' . $userid . '.jpg');
                    #          dbg('New size: '.$size);
                    if ($size < MAX_AVATAR_SIZE) {
                        $avatar = file_get_contents('/tmp/avatar' . $userid . '.jpg');
                        Sql_Query(sprintf('replace into %s (userid,attributeid,value)
              values(%d,%d,"%s")', $user_att_table, $userid, $attid, base64_encode($avatar)));
//.........这里部分代码省略.........
开发者ID:kvervo,项目名称:phplist-aiesec,代码行数:101,代码来源:userlib.php

示例11: routeRequest

function routeRequest($gpio)
{
    $method = $_SERVER['REQUEST_METHOD'];
    $request_uri = $_SERVER['REQUEST_URI'];
    $root = $_SERVER['DOCUMENT_ROOT'];
    $script = $_SERVER['SCRIPT_FILENAME'];
    $path = pathinfo($script);
    $context = substr($path['dirname'], strlen($root));
    $uri = substr($request_uri, strlen($context));
    $vars = explode('/', $uri);
    global $SERVER_VERSION;
    header("Server: " + $SERVER_VERSION);
    if ($method == "GET") {
        doGET($gpio, $vars);
    } else {
        if ($method == "POST") {
            doPOST($gpio, $vars);
        } else {
            sendError(405, "Not Allowed");
        }
    }
}
开发者ID:rogeros,项目名称:webiopi,代码行数:22,代码来源:webiopi.php

示例12: sendError

    sendError(3);
}
//linkstats = 1 mean old link
if ($linkstatus == 1) {
    sendError(4);
}
//linkstats = 2 mean used link
if ($linkstatus == 2) {
    sendError(5);
}
//check if linktime has expiered i.e a day old
$curtime = time();
$cmptime = $linktime + 24 * 60 * 60;
if ($curtime > $cmptime) {
    snapUpdateLinkStatus($snapDbConn, $linkid, 1);
    sendError(3);
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>MeetOn SNAP - Reset Password</title>
	<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
	<link href="common/css/bootstrap.css" rel="stylesheet" type="text/css" />
	<link href="common/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
	<link href="postlogin/css/ionicons.min.css" rel="stylesheet" type="text/css" />
	<link href="prelogin/css/AdminLTE.css" rel="stylesheet" type="text/css" />
	<link href="common/css/skin-blue-light.min.css" rel="stylesheet" type="text/css" />
</head>
<body class="skin-blue-light" data-target="#scrollspy">
开发者ID:rohit-kadam,项目名称:Demos,代码行数:31,代码来源:passwordreset.php

示例13: searchTextLayer

 public function searchTextLayer($term)
 {
     $text_hits = array();
     // Convert wildcards.
     $term = str_replace('<?>', '_', $term);
     $term = str_replace('<*>', '%', $term);
     // Temporary SQLite storage.
     $temp_db = $this->pdf_cache_path . DIRECTORY_SEPARATOR . $this->file_name . '.sq3';
     /**
      * Database text storage is created by extractXMLText(), when a PDF is open
      * first time. When a PDF is being extracted, the PDF filename is written
      * in a log. This code checks if a PDF is not being extracted at this
      * moment, and delays the execution so that it continues after the database
      * storage has been created.
      */
     if (!is_file($temp_db)) {
         // Is it being created?
         if ($this->checkPDFLog($this->file_name . '.sq3')) {
             // Wait up to 30 sec.
             for ($i = 1; $i <= 60; $i++) {
                 if ($this->checkPDFLog($this->file_name . '.sq3')) {
                     usleep(500000);
                 }
             }
         } else {
             // File might have been deleted. Re-create it.
             $this->extractXMLText();
         }
     }
     // At this point, the database must exist.
     if (!file_exists($temp_db)) {
         sendError('Text storage not found.');
     }
     // Fetch text from the database (8 PDF pages).
     $dbHandle = database_connect($this->pdf_cache_path, $this->file_name);
     $term_q = $dbHandle->quote('%' . $term . '%');
     $result = $dbHandle->query("SELECT top,left,height,width,text,page_number" . " FROM texts WHERE text LIKE {$term_q} ORDER BY page_number ASC");
     // Compile search results.
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         extract($row);
         $text_hits[] = array('p' => $page_number, 't' => $top, 'l' => $left, 'h' => $height, 'w' => $width, 'tx' => $text);
     }
     // If the result set is empty, check if there is any text at all.
     if (empty($text_hits)) {
         $result = $dbHandle->query("SELECT count(*) FROM texts");
         $count = $result->fetchColumn();
         if ($count == 0) {
             sendError('This PDF has no searchable text.');
         }
     }
     // If the result set is empty, the PDF has no text layer. It is allowed.
     return json_encode($text_hits);
 }
开发者ID:jamesscottbrown,项目名称:i-librarian,代码行数:53,代码来源:pdfclass.php

示例14: array

<?php

// Detect if there was XHR request
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $fields = array('row', 'column', 'text');
    $sqlFields = array('name', 'age', 'location');
    foreach ($fields as $field) {
        if (!isset($_POST[$field]) || strlen($_POST[$field]) <= 0) {
            sendError('No correct data');
            exit;
        }
    }
    $db = new mysqli('localhost', 'root', '', 'grid');
    $db->set_charset('utf8');
    if ($db->connect_errno) {
        sendError('Connect error');
        exit;
    }
    $userQuery = sprintf("UPDATE user SET %s='%s' WHERE user_id=%d", $sqlFields[intval($_POST['column'])], $db->real_escape_string($_POST['text']), $db->real_escape_string(intval($_POST['row'])));
    $stmt = $db->query($userQuery);
    if (!$stmt) {
        sendError('Update failed');
        exit;
    }
}
header('Location: index.php');
function sendError($message)
{
    header($_SERVER['SERVER_PROTOCOL'] . ' 320 ' . $message);
}
开发者ID:riston,项目名称:grid,代码行数:30,代码来源:user.php

示例15: phpversion

    } else {
        $strHeaders = "From: " . $strUsername . "<" . $strEmail . ">\n";
        $strHeaders .= "Reply-To: " . $strUsername . "<" . $strEmail . ">\n";
        $strHeaders .= "Cc: " . $strUsername . "<" . $strEmail . ">\n";
        $strHeaders .= "X-Sender: " . $strUsername . "<" . $strEmail . ">\n";
        $strHeaders .= "X-Mailer: PHP/" . phpversion();
        $strHeaders .= "X-Priority: 1\n";
        $strHeaders .= "Return-Path: " . $strEmail . "\n";
        $strHeaders .= "MIME-Version: 1.0\r\n";
        $strHeaders .= "Content-Type: text/html; charset=iso-8859-1\n";
        $strMessage = wordwrap($strMessage, 70);
        $blnSent = mail($strContactEmail, $strSubject, $strMessage, $strHeaders);
        if ($blnSent) {
            echo "<center><h2>Thank you for contacting us, you will receive an email from us within the next 48 hours</h2></center>";
        } else {
            sendError('Failed to send email');
        }
    }
} else {
    ?>
	
<center>
<form class="form" name="form" method="post" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
">
       <input type="text" name="username" maxlength="10" placeholder="Enter Your Username">
       <input type="text" name="email" maxlength="25" placeholder="Enter A Valid Email">
       <input type="text" name="subject" maxlength="20" placeholder="Enter Your Subject">
       <textarea  name="comments" maxlength="500" cols="25" rows="6" placeholder="Enter Your Message"></textarea>
       <!--edit the site key to match yours for the captcha -->
开发者ID:72juju,项目名称:Luna,代码行数:31,代码来源:contact.php


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