admin插件里面equal的疑问
这个是admin插件中的一部分getAccess(id, name[], authid[], ip[], password[]){new index = -1
new result = 0
for(new i = 0; i < g_aNum; ++i) {
if (g_aFlags & FLAG_AUTHID) {
if (equal(authid, g_aName)) {
index = i
break
}
}
else if (g_aFlags & FLAG_IP) {
new c = strlen( g_aName )
if ( g_aName[ c - 1 ] == '.' ) { /* check if this is not a xxx.xxx. format */
if (equal( g_aName , ip , c ) ) {
index = i
break
}
} /* in other case an IP must just match */
elseif ( equal(ip, g_aName) ){
index = i
break
}
}
else {
if (g_aFlags & FLAG_TAG) {
if (contain(name, g_aName)!=-1){
index = i
break
}
}
else if (equal(name, g_aName)) {
index = i
break
}
}
}
if (index != -1) {
if (g_aFlags & FLAG_NOPASS){
result |= 8
new sflags
get_flags(g_aAccess, sflags, 31)
set_user_flags(id, g_aAccess)
log_to_file(g_logFile, "Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
name, get_user_userid(id), authid, g_aName , sflags, ip)
}
else if (equal(password, g_aPassword)) {
result |= 12
set_user_flags(id, g_aAccess)
new sflags
get_flags(g_aAccess, sflags, 31)
log_to_file(g_logFile, "Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
name, get_user_userid(id), authid, g_aName , sflags, ip)
}
else {
result |= 1
if (g_aFlags & FLAG_KICK){
result |= 2
log_to_file(g_logFile, "Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")",
name, get_user_userid(id), authid, g_aName, ip)
}
}
}
else if (get_cvar_float("amx_mode")==2.0) {
result |= 2
}
else {
new defaccess
get_cvar_string("amx_default_access", defaccess, 31)
new idefaccess = read_flags(defaccess)
if (idefaccess){
result |= 8
set_user_flags(id, idefaccess)
}
}
return result
} else if (equal(name, g_aName)) { 对比用户名的,但是大小写不一致还能进入
例如:
zhangsan在user文件中有权限
但是
ZHANGsan这样大小写不同的id仍然能进入,只是没有权限,但是zhangsan再进入就变成(1)zhangsan ,同样没有权限了!
这个怎么解决呢?
equal这个怎么能不区别大小写呢? 想改成不区分大小写,把 equal 改成 equali 就可以了。 谢谢r版主,去看了下官方才发现原来这个中文说明上面不对!
equali
Core (string.inc)
细节
equali - 比较两个字符串是否匹配. 大小写敏感.
应该是大小写不敏感吧
页:
[1]