public function create_newdir($srvid, $dir_name) { if (empty($dir_name)) { return 'No directory name given!'; } // Get network ID $result_nid = @mysql_query("SELECT netid FROM servers WHERE id = '{$srvid}'"); $row_nid = mysql_fetch_row($result_nid); $this_netid = $row_nid[0]; if (empty($this_netid)) { return 'Failed to get network ID!'; } require DOCROOT . '/includes/classes/network.php'; $Network = new Network(); $netinfo = $Network->netinfo($this_netid); // Get real server info require DOCROOT . '/includes/classes/servers.php'; $Servers = new Servers(); $srvinfo = $Servers->getinfo($srvid); $net_game_ip = $netinfo['game_ip']; $net_local = $netinfo['is_local']; $net_gameuser = $srvinfo[0]['username']; $net_game_port = $srvinfo[0]['port']; // Add full path to dir if (isset($_SESSION['curdir'])) { $dir_name = $_SESSION['curdir'] . '/' . $dir_name; } // Get userdir if ($net_local) { $localdir = DOCROOT . '/_SERVERS/'; $game_dir = $localdir . '/accounts/' . $net_gameuser . '/' . $net_game_ip . '.' . $net_game_port . '/' . $dir_name; // Check existing if (file_exists($game_dir)) { die('Sorry, that directory already exists!'); } // Create directory if (!mkdir($game_dir)) { return 'Failed to create the directory (' . $game_dir . ')!'; } else { return 'success'; } } else { // Save File $run_cmd = "CreateDirectory -u {$net_gameuser} -i {$net_game_ip} -p {$net_game_port} -d \"{$dir_name}\""; // Run the command, return output return $Network->runcmd($this_netid, $netinfo, $run_cmd, true, $srvid); } }
<?php require 'checkallowed.php'; // No direct access // Get server info require DOCROOT . '/includes/classes/servers.php'; $Servers = new Servers(); $srvinfo = $Servers->getinfo($url_id); // Store gameserver root in session (without $HOME or docroot for compatibility) #if(!isset($_SESSION['gamesrv_root']) || $_SESSION['gamesrv_id'] != $url_id) #{ # $_SESSION['gamesrv_root'] = 'accounts/'.$srvinfo[0]['username'].'/'.$srvinfo[0]['ip'].'.'.$srvinfo[0]['port']; # $_SESSION['gamesrv_id'] = $url_id; #} // Update the session everytime to ensure things are fresh $_SESSION['gamesrv_root'] = 'accounts/' . $srvinfo[0]['username'] . '/' . $srvinfo[0]['ip'] . '.' . $srvinfo[0]['port']; $_SESSION['gamesrv_id'] = $url_id; ?> <div class="page_title"> <div class="page_title_icon"><img src="<?php echo $relpath; ?> images/icons/medium/servers.png" border="0" /></div> <div class="page_title_text"><?php echo $lang['servers']; ?> </div> </div> <div class="tabs">