
ChrisMartino
Members-
Posts
285 -
Joined
-
Last visited
Never
About ChrisMartino
- Birthday 08/02/1995
Profile Information
-
Gender
Male
-
Location
United Kingdom, Newcastle
ChrisMartino's Achievements

Advanced Member (4/5)
0
Reputation
-
Hey there, Basically I'm having an issue where once I have ported over my apache htaccess rules they no longer work on my LightTPD server here is the code that worked on apache: RewriteEngine on Options +FollowSymlinks RewriteBase / RewriteRule \.(css|jpe?g|gif|png|js)$ - [L] RewriteRule ^([^/]*)$ index.php?v=$1 [NC,L] RewriteRule ^([^/]*)/([^/]*)$ index.php?v=$1&uvara=$2 [NC,L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ index.php?v=$1&uvara=$2&uvarb=$3 [NC,L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)$ index.php?v=$1&uvara=$2&uvarb=$3&uvarc=$4 [NC,L] And now the code that I converted to LightTPD: url.rewrite-once = ( "^([^/]*)$" => "index.php?v=$1", "^([^/]*)/([^/]*)$" => "index.php?v=$1&uvara=$2", "^([^/]*)/([^/]*)/([^/]*)$" => "index.php?v=$1&uvara=$2&uvarb=$3", "^([^/]*)/([^/]*)/([^/]*)/([^/]*)$" => "index.php?v=$1&uvara=$2&uvarb=$3&uvarc=$4" ) But the conversion doesn't work? No value ever gets passed on the first parameter when one is specified as example.com/variable Thanks for your time!
-
Thanks for taking the time to read the thread. Basically the situation is with the following code: Line 1: print(self::$internal_commands[$command_value]); Line 2: print(self::$internal_commands[":!modules"]); This will output the following: Line 1: PHP Notice: Undefined index: :!modules in /var/www/html/MagicIRC/Framework/commands.class.php on line 36 Line 2: Commands_Framework::command_loadedmods Notice how the first notice tells you that ':!modules' isn't in the array yet the second print statement below it prints fine and the var $command_value is being supplied the same string as what the manually input print statement is?
-
I would rather not. But funnily enough when I run them commands as root I'm not prompted with any sort of error but running them as another Linux user I am?
-
Hey there! Thanks for taking the time to read my thread. So basically I have a basic SSH2 class to handle all my command requests. Yet when I run two commands simultaneously using the script like so: $c_method->exec("killall -9 -u local_user"); $c_method->exec("cd /home/local_user && nohup ./process &"); I am prompted with the following error: Warning: ssh2_exec() [function.ssh2-exec]: Unable to request a channel from remote host in ssh2.class.php on line 58 Here is my command processing function: public static function exec($command_string, $stream = false) { $stream_exec = ssh2_exec(self::$global_ssh2_handle, $command_string); if($stream != false) { stream_set_blocking($stream_exec, true); return stream_get_contents($stream_exec); } } Thanks for your time and I hope you can help!
-
Thanks! I updated the header format for the file type and prior to setting the headers called ob_end_clean and the file downloaded correctly without an issue! Thanks for your time
-
Hey there! Thanks for taking the time to read my thread. So I have an issue with downloading a local file to the clients computer. When I call the header functions to prompt the download for the user it downloads part of the pages content as well and this is not required. I simply want to download the file specified without any additional content. Now I'm aware that it is most likely doing this because I'm calling the download prompt headers from within the center of a HTML/PHP document but this is required and there is no possible way of changing the method of execution. Here is my function: static function download_file($file_path) { $file_name = explode("/", $file_path); $save_directory = str_replace("Frontend/index.php", "Temporary/", $_SERVER['SCRIPT_FILENAME']); if(!ftp_get(self::$FTP_Handle, $save_directory.end($file_name), $file_path, FTP_BINARY)) die("failed."); if(file_exists($save_directory.end($file_name))) { header("Content-type: application/force-download"); header('Content-Disposition: inline; filename="'. end($file_name) .'"'); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($save_directory.end($file_name))); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $save_directory.end($file_name) . '"'); readfile($save_directory.end($file_name)); } return 1; } Now the supplied function also downloads part of the page source as well as the destination files source when called from a page with prior HTML content. Is there any way to stop this happening without corrupting the file as it may be LINUX executables being downloaded at certain points. Thanks for your time, Christopher.
-
Hey there, This has me stumped here. I'm supplying an array as a valid argument to the class like so: $mysql_configuration = array( 'MySQL_Host' => "localhost", 'MySQL_Username' => "fdsfdsfsdfsd", 'MySQL_Password' => "sdf-sdf543", 'MySQL_Database' => "sfsdfsdfsdf"); $radio_core = array('Main' => new Radio_Core($mysql_configuration), 'Requests' => new Radio_Requests, 'Accounts' => new Radio_Accounts, 'Content' => new Radio_Content); And here is my small class: class Radio_Core { public $mysql_handle; function __construct($mysql_array) { $this->mysql_handle = mysql_connect($mysql_array['MySQL_Host'], $mysql_array['MySQL_Username'], $mysql_array['MySQL_Password']); if(!$this->mysql_handle) { die("The station failed to connect to the MySQL database."); } else { mysql_select_db($mysql_array['MySQL_Database'], $this->mysql_handle); } return 1; } } And when it is called I am prompted with the error that the argument is missing for it? Thanks for your time!
-
Hey there! Thanks for taking the time to read my thread. So basically I have one index page that handles all the redirects of the content etc but the issue is there can be any number of $_GET variables in the URL. For example: index.php?v=my-account&action=password&change=true&and=hello&there=yes But how would I be able to use a rewrite rule to change all vars in the url at once to appear like this: index.php/my-account/action/password/change/true/and/hello/there/yes Thanks for your time!
-
Hey there I'm having a strange error here. So basically I'm running the following command: It creates the MySQL user and MySQL database fine but the last permission grant fails. $mysql_connection = mysql_connect($remote_machine['Machine_IP'], $remote_machine['Machine_MySQL_Username'], $remote_machine['Machine_MySQL_Password']); mysql_query("CREATE DATABASE Server_{$server_id}", $mysql_connection); mysql_query("CREATE USER 'Server_{$server_id}'@'localhost' IDENTIFIED BY '{$database_password}'", $mysql_connection); mysql_query("GRANT ALL PRIVILEGES ON Server_{$server_id}.* TO Server_{$server_id}@localhost IDENTIFIED BY '{$database_password}';", $mysql_connection) or die(mysql_error()); But for some reason when I grant the privileges on the last command there I am prompted with the following error: Access denied for user 'root'@'ciroc.x10premium.com' to database 'Server_25' Any ideas? Thanks.
-
Thanks worked
-
Yea I'm trying so if any of the first 3 conditions are set and the last condition is false. So E.G if it isn't the demo account.
-
Hey there, Now usually after a while I can always solve bugs with my code but this one really has me at a halt here. So basically I have a function that returns true if the accounts username = demo and false if it doesn't but the following if statement returns true and executes the code every time regardless of the returned value of the function like so: if(isset($_POST['server_start']) or isset($_POST['server_stop']) or isset($_POST['server_restart']) && $Class['Account']->is_demo_account($_SESSION['account_id']) == false) Now if I run the following code right above that: if($Class['Account']->is_demo_account($_SESSION['account_id']) == false) echo "it isn't a demo account."; else echo "it is a demo account."; It will echo "it is a demo account" correctly. Now can somebody please tell me why the if statement with the post values in always return true. Thanks for your time!
-
Thanks a lot that worked like a treat problem solved. It's people like you that dedicate time to people needing assistance that make these forums great. Much obliged
-
What raw version and how did you look? I looked at the file that it edited and removed all str_replace's. The file is located on the dedicated server so I simply cat the file after editing like so: [root@monster 19]# cat settings.xml <?xml version=1.0?> <settings> <!-- Port the server will listen on --> <port>7781</port> <!-- Maximum number of players the server will support (Max 32) --> <maxplayers>10</maxplayers> <!-- Maximum number of vehicles the server will support (Max 140) --> <maxvehicles>100</maxvehicles> <!-- Password clients will have to enter to connect --> <!-- password>None</password --> <!-- Add the server to the master list --> <listed>true</listed> <!-- The hostname players will see --> <hostname>IV:MP Server</hostname> <!-- The address the server will bind to --> <!-- hostaddress>127.0.0.1</hostaddress --> <!-- Toggles frequently called events which has impact on CPU usage --> <frequentevents>false</frequentevents> <!-- The scripts the server will load and run --> <script>cp.nut</script> <script>whisper.nut</script> <script>namecheck.nut</script> <script>runcode.nut</script> <!-- The modules the server will load and run --> <!-- For windows: --> <!-- module>Sample.dll</module --> <!-- For linux: --> <!-- module>Sample.so</module --> </settings>
-
^^^ That's not the exact value being put into the start of the file and so your code cannot match it to replace it. You are missing some double-quotes around the 1.0. I've just checked there and it definitely isn't putting double quotes around the version attribute of that. I looked at the raw version and it was "<?xml version=1.0?>" Here is my entire function: function verify_xml($server_id) { global $Class; if(!$Class['Servers']->is_valid($server_id)) return 0; $Server = $Class['MySQL']->fetch_data("SELECT * FROM atom_servers WHERE Server_ID = '{$Class['MySQL']->escape_string($server_id)}'"); $Product = $Class['MySQL']->fetch_data("SELECT * FROM atom_products WHERE Product_ID = '{$Server['Server_Product']}'"); $server_machine = $Class['Servers']->fetch_value($Server['Server_ID'], "Server_Machine"); $remote_machine = new Machines_Module($server_machine, ROOT); $File = "/home/".$Server['Server_ID']."/".$Product['Product_Config']; $XMLConfig = simplexml_load_string($remote_machine->read_file($File)); //if(!$XMLConfig) $XMLConfig = simplexml_load_string($Product['Product_DefConfig']); if($XMLConfig->maxplayers > $Server['Server_Slots']) { $XMLConfig->maxplayers = $Server['Server_Slots']; } if($XMLConfig->port != $Server['Server_Port'] || $XMLConfig->port != $Server['Server_Port2']) { $XMLConfig->port = $Server['Server_Port']; } $new_config = str_replace("<?xml version=1.0?>", "", $XMLConfig->asXML( )); $remote_machine->run_command("cd /home/{$Server['Server_ID']} && echo \"{$new_config}\" > {$Product['Product_Config']}"); return 1; }