本文整理汇总了PHP中mydie函数的典型用法代码示例。如果您正苦于以下问题:PHP mydie函数的具体用法?PHP mydie怎么用?PHP mydie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mydie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPublicGames
public function getPublicGames()
{
$sql = goPublicGame::getSql();
$link = @mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
mydie("Error connecting to Database");
}
if (Config::getDebug()) {
$this->LOG->log("{$sql}", PEAR_LOG_INFO);
}
$cursor = @mysqli_query($link, $sql);
if (!$cursor) {
$this->mydie(mysqli_error($link), $link);
}
$record = 0;
while ($row = @mysqli_fetch_assoc($cursor)) {
$game = new goPublicgame();
//$game->setGameID($row['gameID']);
$game->setDescription($row['description']);
$game->setTitle($row['title']);
$game->setEventName($row['eventName']);
$game->setEventDate($row['eventDate']);
$game->setSportID($row['sport']);
$game->setSportName($row['sportName']);
$game->setLeagueName($row['leagueName']);
$game->setFavorite($row['favorite']);
$game->setTypeID($row['type']);
$game->setTypeName($row['typeName']);
/*** temp explicit treatment as array storage***/
$this->publicGames[$record] = $game;
$record++;
/*** end temp ***/
}
//while
$link->close();
}
示例2: getGame
public function getGame($gameID, $type = 'game')
{
$link = @mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
mydie("Error connecting to Database");
}
//added JHM 8/19/2010
$sql = $this->getQuery($gameID, $type, $link);
if (Config::getDebug()) {
$this->LOG->log("{$sql}", PEAR_LOG_INFO);
}
$cursor = @mysqli_query($link, $sql);
if (!$cursor) {
$this->mydie(mysqli_error($link), $link);
}
$row = @mysqli_fetch_assoc($cursor);
if (Config::getDebug()) {
$this->LOG->log("{$row}", PEAR_LOG_DEBUG);
}
if (!row) {
return false;
}
$this->setGameID($row['gameID']);
$this->setPublicGameID($row['publicGameID']);
$this->setDescription($row['description']);
$this->setCreatedByUserID($row['createdByUserID']);
$this->setCreatedByUserName($row['createdByUserName']);
$this->setTitle($row['title']);
$this->setSportID($row['sport']);
$this->setSportName($row['sportName']);
$this->setTypeID($row['type']);
$this->setTypeName($row['typeName']);
$this->setWagerUnits($row['wagerUnits']);
$this->setWagerTypeID($row['wagerTypeID']);
$this->setWagerType($row['wagerType']);
$this->setSubscriptionCloseDate($row['subscriptionClose']);
$this->setSubscriptionOpen($row['subscriptionOpen']);
$this->setSyndicationUrl($row['syndicationUrl']);
$this->setPivotDate($row['pivotDate']);
$this->setPivotCondition($row['pivotCondition']);
/*Add JHM - public Games */
$this->setHomeTeamID($row['team1ID']);
$this->setVisitingTeamID($row['team2ID']);
$this->setHomeTeam($row['teamName1']);
$this->setVisitingTeam($row['teamName2']);
/*Finish add */
}
示例3: get_google
public function get_google()
{
$this->check_agent();
$this->check_input();
$scopes = "openid profile email";
$prompt = $this->_getParam('prompt') ?: 'none';
$config = Bootstrap::$main->getConfig();
$uri = $config['protocol'] . '://' . $_SERVER['HTTP_HOST'] . Bootstrap::$main->getRoot() . 'user/google';
$realm = $config['protocol'] . '://' . $_SERVER['HTTP_HOST'] . Bootstrap::$main->getRoot() . 'user/google';
if ($this->_getParam('redirect')) {
Bootstrap::$main->session('auth_redirect', $this->_getParam('redirect'));
} elseif (!Bootstrap::$main->session('auth_redirect')) {
mydie('redirect parameter missing', 'error');
}
if (isset($_GET['state']) && $_GET['state'] == Bootstrap::$main->session('oauth2_state')) {
if (isset($_GET['code'])) {
$data = array('code' => $_GET['code'], 'client_id' => $config['oauth2.client_id'], 'client_secret' => $config['oauth2.client_secret'], 'redirect_uri' => $uri, 'grant_type' => 'authorization_code');
$response = $this->req("https://accounts.google.com/o/oauth2/token", $data);
$token = json_decode($response, true);
if (isset($token['access_token'])) {
$auth = json_decode(file_get_contents('https://www.googleapis.com/oauth2/v1/userinfo?access_token=' . $token['access_token']), true);
if (isset($auth['given_name'])) {
$auth['first_name'] = $auth['given_name'];
}
if (isset($auth['family_name'])) {
$auth['last_name'] = $auth['family_name'];
}
if (isset($auth['id']) && isset($auth['email'])) {
$email = $this->standarize_email($auth['email'], false);
$user = $this->user()->find_one_by_email($email);
if (!$user) {
$user = $this->add(array('firstname' => $auth['first_name'], 'lastname' => $auth['last_name'], 'md5hash' => $this->md5hash($email), 'email' => $email, 'ref_login' => 'gplus'), false);
}
$model = new userModel($user['id']);
if (!$model->firstname) {
$model->firstname = $auth['first_name'];
}
if (!$model->lastname) {
$model->lastname = $auth['last_name'];
}
if (isset($auth['picture'])) {
if (!$model->photo || strstr($model->photo, 'googleusercontent')) {
$model->photo = $auth['picture'];
}
}
if (isset($auth['link'])) {
if (!$model->social || strstr($model->social, 'plus.google.com')) {
$model->social = $auth['link'];
}
}
if (isset($auth['gender'])) {
$model->gender = strtoupper(substr($auth['gender'], 0, 1));
}
if (!$model->cover && isset($auth['link'])) {
$person = @end(explode('/', $auth['link']));
$url = "https://www.googleapis.com/plus/v1/people/" . urlencode($person) . "?fields=cover%2FcoverPhoto%2Furl&access_token=" . $token['access_token'];
$cover = json_decode(file_get_contents($url), true);
if (isset($cover['cover']['coverPhoto']['url'])) {
$model->cover = preg_replace('/s[0-9]+-fcrop/', 's' . $config['image_size'] . '-fcrop', $cover['cover']['coverPhoto']['url']);
}
}
$this->beautify($model);
$model->save();
$data = $model->data();
unset($data['password']);
Bootstrap::$main->session('user', $data);
Bootstrap::$main->session('auth', $auth);
if ($model->lang) {
Bootstrap::$main->session('lang', $model->lang);
}
$this->redirect(Bootstrap::$main->session('auth_redirect'));
} else {
if (isset($auth['error'])) {
Bootstrap::$main->session('error', $auth['error']['message']);
}
$this->redirect(Bootstrap::$main->session('auth_redirect'));
}
} else {
$this->redirect(Bootstrap::$main->session('auth_redirect'));
}
} elseif (isset($_GET['error']) && $_GET['error'] == 'immediate_failed') {
$this->redirect($uri . '?prompt=select_account');
} else {
$this->redirect(Bootstrap::$main->session('auth_redirect'));
}
} elseif (isset($_GET['state'])) {
$this->redirect($uri);
} else {
$state = md5(rand(90000, 1000000) . time());
Bootstrap::$main->session('oauth2_state', $state);
$url = 'https://accounts.google.com/o/oauth2/auth?client_id=' . urlencode($config['oauth2.client_id']);
$url .= '&response_type=code';
$url .= '&scope=' . urlencode($scopes);
$url .= '&redirect_uri=' . urlencode($uri);
$url .= '&openid.realm=' . urlencode($realm);
$url .= '&state=' . $state;
$url .= '&prompt=' . $prompt;
//$url.='&access_type=offline';
//mydie("<a href='$url'>$url</a>");
$this->redirect($url);
//.........这里部分代码省略.........
示例4: mysqli_error
echo mysqli_error($link) . " Using Sql = {$sql}\n";
$LOG->log(mysqli_error($link) . " Using Sql = {$sql}\n");
}
//else
}
//if
//insert home team
$sql = sprintf("insert into go_publicgames_combatants (gameID,teamID,homeTeam) values ('%u','%u','%u')", $gameID, $homeTeamID, 1);
if (Config::getDebug()) {
$LOG->log($sql, PEAR_DEBUG);
}
$rc = mysqli_query($link, $sql);
if (!$rc) {
// Server error
if (!ERROR_TOLERANCE) {
mydie(mysqli_error($link) . " Using Sql - {$sql}\n");
} else {
echo mysqli_error($link) . " Using Sql = {$sql}\n";
$LOG->log(mysqli_error($link) . " Using Sql = {$sql}\n");
}
//else
}
//if
}
//while
//close
fclose($fileHandle);
//close input file
$link->close();
//close database
exit;
示例5: mysqli_connect
//if
$link = mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
// Server error
header('HTTP/1.1 500 Internal Server Error');
mydie("Error connecting to Database");
}
$sql = getQuery($link, $userID);
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$cursor = mysqli_query($link, $sql);
if (!$cursor) {
// Server error
header('HTTP/1.1 500 Internal Server Error');
mydie(mysqli_error($link), 500, $link);
}
header('HTTP/1.1 200 OK');
header("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
/* Fetch the results of the query */
Utility::emitXML("", 'game_invites', 0);
Utility::emitXML('200', 'status_code');
Utility::emitXML('Ok', 'status_message');
Utility::emitXML("{$userID}", 'userID');
Utility::emitXML("{$userName}", 'username');
Utility::emitXML($cursor->num_rows, 'openinvites');
$recordsEmitted = 0;
while ($row = mysqli_fetch_assoc($cursor)) {
$recordsEmitted++;
Utility::emitXML("", 'gameinvite', 0);
示例6: get_offer
public function get_offer()
{
$config = $this->getConfig();
$offer = $this->merlin->getOfferOnToken($this->id);
$offer['stars'] = '';
if (isset($offer['obj']['category'])) {
for ($i = 0; $i < $offer['obj']['category']; $i += 10) {
$offer['stars'] .= Bootstrap::$main->getConfig('star');
}
}
if (isset($offer['obj']['info']['desc'])) {
$desc = $offer['obj']['info']['desc'];
$desc2 = [];
foreach ($desc as $d) {
if (is_array($d['subject'])) {
continue;
}
if (is_array($d['content'])) {
continue;
}
if (!in_array(strtolower(trim($d['subject'])), ['category', 'kategoria', 'region', 'kraj', 'kategoria lokalna'])) {
$pm = [];
if (preg_match_all('~<b>([^<]+)</b>([^<]+)~i', $d['content'], $pm)) {
for ($i = 0; $i < count($pm[1]); $i++) {
$desc2[] = ['subject' => str_replace(':', '', $pm[1][$i]), 'content' => trim($pm[2][$i])];
}
} else {
$desc2[] = $d;
}
}
}
$offer['obj']['info']['desc'] = $desc2;
$offer['dep_from'] = $config['dep_from'][$offer['trp']['depCode']];
$offer['adt'] = Bootstrap::$main->session('adt');
$offer['chd'] = Bootstrap::$main->session('chd');
//mydie($offer['obj']['info']);
}
if ($this->data('debug')) {
$ret = [$offer];
if ($this->data('debug') == 2) {
$ret[1] = $this->merlin->debug;
}
mydie($ret);
}
return $this->status($offer);
}
示例7: closedir
$nextnumber = $tmp;
}
}
}
closedir($dh);
$fnprefix = sprintf("PMI%08.0f.", $nextnumber);
$initialname = $fnprefix . "creating";
$finalname = $fnprefix . "DEM";
$initialpath = "{$EXPORT_PATH}/{$initialname}";
$finalpath = "{$EXPORT_PATH}/{$finalname}";
// Write the file locally with a temporary version of the name.
@touch($initialpath);
// work around possible php bug
$fh = @fopen($initialpath, "w");
if (!$fh) {
mydie("Unable to open {$initialpath} for writing");
}
fwrite($fh, $out);
fclose($fh);
// Rename the local file.
rename($initialpath, $finalpath);
// Delete old stuff to avoid uncontrolled growth.
if ($nextnumber > 5) {
@unlink("{$EXPORT_PATH}/PMI%08.0f.DEM", $nextnumber - 5);
}
// End of serialized code.
rename("{$EXPORT_PATH}/locked", "{$EXPORT_PATH}/unlocked");
// If we have an ftp server, send it there and then rename it.
if ($FTP_SERVER) {
$ftpconn = ftp_connect($FTP_SERVER) or die("FTP connection failed");
ftp_login($ftpconn, $FTP_USER, $FTP_PASS) or die("FTP login failed");
示例8: array_shift
$LOG = Config::getLogObject();
$programName = array_shift($argv);
/*i//if (count($argv) != 4) {
mydie("Usage: $programName inputFile, , sportID, sportName, LeagueName\n");
}
*/
$recordsProcessed = 0;
$link = @mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
mydie("Error connecting to Database \n" . "Error No:" . mysqli_connect_errno() . "\n Error = " . mysqli_connect_error() . "\n using database server = " . Config::getDatabaseServer() . "\n Database User = " . Config::getDatabaseUser() . "\n Database Password = " . Config::getDatabasePassword() . "\n Database = " . Config::getDatabase() . "\n");
}
$sql = "select * from go_teams_lu where stadiumAddress is not null and stadiumCity is not null";
$cursor = mysqli_query($link, $sql);
if (!$cursor) {
// Server error
mydie(mysqli_error($link) . " executing sql {$sql}");
}
//if
$apiUrl = "http://maps.google.com/maps/api/geocode/xml?address=";
while ($row = mysqli_fetch_assoc($cursor)) {
$teamID = $row['id'];
$address = $row['stadiumName'] . " " . $row['stadiumAddress'] . " " . $row['stadiumCity'] . " " . $row['stadiumState'];
$address = urlencode(htmlentities($address));
$url = $apiUrl . $address . "&sensor=false";
//echo $url . "\n";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
curl_close($curl);
$document = simplexml_load_string($result);
if (!$document) {
示例9: LinePlot
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->SetColor("black");
// Create the data plot
$plot = new LinePlot($data['values']);
$color = $options['graph_color'];
$plot->SetColor($color);
$plot->SetWeight(2);
$plot->mark->SetType(MARK_FILLEDCIRCLE);
$plot->mark->SetColor('blue');
if (!empty($options['graph_point_legend'])) {
$plot->SetLegend($options['graph_point_legend']);
}
if (!empty($options['graph_show_values'])) {
if (!isset($plot->value) || !method_exists($plot->value, 'show')) {
mydie("This JPGraph version does not support 'Show values'");
}
$plot->value->HideZero();
$plot->value->SetFormat('%u');
$plot->value->SetFont(FF_FONT1, FS_BOLD);
$plot->value->SetColor('blue');
$plot->value->SetMargin(10);
$plot->value->Show();
}
// Add the data plot to the graph
$graph->Add($plot);
} elseif ($options['graph_type'] == 'radar') {
require_once "{$jpgraph}/jpgraph_radar.php";
$background = "white";
$incref = false;
// Setup graph
示例10: array
//Filtering
$params = array();
$params['userid'] = $_GET['userid'];
//open connect to database
$link = mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
header('HTTP/1.1 500 Internal Server Error');
mydie("Error connecting to Database");
}
$sql = getQuery($params);
$LOG->log($sql, PEAR_DEBUG);
$cursor = mysqli_query($link, $sql);
if (!$cursor) {
// Server error
header('HTTP/1.1 500 Internal Server Error');
mydie(mysqli_error($link) . " executing {$sql}", $link);
}
header("content-type: text/xml");
echo '<?xml version="1.0"?>';
Utility::emitXML("", 'userdashboard', 0);
Utility::emitXML("200", 'statuscode');
Utility::emitXML("OK", 'statusmessage');
$recordsEmitted = 0;
$totalBets = 0;
$totalBets = 0;
$totalBetsInitiated = 0;
$totalBetsAccepted = 0;
$totalWins = 0;
$totalLoses = 0;
// while records to read/ retrieve and emit xml
if ($row = mysqli_fetch_assoc($cursor)) {
示例11: getUserIDOrName
public static function getUserIDOrName($param, $type = 'id')
{
$LOG = Config::getLogObject();
$link = mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
// Server error
mydie("Error connecting to Database");
}
if ($type == 'id') {
$sql = sprintf("select * from go_user where userID='%u'", mysqli_real_escape_string($link, $param));
} else {
$sql = sprintf("select * from go_user where userName='%s'", mysqli_real_escape_string($link, $param));
}
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$cursor = mysqli_query($link, $sql);
if (!$cursor) {
// Server error
mydie(mysqli_error($link), 500, $link);
}
//if
$row = mysqli_fetch_assoc($cursor);
if (isset($cursor)) {
$cursor->close();
}
if (isset($link)) {
$link->close();
}
return $type == 'id' ? $row['userName'] : $row['userID'];
}
示例12: header
if (!$row) {
// Server error
header('HTTP/1.1 500 Internal Server Error');
mydie("GameID {$gameID} does not exist");
}
$subscriptionClose = $row['subscriptionClose'];
//is a mysql timestamp
$sql = sprintf("insert into go_gamesSubscribers (gameID,userID,wagerUnits) values ('%u','%u','%u')", mysqli_real_escape_string($link, $gameID), mysqli_real_escape_string($link, $userID), mysqli_real_escape_string($link, $wagerUnits));
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$rc = mysqli_query($link, $sql);
if (!$rc) {
// Server error
header('HTTP/1.1 500 Internal Server Error');
mydie(mysqli_error($link));
}
header('HTTP/1.1 200 OK');
$link->close();
/* Close Database */
//return xml
Utility::emitXML("", "insert_game_subscriber", 0);
Utility::emitXML("200", "status_code");
Utility::emitXML("ok", "status_message");
Utility::emitXML("{$gameID}", "gameid");
Utility::emitXML("{$userID}", "userid");
Utility::emitXML("{$numberOfSubscribers}", "numberofsubscribers");
Utility::emitXML("", "insert_game_subscriber", 0);
ob_end_flush();
exit;
function mydie($message, $statusCode = 500)
示例13: mydie
<?php
require "header.inc.php";
if (isset($_POST['submitButton'])) {
if (!isset($_POST['username']) || empty($_POST['username'])) {
mydie("Error: The username field was not set <br>");
}
if (!isset($_POST['password']) || empty($_POST['password'])) {
mydie("Error: The password field was not set <br>");
}
$username = $_POST['username'];
$password = $_POST['password'];
$hash = hash("sha512", $password);
$query = mysql_query("SELECT id FROM users WHERE email = '" . mysql_real_escape_string($username) . "' AND password = '" . mysql_real_escape_string($hash) . "'");
if (mysql_num_rows($query)) {
$sessID = mysql_real_escape_string(session_id());
$hashsession = mysql_real_escape_string(hash("sha512", $sessID . $_SERVER['HTTP_USER_AGENT']));
$expires = time() + 60 * 3;
$userdata = mysql_fetch_assoc($query);
$userdataid = $userdata['id'];
$insert = "INSERT INTO active_users (id, user, session_id, hash, expires) \n\t\t\tVALUES(\n\t\t\t''\n\t\t\t,{$userdataid}\n\t\t\t,'{$sessID}'\n\t\t\t,'{$hashsession}'\n\t\t\t,{$expires})";
mysql_query($insert) or die("Active User SQL Insert failed");
Header("Location: ./home.php");
} else {
mydie("Error: Incorrect password or email address");
}
}
function mydie($msg)
{
die($msg);
}
示例14: insertGameInvites
function insertGameInvites($link, $gameID, $inviteKey, $closeDateTime, $createdByUserID, $createdByUserName, $gameInvitees)
{
global $LOG;
$sql = sprintf("insert into go_gameInvite (gameID,inviteKey) values ('%s','%s')", mysqli_real_escape_string($link, $gameID), mysqli_real_escape_string($link, $inviteKey));
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$rc = mysqli_query($link, $sql);
if (!$rc) {
// Server error
header('HTTP/1.1 500 Internal Server Error');
mydie(mysqli_error($link), 500, $link);
}
//if
//TODO - Remove temporary automatic insert into invite Detail
$gameInviteesArray = explode(" ", trim($gameInvitees));
$count = count($gameInviteesArray);
for ($x = 0; $x < $count; $x++) {
$inviteeUserID = $gameInviteesArray[$x];
$sql = sprintf("insert into go_gameInviteDetail (gameID, inviteKey, createdByUserID,createdByUserName, closeDateTime,inviteeUserID) values ('%s','%s','%u','%s','%s','%u')", mysqli_real_escape_string($link, $gameID), mysqli_real_escape_string($link, $inviteKey), mysqli_real_escape_string($link, $createdByUserID), mysqli_real_escape_string($link, $createdByUserName), mysqli_real_escape_string($link, $closeDateTime), mysqli_real_escape_string($link, $inviteeUserID));
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$rc = mysqli_query($link, $sql);
}
//for
}
示例15: userNameAvailable
function userNameAvailable($userName, $link)
{
global $LOG;
$userName = strtolower($userName);
// $sql = sprintf("select count(*) as countOfUserName from go_user where userName = '%s'",
// mysqli_real_escape_string($link,$userName));
$sql = sprintf("select userName from go_user where userName = '%s'", mysqli_real_escape_string($link, $userName));
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$cursor = mysqli_query($link, $sql);
if (!$cursor) {
// Server error
mydie(mysqli_error($link) . " executing sql {$sql}");
}
//if
$countOfUserName = $cursor->num_rows;
// if ($row = @mysqli_fetch_assoc($cursor) == null) mydie(mysqli_error($link) . " executing sql $sql");
// $countOfUserName = $row['countOfUserName'];
$cursor->close();
if ($countOfUserName > 0) {
return false;
} else {
return true;
}
}