Warning: system() has been disabled...

albNio

New Member
Messages
4
Reaction score
0
Points
0
Hello,
I have installed a website to help me in a game called travian, i have installed the trooptool,
http://laffers.net/works/trooptool.php
but after the installation, when i try to update some database (i don't know aboute php code) i get this message:

Warning: system() has been disabled for security reasons in /home/albnio/public_html/updater.php on line 20
Failed downloading http://s4.travian.gr/map.sql or the file could not be saved due to file system permission restrictions!

can anywone help me please..
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63

His particular error's not mentioned in any of those topics, but I've got a reasonable suspicion as to why it's erroring.

system — Execute an external program and display the output
That's what the code's supposed to do, so somewhere it's cheating and just running another app to get the results of SOMETHING to display.




However, the chances of being able to run that on x10free is virtually 0% - Exec and Shell_Exec do similar actions and are disabled for security reasons as well, and have been for some time - it's been used too many times by people trying to abuse the service, plus it's about as big a security hole as posting the administrator username/password.


I'd look at installing a local testing server like WAMP or XAMPP and install trooptool on there instead - local testing servers shouldn't have any restrictions, and you should be able to use the tool you wanted without having to modify it much (if at all).
 

albNio

New Member
Messages
4
Reaction score
0
Points
0
I'd look at installing a local testing server like WAMP or XAMPP and install trooptool on there instead - local testing servers shouldn't have any restrictions, and you should be able to use the tool you wanted without having to modify it much (if at all).

the tool works good but the only problem i have is that i can't update the database... i mean i can't update the map of the game on my troop tool site.. so i have luck of information like names of vilages players population etc...
 
Last edited:

albNio

New Member
Messages
4
Reaction score
0
Points
0
do you know any way to enable system() or to update my database manually?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
system() will never be enabled. Don't even try.

You can do it manually by downloading http://s4.travian.gr/map.sql and using phpMyAdmin (accessible from cPanel) to execute it. You could also rewrite the updater to not use command line tools. PHP can readily fetch a file using PHP and execute SQL queries. Just be sure you trust the source file or validate it.
 

s1l3ntw

New Member
Messages
1
Reaction score
0
Points
0
Hi there,

I'm having the exact same issue as stated above... for the exact same tool, lol.
However I manually read the map.sql through phpMyAdmin and am now looking for a way to use the "update.php" as above, however finding a different method. i.e. no system()...

However I am clueless when it comes to PHP, and I dont exactly have the luxury of time to go learn PHP from basic principals.

Is anyone able to suggest a script or some code that will perform the following functions without using system?

Thanks in advance!

-David

// load the map.sql via system command using "wget" into the folder data/
// IMPORTANT: PHP has to be allowed to write into that folder, if necessary set the needed rights!
system('wget '.$travian_db_dump.' -O data/tmp.sql');


// Check whether the file has been downloaded and is larger than zero bytes
if (file_exists('data/tmp.sql') AND filesize('data/tmp.sql')) {

// Empty table
$query = 'TRUNCATE TABLE x_world';
$result = @mysql_query($query) OR die('Can not clear table '.PREFIX.'world!');

if(system($mysql_executable.' --host='.$mysqlhost.' --user='.$mysqluser.' --password='.$mysqlpass.' --default-character-set=utf8 '.$mysqldb.' < data/tmp.sql') === false) {
echo 'Update failed!';
} else {
echo 'Update was successful!';
}
 
Top