mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
Update eqemu_server.pl [skip ci] - Make eqemu_config.xml parsing more strict to look inside the database section
This commit is contained in:
parent
9f01d14c64
commit
195bc03645
@ -1063,17 +1063,46 @@ sub trim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub read_eqemu_config_xml {
|
sub read_eqemu_config_xml {
|
||||||
my $confile = "eqemu_config.xml"; #default
|
open (CONFIG, "eqemu_config.xml");
|
||||||
open(F, "<$confile");
|
while (<CONFIG>){
|
||||||
my $indb = 0;
|
chomp;
|
||||||
while(<F>) {
|
$o = $_;
|
||||||
s/\r//g;
|
|
||||||
if(/<host>(.*)<\/host>/i) { $host = $1; }
|
if($o=~/\<\!--/i){
|
||||||
elsif(/<username>(.*)<\/username>/i) { $user = $1; }
|
next;
|
||||||
elsif(/<password>(.*)<\/password>/i) { $pass = $1; }
|
}
|
||||||
elsif(/<db>(.*)<\/db>/i) { $db = $1; }
|
|
||||||
if(/<longname>(.*)<\/longname>/i) { $long_name = $1; }
|
if($o=~/database/i && $o=~/\<\//i){
|
||||||
|
$in_database_tag = 0;
|
||||||
|
}
|
||||||
|
if($o=~/\<database\>/i){
|
||||||
|
print "IN DATABASE TAG\n" if $debug;
|
||||||
|
$in_database_tag = 1;
|
||||||
|
}
|
||||||
|
if($o=~/\<longname\>/i){
|
||||||
|
($long_name) = $o =~ /<longname>(.*)<\/longname>/;
|
||||||
|
print "Long Name: " . $long_name . "\n" if $debug;
|
||||||
|
}
|
||||||
|
if($in_database_tag == 1){
|
||||||
|
if($o=~/\<username\>/i && $in_database_tag){
|
||||||
|
($user) = $o =~ />(\w+)</;
|
||||||
|
print "Database User: " . $user . "\n" if $debug;
|
||||||
|
}
|
||||||
|
if($o=~/\<password\>/i && $in_database_tag){
|
||||||
|
($pass) = $o =~ />(\w+)</;
|
||||||
|
print "Database Pass: " . $pass . "\n" if $debug;
|
||||||
|
}
|
||||||
|
if($o=~/\<db\>/i){
|
||||||
|
($db) = $o =~ />(\w+)</;
|
||||||
|
print "Database Name: " . $db . "\n" if $debug;
|
||||||
|
}
|
||||||
|
if($o=~/\<host\>/i){
|
||||||
|
($host) = $o =~ />(\w+)</;
|
||||||
|
print "Database Host: " . $host . "\n" if $debug;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
close(CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
#::: Fetch Latest PEQ AA's
|
#::: Fetch Latest PEQ AA's
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user