Gentlemen. I've set up a PHP web-based ban system so users can see who's banned, by whom, and for how long. It also features a MySQL database for authentication so admins can make or modify bans without giving them full rcon. It works by using FTP to fetch ULib's ban file from the gameserver and saving it locally, then having the PHP parse the file into presentable HTML for the browser. The admins banning people is done by an rcon client built into the PHP. The auth for the FTP, rcon, and database are in a config file.
The problem is the FTP executable on the server. Hitting the refresh button a the top of the page to make it contact the gameserver for the bans just makes it load for a long time, then just kicks back to the main page. At first I thought it was PHP's implementation of FTP or something, but I used the commandline FTP on the webhost, and it doesn't work either. I can log in and cd to the correct directory on the gameserver from the webhost via SSH, but when I attempt "get bans.txt" it gets to Opening data connection, and just hangs there before it's terminated by the process watcher thingie. I also can't do a directory listing.
Is this supposed to be happening? As in, is it some kind of security feature to prevent malicious files getting to the server, or something to that effect? Is FTP or its port just not configured for that kind of usage? Is it an OS/filesystem incompatiblity issue, with the gameserver beng Windows and the webhost being Linux?
It has me stumped. Throw me a bone guys.
FTP executable usage on webhost
-
- A regular
- Posts: 35
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Fri May 20, 2011 3:01 pm
Re: FTP executable usage on webhost
We don't restrict its usage. Have you tried using a different client (wget/curl/etc)? Are you using it in passive mode?
Re: FTP executable usage on webhost
Okay, I got it working. It did need passive mode, I had to look up how to do this in PHP.
It's:
Herp derp. Thanks for the refresher.
It's:
Code: Select all
unlink('bans.txt');
ftp_pasv($conn, true);
ftp_get($conn,"bans.txt","bans.txt",FTP_ASCII);
echo '<center><h1 class="update">Bans updated!</h1><br /><h2 class="update">You will now be redirected to the previous page.</h2></center>';