PHPスクリプトを実行していますが、次のようなエラーが発生し続けます: Notice: Undefined variable: iAccount_db in D:\iac\htdocs\datas\scripts\iAccount_core.inc.php on line 135
しかし、私はすでに変数を定義しています!
コード:
iAccount_core.inc.php
...
require_once("iAccount_config.inc.php");
...
function iAccount_level_update($user){
$result = mysql_query ("SELECT exp FROM $iAccount_table WHERE username='$user'");
$exp = @mysql_result($result, "exp");
if ($exp > -1 and $exp < 61){$update_lev = 1;}
if ($exp > 60 and $exp < 101){$update_lev = 2;}
if ($exp > 100 and $exp < 6001){$update_lev = 3;}
if ($exp > 600 and $exp < 1001){$update_lev = 4;}
if ($exp > 1000 and $exp < 6001){$update_lev = 5;}
if ($exp > 5999){$update_lev = 6;}
mysql_query("UPDATE $iAccount_table SET level='$update_lev' WHERE username='$user'", $iAccount_db);
}
function iAccount_level_size($user){
$result = mysql_query ("SELECT level FROM $iAccount_table WHERE username='$user'");
$level = @mysql_result($result, "level");
if ($level = 0 or $level = ""){iAccount_level_update($user);}
if ($level = 1){$size = $iAccount_level_maxsize[1];}
if ($level = 2){$size = $iAccount_level_maxsize[2];}
if ($level = 3){$size = $iAccount_level_maxsize[3];}
if ($level = 4){$size = $iAccount_level_maxsize[4];}
if ($level = 5){$size = $iAccount_level_maxsize[5];}
if ($level = 6){$size = $iAccount_level_maxsize[6];}
$size = $size*1024; // return KB
return($size);
}
function iAccount_level_addexp($exp, $user){
$result = mysql_query ("SELECT exp FROM $iAccount_table WHERE username='$user'");
$expp = @mysql_result($result, "exp");
$update_exp = $expp+$exp;
mysql_query("UPDATE $iAccount_table SET exp='$update_exp' WHERE username='$user'", $iAccount_db);
}
function iAccount_dirsize($dirName = '.') {
$dir = dir($dirName);
$size = 0;
while($file = $dir->read()) {
echo "$dirName/$file"." -> ".filesize("$dirName/$file")."n";
if ($file != '.' && $file != '..') {
if (is_dir("$dirName/$file")) {
$size += dirsize($dirName . '/' . $file);
} else {
$size += filesize($dirName . '/' . $file);
}
}
}
$dir->close();
return $size;
}
...
$iAccount_db = mysql_connect($iAccount_sql_server, $iAccount_sql_username, $iAccount_sql_password) or iAccount_die('Unable to connect to database. Please check your iAccount MySQL server, username and password configuration options.');
mysql_select_db($iAccount_sql_database, $iAccount_db) or iAccount_die('Unable to select the database. Please check your iAccount MySQL database configuration option.');
iAccount_config.inc.php
...
$iAccount_sql_server = "localhost";
$iAccount_sql_username = "root";
$iAccount_sql_password = "test";
$iAccount_sql_database = "test";
$iAccount_table = "iAccount";
...