本文整理汇总了PHP中SendResponse函数的典型用法代码示例。如果您正苦于以下问题:PHP SendResponse函数的具体用法?PHP SendResponse怎么用?PHP SendResponse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SendResponse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendResponse
function SendResponse($QueryType, $index, $type = 'empty', $message = 'empty')
{
$con = mysqli_connect(HOST, USR, PSWD, DB);
if ($QueryType == 'add' || $QueryType == 'remove' || $QueryType == 'update') {
$query = AddParams($QueryType, $index);
$log;
$Ltype;
if (!mysqli_query($con, $query)) {
$log = 'esecuzione query(' . $query . ') fallita : ' . mysqli_error($con);
$Ltype = 'qerr';
} else {
$log = $query;
$Ltype = 'query';
}
//aggiorno i record visualizzati chiamando nuovamente la funzione con querytype = 1
$QueryType = 'load';
SendResponse($QueryType, $index, $Ltype, $log);
} else {
$query = AddParams($QueryType, $index);
$result = mysqli_query($con, $query);
$log;
$Ltype;
if ($result) {
if ($message == 'empty') {
$log = $query;
$Ltype = 'query';
} else {
$log = $message;
$Ltype = $type;
}
} else {
if ($message == 'empty') {
$log = 'esecuzione query (' . $query . ') fallita : ' . mysqli_error($con) . '</p>';
$Ltype = 'qerr';
} else {
$log = $message;
$Ltype = $type;
}
}
PrintResult($result, $log, $Ltype, $index);
}
mysqli_close($con);
}
示例2: Contributor
# This program is distributed under the terms and conditions of the GPL
# Contributor(s):
# A-thon srl <info@a-thon.it>
# Alberto Castellini
# See the LICENSE files for details
# ------------------------------------------------------------------------------------
require_once "./config/REP_configuration.php";
if ($repository_status == "O") {
$errorcode[] = "XDSRepositoryNotAvailable";
$error_message[] = "Repository is down for maintenance";
$status_response = makeSoapedFailureResponse($error_message, $errorcode);
writeTimeFile($_SESSION['idfile'] . "--Repository: Repository is down");
$file_input = $idfile . "-down_failure_response.xml";
writeTmpFiles($status_response, $file_input, true);
//SendResponseFile($tmp_path.$file_input);
SendResponse($status_response);
exit;
}
ob_start();
//Non stampa niente a monitor ma mette tutto su un buffer
$connessione = connectDB();
//ob_get_clean();//OKKIO FONDAMENTALE!!!!! Pulisco il buffer
//ob_end_flush();// Spedisco il contenuto del buffer
$token = $_GET["token"];
$get_token = "SELECT URI,MIMETYPE,CRYPT FROM DOCUMENTS WHERE KEY_PROG={$token}";
$res_token = query_select2($get_token, $connessione);
// Da verificare se si possono usare funzioni php al posto di java
if ($ATNA_active == 'A') {
$eventOutcomeIndicator = "0";
//EventOutcomeIndicator 0 OK 12 ERROR
$today = date("Y-m-d");
示例3: SendResponse
}
$stmt = $dbconnection->prepare('SELECT jams.status AS jamstatus, games.submitterid FROM jams INNER JOIN games ON jams.id = games.jamid WHERE jams.id = ? AND games.id = ?;');
$stmt->execute(array($jamid, $gameid));
if ($stmt->rowCount() == 0) {
SendResponse(array('success' => false, 'message' => 'Invalid jam or game specified.'));
} else {
$status = $stmt->fetchAll()[0];
if ($status['submitterid'] == $session->GetUserID()) {
SendResponse(array('success' => false, 'message' => 'You can not judge your own game.'));
} else {
if ($status['jamstatus'] == JamStatus::ReceivingGameSubmissions || $status['jamstatus'] == JamStatus::Judging) {
$stmt = $dbconnection->prepare('SELECT id FROM categories WHERE jamid = ?;');
$stmt->execute(array($jamid));
$categories = $stmt->fetchAll();
foreach ($categories as $category) {
$stmt = $dbconnection->prepare('DELETE FROM ratings WHERE categoryid = ? AND gameid = ? AND userid = ?;');
$stmt->execute(array($category['id'], $gameid, $session->GetUserID()));
foreach ($ratings as $rating) {
if ($rating['categoryid'] == $category['id']) {
$stmt = $dbconnection->prepare('INSERT INTO ratings (categoryid, gameid, userid, value) VALUES (?, ?, ?, ?);');
$stmt->execute(array($category['id'], $gameid, $session->GetUserID(), $rating['value']));
break;
}
}
}
SendResponse(array('success' => true));
} else {
SendResponse(array('success' => false, 'message' => 'Jam is no longer recieving ratings for the games.'));
}
}
}
示例4: connectDB
function connectDB()
{
# IMPORT MYSQL PARAMETERS (NOTE: IT WORKS WITH ABSOLUTE PATH ONLY !!)
include './config/repository_mysql_db.php';
# open connection to db
$connessione = mysql_connect($ip, $user_db, $password_db);
if (!$connessione) {
$errorcode = array();
$error_message = array();
$errorcode[] = "XDSRepositoryError";
$error_message[] = mysql_error();
$database_error_response = makeSoapedFailureResponse($error_message, $errorcode);
writeTimeFile($_SESSION['idfile'] . "--Repository: database_error_response");
$file_input = $_SESSION['idfile'] . "-database_error_response-" . $_SESSION['idfile'];
writeTmpFiles($database_error_response, $file_input);
SendResponse($database_error_response);
exit;
}
# open db
mysql_select_db($db_name);
return $connessione;
}
示例5: writeTmpFiles
function writeTmpFiles($log_text, $file_name, $mandatory = false)
{
### PATH COMPLETO AL FILE
if (!isset($_SESSION['tmp_path'])) {
$pathToFile = "./tmp/" . $file_name;
} else {
$pathToFile = $_SESSION['tmp_path'] . $file_name;
}
$writef = false;
$nfile = 0;
//Se il file è obbligatorio devo accertarmi che venga salvato
if ($mandatory) {
while (!$writef && $nfile < 10) {
### APERTURA DEL FILE IN FORMA TAIL ED IN SOLA SCRITTURA
$handler_log = fopen($pathToFile, "wb+");
if ($handler_log) {
## CASO DI DATO TIPO ARRAY
if (is_array($log_text)) {
$txt = "";
### IMPOSTA L'ARRAY NELLA FORMA [etichetta] = valore
foreach ($log_text as $element => $value) {
$txt = $txt . "{$element} = {$value}\n";
}
//END OF foreach
$log_text = $txt;
}
//END OF if(is_array($log_text))
if (fwrite($handler_log, $log_text) === FALSE) {
sleep(1);
$nfile++;
} else {
// Caso OK Riesce a aprire e scrivere il file correttamente
$writef = true;
}
} else {
sleep(1);
$nfile++;
}
}
//Fine while
#### CHIUDO L'HANDLER
fclose($handler_log);
if (!$writef) {
$errorcode[] = "XDSRepositoryError";
$error_message[] = "Repository can't create tmp file. ";
$tmp_response = makeSoapedFailureResponse($error_message, $errorcode);
writeTimeFile($_SESSION['idfile'] . "--Repository: Tmp File error");
$file_input = $idfile . "-tmp_failure_response-" . $idfile;
writeTmpFiles($tmp_response, $file_input);
SendResponse($tmp_response);
exit;
}
} else {
$handler_log = fopen($pathToFile, "wb+");
## CASO DI DATO TIPO ARRAY
if (is_array($log_text)) {
$txt = "";
### IMPOSTA L'ARRAY NELLA FORMA [etichetta] = valore
foreach ($log_text as $element => $value) {
$txt = $txt . "{$element} = {$value}\n";
}
//END OF foreach
$log_text = $txt;
}
//END OF if(is_array($log_text))
fwrite($handler_log, $log_text);
fclose($handler_log);
}
#### RITORNO IL PATH AL FILE SCRITTO
return $pathToFile;
}
示例6: giveboundary
function giveboundary($headers)
{
if (stripos($headers["Content-Type"], "boundary")) {
writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary e' presente");
if (preg_match('(boundary="[^\\t\\n\\r\\f\\v";]+")', $headers["Content-Type"])) {
writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=\"bvdwetrct637crtv\"");
$content_type = stristr($headers["Content-Type"], 'boundary');
$pre_boundary = substr($content_type, strpos($content_type, '"') + 1);
$fine_boundary = strpos($pre_boundary, '"') + 1;
//BOUNDARY ESATTO
$boundary = '';
$boundary = substr($pre_boundary, 0, $fine_boundary - 1);
writeTimeFile($idfile . "--Repository: Il boundary " . $boundary);
} else {
if (preg_match('(boundary=[^\\t\\n\\r\\f\\v";]+[;])', $headers["Content-Type"])) {
writeTimeFile($_SESSION['idfile'] . "--Repository: Ho trovato il boundary di tipo boundary=bvdwetrct637crtv;");
$content_type = stristr($headers["Content-Type"], 'boundary');
$pre_boundary = substr($content_type, strpos($content_type, '=') + 1);
$fine_boundary = strpos($pre_boundary, ';');
//BOUNDARY ESATTO
$boundary = '';
$boundary = substr($pre_boundary, 0, $fine_boundary);
writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary " . $boundary);
} else {
$errorcode[] = "XDSRepositoryError";
$error_message[] = "Repository can't recognize boundary. ";
$folder_response = makeSoapedFailureResponse($error_message, $errorcode);
writeTimeFile($_SESSION['idfile'] . "--Repository: Il boundary non e' del tipo boundary=\"bvdwetrct637crtv\" o boundary=bvdwetrct637crtv;");
$file_input = $idfile . "-boundary_failure_response-" . $idfile;
writeTmpFiles($folder_response, $file_input);
SendResponse($folder_response);
exit;
}
}
$MTOM = false;
} else {
writeTimeFile($_SESSION['idfile'] . "--Repository: non e' dichiarato il boundary");
$MTOM = true;
//$boundary = "--boundary_per_MTOM";
}
$ret = array($boundary, $MTOM);
return $ret;
}
示例7: games
} else {
$jam = $stmt->fetchAll()[0];
if ($jam['status'] == JamStatus::JamRunning || $jam['status'] == JamStatus::ReceivingGameSubmissions) {
$stmt = $dbconnection->prepare('SELECT id from games WHERE jamid = ? AND submitterid = ?;');
$stmt->execute(array($jamid, $session->GetUserID()));
if ($stmt->rowCount() > 0) {
$gameid = $stmt->fetchAll()[0]['id'];
$stmt = $dbconnection->prepare('UPDATE games SET name = ?, description = ?, partner = ?, thumbnailurl = ? WHERE id = ? AND jamid = ? AND submitterid = ?;');
$stmt->execute(array($name, $description, $partner, $thumbnail, $gameid, $jamid, $session->GetUserID()));
$stmt = $dbconnection->prepare('DELETE FROM images WHERE gameid = ?;');
$stmt->execute(array($gameid));
$stmt = $dbconnection->prepare('DELETE FROM links WHERE gameid = ?;');
$stmt->execute(array($gameid));
} else {
$stmt = $dbconnection->prepare('INSERT INTO games (name, description, submitterid, partner, thumbnailurl, jamid) VALUES (?, ?, ?, ?, ?, ?);');
$stmt->execute(array($name, $description, $session->GetUserID(), $partner, $thumbnail, $jamid));
$gameid = $dbconnection->lastInsertId('games_id_seq');
}
$stmt = $dbconnection->prepare('INSERT INTO images (url, gameid) VALUES (?, ?);');
foreach ($images as $image) {
$stmt->execute(array($image['url'], $gameid));
}
$stmt = $dbconnection->prepare('INSERT INTO links (title, url, gameid) VALUES (?, ?, ?);');
foreach ($links as $link) {
$stmt->execute(array($link['title'], $link['url'], $gameid));
}
SendResponse(array('success' => true));
} else {
SendResponse(array('success' => false, 'message' => 'Jam is no longer recieving game submissions.'));
}
}
示例8: votes
if ($existingid != -1 && $found) {
$stmt = $dbconnection->prepare('UPDATE votes SET value = ? WHERE id = ?;');
$stmt->execute(array($votevalue, $existingid));
} else {
if ($existingvotecount < $jam['votesperuser'] && $found) {
$stmt = $dbconnection->prepare('INSERT INTO votes (voterid, themeid, round, value, jamid) VALUES (?, ?, ?, ?, ?);');
$stmt->execute(array($session->GetUserID(), $vote['themeid'], $round, $votevalue, $jamid));
$existingvotecount++;
} else {
$failed = true;
}
}
}
}
if (!$failed) {
SendResponse(array('success' => true));
} else {
SendResponse(array('success' => false, 'message' => 'You have already submitted the maximum number of votes.'));
}
} else {
SendResponse(array('success' => false, 'message' => 'Jam is no longer recieving votes.'));
}
}
function CompareVotes($A, $B)
{
if ($A['value'] == $B['value']) {
return 0;
} else {
return abs($A['value']) < abs($B['value']) ? -1 : 1;
}
}
示例9: SendResponse
<?php
if (strlen($username) > 20) {
$error = 'Username max length is 20 characters.';
} else {
if (strlen($username) == 0) {
$error = 'Username can not be blank.';
} else {
if (strlen($password) == 0) {
$error = 'Password can not be blank.';
} else {
if (strlen($email) == 0) {
$error = 'Email can not be blank.';
} else {
if (!EmailValid($email)) {
$error = 'Email address is invalid.';
}
}
}
}
}
if (isset($error)) {
SendResponse(array('success' => false, 'message' => $error));
} else {
if ($session->TryRegister($username, $password, $email)) {
SendResponse(array('success' => true));
} else {
SendResponse(array('success' => false, 'message' => 'Username or Email is already in use.'));
}
}
示例10: decrypt
if ($res_DocUniqueId[0][3] == "A") {
$file[$i] = decrypt($keycrypt, file_get_contents("./" . $res_DocUniqueId[0][1], "r"));
} else {
$file[$i] = file_get_contents("./" . $res_DocUniqueId[0][1], "r");
}
$documento_encoded64[$i] = base64_encode($file[$i]);
writeTimeFile($idfile . "--Repository Retrieve: File {$i}: " . $file[$i]);
} else {
writeTimeFile($idfile . "--GetDocument Retrieve: il repository UniqueId non corrisponde " . $res_repUniqueId[0][0] . " diverso da " . $DocumentRequests_array[$i][0]);
//Devo gestire un errore
$errorcode[] = "XDSRepositoryMetadataError";
$error_message[] = "Repository.uniqueID '" . $res_repUniqueId[0][0] . "' is different form your submission '" . $DocumentRequests_array[$i][0] . "'";
$repositoryUniqueId_response = makeSoapedFailureResponse($error_message, $errorcode, $Action);
$file_input = $_SESSION['idfile'] . "-repositoryUniqueId_failure_response-" . $_SESSION['idfile'];
writeTmpRetrieveFiles($repositoryUniqueId_response, $file_input);
SendResponse($repositoryUniqueId_response);
}
}
$boundary = md5(time());
$Content_ID = md5(time() + 1);
$messageID = md5(time() + 2);
$idDoc = array();
$SOAP_stringaxml = "<?xml version='1.0' encoding='UTF-8'?>" . CRLF . "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\"\n xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n <soapenv:Header>\n <wsa:Action>urn:ihe:iti:2007:RetrieveDocumentSetResponse</wsa:Action>\n <wsa:RelatesTo>{$MessageID}</wsa:RelatesTo>\n </soapenv:Header>";
$SOAP_stringaxml .= "\n <soapenv:Body>\n <xdsb:RetrieveDocumentSetResponse xmlns:xdsb=\"urn:ihe:iti:xds-b:2007\">\n <rs:RegistryResponse xmlns:rs=\"urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0\"\n status=\"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success\"/>";
for ($y = 0; $y < $numero_documenti; $y++) {
$idDoc[$y] = md5(time() + 3 + $y);
$SOAP_stringaxml .= "\n <xdsb:DocumentResponse>\n\t\t<xdsb:RepositoryUniqueId>" . $DocumentRequests_array[$y][0] . "</xdsb:RepositoryUniqueId>\n <xdsb:DocumentUniqueId>" . $DocumentRequests_array[$y][1] . "</xdsb:DocumentUniqueId>\n <xdsb:mimeType>" . $res_DocUniqueId[$y][2] . "</xdsb:mimeType>\n\t\t<xdsb:Document>" . $documento_encoded64[$y] . "</xdsb:Document>\n </xdsb:DocumentResponse>";
}
$SOAP_stringaxml .= "\n </xdsb:RetrieveDocumentSetResponse>\n </soapenv:Body>\n</soapenv:Envelope>" . CRLF;
$fp_forwarded = fopen($tmp_retrieve_path . $idfile . "-repositoryGet_response.xml", "wb+");
fwrite($fp_forwarded, $SOAP_stringaxml);
示例11: header
$sessionID = $_POST['sessionId'];
$isCallActive = $_POST['isActive'];
if ($isCallActive == 1 && $direction == "Inbound") {
//hang up
//construct response
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Reject/>';
$response .= '</Response>';
header('Content-type: text/plain');
echo $response;
//immediately call user back
$gateway = new AfricasTalkingGateway($aitusername, $aitkey);
try {
$gateway->call($aitnumber, $callerNumber);
} catch (Exception $e) {
echo "error: " . $e->getMessage();
}
} elseif ($isCallActive == 1 && $direction == "Outbound") {
//redirect call to be processed on other page
$url = "https://santa-slybard.c9users.io/wishlist.php";
//construct response
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Redirect>' . $url . '</Redirect>';
$response .= '</Response>';
header('Content-type: text/plain');
echo $response;
} else {
SendResponse(false, "Goodbye!");
}
示例12: GetCallState
$redis = new Predis\Client();
$callstate = GetCallState($redis, $sessionID, $caller);
if ($isCallActive == 1 && $direction == "Outbound") {
if ($callstate == "Intro") {
$str = "Welcome to the North Pole. I am Elfie. Press 1 followed by the hash sign to continue";
$callstate = "Reception";
SetCallState($redis, $sessionID, $caller, $callstate);
SendResponse(true, $str);
} elseif ($callstate == "Reception") {
$userinput = $_POST['dtmfDigits'];
if ($userinput == "1") {
$str = "Okay. What would you like for Christmas. Press 1 followed by hash if you want a cup for Christmas. Press 2 followed by hash if you want a girlfriend for Christmas";
$callstate = "Options";
SetCallState($redis, $sessionID, $caller, $callstate);
SendResponse(true, $str);
}
} elseif ($callstate == "Options") {
$userinput = $_POST['dtmfDigits'];
$callstate = "End";
if ($userinput == "1" || $userinput == "2") {
$str = "That is a good choice. We've sent the Northern Express to deliver. Merry Christmas";
}
SetCallState($redis, $sessionID, $caller, $callstate);
SendResponse(false, $str);
}
} else {
SendResponse(false);
}
} catch (Exception $e) {
echo $e->getMessage();
}
示例13:
<?php
$error = "";
$style = '';
if (isset($_POST['submit'])) {
if ($_POST['ten'] != "") {
if ($_POST['email'] != "") {
if ($_POST['tieude'] != "") {
if ($_POST['noidung'] != "") {
if (SendResponse($_POST['email'], $_POST['tieude'], $_POST['ten'], $_POST['noidung'])) {
$error = "Đã gởi mail thành công";
$style = 'style="color:green;"';
} else {
$error = "Gởi mail không thành công! ";
}
} else {
$error = "bạn chưa nhập nội dung";
}
} else {
$error = "Bạn chưa nhập tiêu đề";
}
} else {
$error = "Bạn chưa nhập mail";
}
} else {
$error = "Bạn chưa nhập tên";
}
}
$ten = "";
$email = "";
if (isset($_SESSION['taikhoan'])) {
示例14: array
<?php
require SCRIPTROOT . 'jamstates.php';
$stmt = $dbconnection->prepare('SELECT * FROM jams ORDER BY suggestionsbegin DESC;');
$stmt->execute();
$rows = $stmt->fetchAll();
$jams = array();
foreach ($rows as $row) {
$jam = array();
$jam['id'] = $row['id'];
$jam['title'] = $row['title'];
$jam['status'] = $row['status'];
$jam['suggestionsbegin'] = SuggestionsBegin($row);
$jam['votingbegins'] = VotingBegins($row);
$jam['themeannounce'] = ThemeAnnounce($row);
$jam['jambegins'] = JamBegins($row);
$jam['submissionsbegin'] = SubmissionsBegin($row);
$jam['submissionsend'] = SubmissionsEnd($row);
$jam['judgingends'] = JudgingEnds($row);
array_push($jams, $jam);
}
SendResponse($jams);
示例15: SendResponse
* Of course, we check to make sure it's a valid requestmethod before trying to call it.
*/
default:
if (!is_callable(array($handlerObject, $handlerMethod)) and !is_callable("{$handlerObject}::{$handlerMethod}")) {
SendResponse(true, 'Invalid request type');
}
$response = false;
$handlerMethodReflector = new ReflectionMethod($handlerObject, $handlerMethod);
$handlerMethodParameterReflector = $handlerMethodReflector->getParameters();
$newFunctionParams = false;
$newFunctionParams = false;
foreach ($handlerMethodParameterReflector as &$handlerMethodParam) {
$response[] = $handlerMethodParam->getName();
if (array_key_exists($handlerMethodParam->getName(), $function_params)) {
//leave it
$newFunctionParams[] = $function_params[$handlerMethodParam->getName()];
} else {
//add a null
$newFunctionParams[] = '';
}
}
if (is_object($handlerObject)) {
$response = $handlerMethodReflector->invokeArgs($handlerObject, $newFunctionParams);
} else {
$response = $handlerMethodReflector->invokeArgs(null, $newFunctionParams);
}
SendResponse(true, $response);
break;
}