好的,所以我有以下代码:
if ($AccountData ['nAuthID'] == 1 && $data['MAINT'] == True) {
die ('MM');
}
这在技术上应该可行,但由于某种原因它不可行。
基本上在我的文本文件中,我已经说过 maint 是错误的,但是当它到达这部分代码时,它仍然会死掉。
我认为这与 '$data['MAINT'] == True' 部分有关,但我不确定它有什么问题?
以下是所有代码:
$exec = mssql_query("SELECT nEMID, nAuthID, sUserPass FROM tAccounts where sUsername = '$user'");
$AccountData = mssql_fetch_assoc($exec);
$file = file('LauncherInfo.txt');
foreach ($file as $line) {
if ($line) {
$splitLine = explode(' = ',$line);
$data[$splitLine[0]] = $splitLine[1];
}
}
//echo $data['MAINT'];
if ($AccountData ['nAuthID'] == 2 && $data['MAINT'] == True) {
//Continue.
} else if ($AccountData ['nAuthID'] == -2) {
die ('INV');
} else if ($AccountData ['nAuthID'] == -1) {
die ('BAN');
} else if ($AccountData ['nAuthID'] == 1 && $data['MAINT'] == True) {
die ('MM');
} else if ($AccountData ['nAuthID'] == 0) {
die ('EVR');
}
这是文本文件“LauncherInfo.txt”中的内容:
IP = 127.0.0.1
EXE = Client.exe
PORT = 8080
TITLE = Title
MAINT = False
Maintenance-Message = The server is currently in maintenance.
Ban-Message = You have been banned sucker!
Email Verification-Message = You need to active your email adddress.
Investigation-Message = Your account is undergoing investigation.
编辑:
我尝试使用以下代码:
if ($AccountData ['nAuthID'] == -2) {
die ('INV');
} else if ($AccountData ['nAuthID'] == -1) {
die ('BAN');
} else if ($AccountData ['nAuthID'] == 0) {
die ('EVR');
} else if ($AccountData ['nAuthID'] == 1 && $data['MAINT'] == 'True') {
die ('MM');
} else if ($AccountData ['nAuthID'] == 2 && $data['MAINT'] == 'True') {
//Continue and allow user to log in.
}
我也试过这个:
if ($AccountData ['nAuthID'] == -2) {
die ('INV');
} else if ($AccountData ['nAuthID'] == -1) {
die ('BAN');
} else if ($AccountData ['nAuthID'] == 0) {
die ('EVR');
} else if ($AccountData ['nAuthID'] == 1 && $data['MAINT'] == "True") {
die ('MM');
} else if ($AccountData ['nAuthID'] == 2 && $data['MAINT'] == "True") {
//Continue and allow user to log in.
}
但这些都不起作用?
EDIT2:我将代码更改为如下所示:
if ($AccountData ['nAuthID'] == -2) {
echo ('INV');
} else if ($AccountData ['nAuthID'] == -1) {
echo ('BAN');
} else if ($AccountData ['nAuthID'] == 0) {
echo ('EVR');
} else if ($AccountData ['nAuthID'] == 1 && $data['MAINT'] == "True") {
echo ('MM');
} else if ($AccountData ['nAuthID'] == 2 && $data['MAINT'] == "True") {
//Continue and allow user to log in.
}
我在浏览器中看到的是 EVR。似乎它甚至没有从那里继续?
谢谢。