Remove the last few occurrences of mysql_ function usage.

feature/node-rewrite
Sven Slootweg 12 years ago
parent c93241fe91
commit 7f1894eff3

@ -24,8 +24,7 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key'])
switch($_GET['action'])
{
case "verify_user":
$sUsername = mysql_real_escape_string($_GET['username']);
if($result = mysql_query_cached("SELECT * FROM users WHERE `Username` = '{$sUsername}'"))
if($result = $database->CachedQuery("SELECT * FROM users WHERE `Username` = :Username", array(":Username" => $_GET['username'])))
{
$sUser = new User($result);
@ -58,15 +57,14 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key'])
case "list_vps":
if(!empty($_GET['userid']))
{
$sUserId = (is_numeric($_GET['userid'])) ? $_GET['userid'] : 0;
$query = "SELECT * FROM containers WHERE `UserId` = '{$sUserId}'";
$result = $database->CachedQuery("SELECT * FROM containers WHERE `UserId` = :UserId", array(":UserId" => $_GET['userid']));
}
else
{
$query = "SELECT * FROM containers";
$result = $database->CachedQuery("SELECT * FROM containers");
}
if($result = mysql_query_cached($query))
if($result)
{
$sVpses = array();

@ -52,7 +52,7 @@ class User extends CPHPDatabaseRecordClass
public function GetVpsCount()
{
if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$this->sId}'"))
if($result = $database->CachedQuery("SELECT * FROM containers WHERE `UserId` = :UserId", array(":UserId" => $this->sId)))
{
return count($result->data);
}

@ -14,7 +14,7 @@
$_CVM = true;
require("includes/include.base.php");
if($result = mysql_query_cached("SELECT * FROM containers"))
if($result = $database->CachedQuery("SELECT * FROM containers"))
{
foreach($result->data as $row)
{

@ -15,7 +15,7 @@ if(!isset($_CVM)) { die("Unauthorized."); }
$sNodeList = array();
if($result = mysql_query_cached("SELECT * FROM nodes"))
if($result = $database->CachedQuery("SELECT * FROM nodes"))
{
foreach($result->data as $row)
{

@ -17,7 +17,7 @@ try
{
$sNode = new Node($router->uParameters[1]);
if($result = mysql_query_cached("SELECT * FROM containers WHERE `NodeId` = '{$sNode->sId}'"))
if($result = $database->CachedQuery("SELECT * FROM containers WHERE `NodeId` = :NodeId", array(":NodeId" => $sNode->sId)))
{
foreach($result->data as $row)
{

@ -13,7 +13,7 @@
if(!isset($_CVM)) { die("Unauthorized."); }
$result = mysql_query_cached("SELECT * FROM users ORDER BY `AccessLevel` DESC");
$result = $database->CachedQuery("SELECT * FROM users ORDER BY `AccessLevel` DESC");
$sUserList = array();

@ -21,7 +21,7 @@ try
$sVpsList = array();
if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUserEntry->sId}'"))
if($result = $database->CachedQuery("SELECT * FROM containers WHERE `UserId` = :UserId", array(":UserId" => $sUserEntry->sId)))
{
foreach($result->data as $row)
{

@ -15,7 +15,7 @@ if(!isset($_CVM)) { die("Unauthorized."); }
$sVpsList = array();
if($result = mysql_query_cached("SELECT * FROM containers"))
if($result = $database->CachedQuery("SELECT * FROM containers"))
{
foreach($result->data as $row)
{

@ -15,7 +15,7 @@ if(!isset($_CVM)) { die("Unauthorized."); }
if($sLoggedIn === true)
{
$result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUser->sId}'");
$result = $database->CachedQuery("SELECT * FROM containers WHERE `UserId` = :UserId", array(":UserId" => $sUser->sId));
$sVpsList = array();

@ -99,7 +99,7 @@ if(isset($_POST['submit']))
if($display_form === true)
{
$result = mysql_query_cached("SELECT * FROM templates WHERE `Available` = '1'");
$result = $database->CachedQuery("SELECT * FROM templates WHERE `Available` = '1'");
$sTemplateList = array();

@ -24,10 +24,9 @@ $render_form = true;
if(isset($_POST['submit']))
{
$sUsername = mysql_real_escape_string($_POST['username']);
$sFieldUsername = htmlentities($_POST['username']);
if($result = mysql_query_cached("SELECT * FROM users WHERE `Username` = '{$sUsername}'"))
if($result = $database->CachedQuery("SELECT * FROM users WHERE `Username` = :Username", array(":Username" => $_POST['username'])))
{
$sLoginUser = new User($result);

Loading…
Cancel
Save