本文整理汇总了PHP中Core::SQL方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::SQL方法的具体用法?PHP Core::SQL怎么用?PHP Core::SQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::SQL方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProcessItem
// Find Core Pathing
if (file_exists(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "core.class.php")) {
require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "core.class.php")) {
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "core.class.php")) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists("core.class.php")) {
require_once "core.class.php";
} else {
}
$core = new Core();
$GLOBALS["core"] = $core;
// Prepares URL DATA to include price infomation for all items listed in the operational_items database.
$tempcount = 0;
$result = $core->SQL("SELECT EveTypeID FROM `production_items` WHERE Type = 2");
while ($row = mysql_fetch_assoc($result)) {
ProcessItem($row['EveTypeID']);
}
$core->Log("CRON(Eve-Central Market Data - Production) Done. All operational items were process successfully.");
function ProcessItem($itemid)
{
$core = $GLOBALS["core"];
$evecentralsite = "http://api.eve-central.com/api/marketstat?typeid=" . $itemid . "®ionlimit=10000002";
$raw = file_get_contents($evecentralsite);
if ($raw !== FALSE) {
$xml = new SimpleXMLElement($raw);
foreach ($xml->marketstat->children() as $item) {
$eveitemid = (int) $item["id"];
$registered = $core->SQL("SELECT COUNT(*) FROM `operations_marketdata` WHERE EveTypeID =" . $eveitemid);
$total_records = mysql_num_rows($registered);
示例2: VALUES
// If we fail the check, the user will be redirected to an error page.
// Goto($url) is a method of the core object which is a shorthand for { header("Location: $url); exit; }
if ($core->CurrentUser()->AccessRight() < 1) {
$core->Goto('../../php/access.php');
}
// User name
$username = $core->CurrentUser()->Name;
// Browser string
$browser = @$_SERVER["HTTP_USER_AGENT"];
if (empty($browser)) {
$browser = "Unknown";
}
// Save username and browser string in our database
// SQL($query) is a method of the Core object that runs a SQL query on the plugin database
// SQLEscape($string) is also a Core method that is a shorthand for mysql_real_escape_string($string)
$core->SQL("INSERT INTO `browserstats` (`User`, `Browser`) VALUES ('" . $core->SQLEscape($username) . "', '" . $core->SQLEscape($browser) . "') ON DUPLICATE KEY UPDATE `Browser`='" . $core->SQLEscape($browser) . "'");
// Read the database
$result = $core->SQL("SELECT * FROM `browserstats`");
$browserstats = array();
while ($row = mysql_fetch_assoc($result)) {
$br = new Browser($core->SQLUnEscape($row["Browser"]));
$browsername = "{$br->Platform}, {$br->Name} {$br->Version}";
if (isset($browserstats[$browsername])) {
$browserstats[$browsername] += 1;
} else {
$browserstats[$browsername] = 1;
}
}
// We have the browser stats in an array. Now assign it to a Smarty template variable
// So that it will be availabe in the Smarty template.
// You can assign any type of variable: numbers, strings, arrays, objects... all work
示例3: Core
<?php
require_once '../../core/core.class.php';
$core = new Core();
//Access control
if ($core->CurrentUser()->AccessRight() < 2) {
$core->Goto('../../php/access.php');
}
$action = @$_GET["action"];
if (empty($action)) {
$action = "home";
}
$names = $core->GetAllUserNames();
$core->assign("names", $names);
if ($action == "times" || @$_POST["submit"] == "Add Player" || substr(@$_POST["submit"], 0, 13) == "Remove Player") {
$result = $core->SQL("SELECT Distinct `GroupID` FROM `operations_items` Order By `GroupID`");
while ($row = mysql_fetch_assoc($result)) {
$var = "group" . $row['GroupID'];
$core->assign($var, @$_POST[$var]);
$groupnumber[$row['GroupID']] = @$_POST["group" . $row['GroupID']];
}
$core->assign("groupnumber", $groupnumber);
$opdate = @$_POST["opdate"];
if (empty($opdate)) {
$opdate = gmdate("Y-m-d");
}
$core->assign("opdate", $opdate);
$count = @$_POST["count"];
$players = array();
if (empty($count)) {
$count = 0;
示例4: array
//Access control
if ($core->CurrentUser()->AccessRight() < 4) {
$core->Goto('../../php/access.php');
}
$action = @$_GET["action"];
if ($action == "payout") {
$names = $core->GetAllUserNames();
$opids = array();
foreach ($_POST as $key => $value) {
if (substr($key, 0, 2) == "op" && $value == "on") {
$opids[] = substr($key, 2);
}
}
if ($_POST["submit"] == "Reject") {
// Reject selected ops
$core->SQL("UPDATE operations_submissions SET Status=3, RejectReason='" . $core->SQLEscape($_POST["reject"]) . "' WHERE FIND_IN_SET(id, '" . implode(",", $opids) . "')");
// Send messages to op leaders
$result = $core->SQL("SELECT id, OpDate, Leader FROM operations_submissions WHERE FIND_IN_SET(id, '" . implode(",", $opids) . "')");
while ($row = mysql_fetch_assoc($result)) {
$id = $row["id"];
$date = date("Y-m-d", strtotime($row["OpDate"]));
$leader = $row["Leader"];
$text = "<p>Following operation submitted by you was rejected by " . $core->CurrentUser()->Name . ".</p>";
$text .= "<p><a href='../plugins/payoutview/index.php?view=" . $id . "'>View Rejected Operation</a></p>";
$text .= "<p><b>REASON:</b><br />" . $_POST["reject"] . "</p>";
$core->SendMail($date . " Operation Rejected", $text, $leader);
}
$core->Goto("index.php");
} else {
$corpcut = $_POST["corpcut"];
$result = $core->SQL("SELECT * FROM operations_params");
示例5: dirname
}
if ($action == "home" || $action == "user" || $action == "recruitment") {
$page = @$_GET["page"];
if (empty($page)) {
$page = 1;
}
$max = 25;
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . "images";
if (!file_exists($path)) {
mkdir($path);
}
$baseurl = "http://" . $_SERVER["SERVER_NAME"] . "/plugins/gallery/images/";
$names = $core->GetAllUserNames();
if ($action == "home") {
if ($core->CurrentUser()->AccessRight() == 0) {
$result = $core->SQL("SELECT COUNT(*) FROM gallery");
$pagecount = ceil(mysql_result($result, 0) / $max);
$result = $core->SQL("SELECT * FROM gallery WHERE Owner=" . $core->CurrentUser()->ID . " AND AccessRight=1 ORDER BY Date DESC LIMIT " . $max * ($page - 1) . "," . $max);
} else {
$result = $core->SQL("SELECT COUNT(*) FROM gallery");
$pagecount = ceil(mysql_result($result, 0) / $max);
$result = $core->SQL("SELECT * FROM gallery WHERE " . $core->CurrentUser()->AccessRight() . ">=AccessRight AND AccessRight!=-1 AND AccessRight!=1 ORDER BY Date DESC LIMIT " . $max * ($page - 1) . "," . $max);
}
} elseif ($action == "recruitment") {
if ($core->CurrentUser()->AccessRight() < 3) {
$core->Goto('../../php/access.php');
}
$recruitment = $_GET["recruitment"];
if ($recruitment == "all") {
$result = $core->SQL("SELECT COUNT(*) FROM gallery");
$pagecount = ceil(mysql_result($result, 0) / $max);
示例6: dirname
require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "core.class.php")) {
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "core.class.php")) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists("core.class.php")) {
require_once "core.class.php";
} else {
}
$core = new Core();
$GLOBALS["core"] = $core;
$marketid = $core->GetSetting("MarketLocation");
$markethanger = $core->GetSetting("MarketHanger");
$CorpStorePrice = $core->GetSetting("CorpStorePrice");
$AllyStorePrice = $core->GetSetting("AllyStorePrice");
$result1 = $core->SQL("SELECT DISTINCT nameid, SUM(qty) as 'Totalqty' FROM info_assets WHERE itemidm = " . $marketid . " AND flag = " . $markethanger . " GROUP BY nameid");
//echo "SELECT DISTINCT nameid FROM info_assets WHERE itemidm = ".$marketid."<br>";
while ($row = mysql_fetch_assoc($result1)) {
$nameid = $row['nameid'];
$stock = $row['Totalqty'];
//Production Items Database Update.
$registered = $core->SQL("SELECT * FROM `production_items` WHERE EveTypeID = " . $nameid . " AND Type = 2");
$total_records = mysql_num_rows($registered);
if ($total_records == 0) {
$result2 = $core->EVESQL("SELECT * FROM invTypes_expanded WHERE typeID = " . $nameid);
while ($row2 = mysql_fetch_assoc($result2)) {
$typeID = $row2['typeID'];
$groupID = $row2['groupID'];
$typeName = $core->SQLEscape($row2['typeName']);
$graphicID = $row2['graphicID'];
$marketGroupID = $row2['marketGroupID'];
示例7: Core
<?php
require_once '../../core/core.class.php';
$core = new Core();
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . "images";
if (!file_exists($path)) {
mkdir($path);
}
$baseurl = "http://" . $_SERVER["SERVER_NAME"] . "/plugins/gallery/images/";
$names = $core->GetAllUserNames();
$action = @$_GET["action"];
if (empty($action)) {
$action = "home";
}
if ($action == "home") {
$result = $core->SQL("SELECT * FROM gallery WHERE \n" . $core->CurrentUser()->AccessRight() . ">=AccessRight AND AccessRight!=-1 \nAND AccessRight!=1 ORDER BY Date DESC");
} else {
$result = $core->SQL("SELECT * FROM gallery WHERE Owner=" . $core->CurrentUser()->ID . " ORDER BY Date DESC");
}
$gallery = array();
while ($row = mysql_fetch_assoc($result)) {
$name = $row["Owner"] . "_" . $row["id"] . "." . $row["Extension"];
// Create thumbnail
$thumb = $row["Owner"] . "_" . $row["id"] . "_thumb.jpg";
if (file_exists($path . DIRECTORY_SEPARATOR . $name)) {
if (!file_exists($path . DIRECTORY_SEPARATOR . $thumb)) {
if ($row["Extension"] == "gif") {
$im = @imagecreatefromgif($path . DIRECTORY_SEPARATOR . $name);
} elseif ($row["Extension"] == "jpg") {
$im = @imagecreatefromjpeg($path . DIRECTORY_SEPARATOR . $name);
} elseif ($row["Extension"] == "png") {
示例8: Core
<?php
require_once '../../core/core.class.php';
$core = new Core();
$item = $_GET["item"];
// Read material prices
$result = $core->SQL("SELECT EveTypeID,Price FROM operations_items");
$itemprices = array();
while ($row = mysql_fetch_assoc($result)) {
$itemprices[$row["EveTypeID"]] = (double) $row["Price"];
}
mysql_free_result($result);
// Read material quantites from EVE DB
$query = "SELECT graphics.icon AS Icon, typeReq.typeName as Name, typeReq.typeID AS EveTypeID, IF(typeReq.groupID = 332, materials.quantity, CEIL(materials.quantity*(1+bluePrint.wasteFactor/100))) AS Quantity ";
$query .= "FROM TL2MaterialsForTypeWithActivity AS materials ";
$query .= "INNER JOIN invTypes AS typeReq ON materials.requiredtypeID = typeReq.typeID ";
$query .= "INNER JOIN invGroups AS typeGroup ON typeReq.groupID = typeGroup.groupID ";
$query .= "INNER JOIN invBlueprintTypes AS bluePrint ON materials.typeID = bluePrint.blueprintTypeID ";
$query .= "INNER JOIN eveGraphics AS graphics ON typeReq.graphicID = graphics.graphicID ";
$query .= "WHERE bluePrint.productTypeID=" . $item . " AND Quantity>0 AND materials.activity = 1 AND typeGroup.categoryID NOT IN (6, 7, 16) ORDER BY typeReq.marketGroupID, Name ASC";
$result = $core->EveSQL($query);
$eveprices = array();
$total = 0;
while ($row = mysql_fetch_assoc($result)) {
if (isset($itemprices[$row["EveTypeID"]])) {
$unit = $itemprices[$row["EveTypeID"]];
$price = $itemprices[$row["EveTypeID"]] * (double) $row["Quantity"];
} else {
$unit = 0;
$price = 0;
}
示例9: while
$action = "home";
}
if ($portalid == "" || empty($portalid) || $portalid < 0 || $core->CharacterIDExists($portalid) == "FALSE") {
$portalid = $core->CurrentUser()->ID;
}
if ($template == "" || empty($template) || $template < 0) {
$template = 0;
}
if ($templatepost == "" || empty($templatepost) || $templatepost < 0) {
$templatepost = 0;
}
if ($return == "" || empty($return) || $return < 0) {
$return = 0;
}
if ($action == "home") {
$result = $core->SQL("SELECT * FROM operations_params");
while ($row = mysql_fetch_assoc($result)) {
if ($row["Name"] == "IndexDate") {
$core->assign("indexdate", $row["Value"]);
}
if ($row["Name"] == "IndexTime") {
$core->assign("indextime", $row["Value"]);
}
}
} elseif ($action == "qtc7" || $action == "qtc30") {
$timeperiod = 7;
if ($action == "qtc30") {
$timeperiod = 30;
}
$raw = file_get_contents("http://www.starvingpoet.net/feeds/mmi.xml");
if ($raw !== FALSE) {