Jump to content

ChrisMartino

Members
  • Posts

    285
  • Joined

  • Last visited

    Never

Everything posted by ChrisMartino

  1. 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!
  2. 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?
  3. 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?
  4. 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!
  5. 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
  6. 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.
  7. 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!
  8. 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!
  9. 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.
  10. 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.
  11. 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!
  12. 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
  13. 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>
  14. ^^^ 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; }
  15. A) When I try to edit the file again upon that being added to the file I'm prompted with the following errors from PHP: Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : String not started expecting ' or " in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=1.0?> in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Malformed declaration expecting version in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=1.0?> in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Blank needed here in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=1.0?> in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : parsing XML declaration: '?>' expected in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=1.0?> in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 38 Fatal error: Call to undefined method stdClass::asXML() in /home/atomnetw/public_html/Atom-Host.com/Modules/Module-Config.php on line 52 B) I've tried by doing the following with the edited string: $new_config = str_replace("<?xml version=1.0?>", "", $XMLConfig->asXML( )); But for some reason it still appears in the file after reading. Thanks for your response.
  16. Hey there, I'm having a issue when I edit the XML file from a string here. Now the SimpleXML functions edit the nodes of the XML file perfectly and everything is done the way I want but upon returning the file to a string it keeps putting a XML content type at the top of the file, E.G: Before XML File Is Edited: <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> After XML File Is Edited <?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> Notice the addition to the header of the file "<?xml version=1.0?>". This is causing issues when the XML file is read by the server. Could anybody help me stop the SimpleXML editor from placing this in the header of the file? Thanks.
  17. Hey there, Thanks for taking the time to read my thread. I've encountered a problem that I cannot figure out a way to solve. I need to calculate the remaining days until a specified unix timestamp. I haven't yet figured out how to get the amount of days until the timestamp. If anybody could tell me how to get the remaining days until a unix timestamp I would be grateful, thanks.
  18. Ha! Yes it was exactly as you say. It wasn't actually even that function call that was causing the error. I was calling the query function immediately after the call of that function and there was a error in my MySQL syntax, thus causing the error I was experiencing.
  19. I've tried multiple times but mysql_error doesn't even return any error: mysql_query("SELECT * FROM xhost_accounts WHERE (account_username = '{$Module['MySQL']->Escape($AccountUsername)}' OR account_email = '{$Module['MySQL']->Escape($AccountUsername)}') AND account_password = MD5('{$AccountPassword}')") or die(mysql_error());
  20. Hello there, I'm having a issue where when I run the following statement: $Session = $Module['MySQL']->RowCount("SELECT * FROM xhost_accounts WHERE (account_username = '{$Module['MySQL']->Escape($AccountUsername)}' OR account_email = '{$Module['MySQL']->Escape($AccountUsername)}') AND account_password = MD5('{$AccountPassword}')") == 1 ? true:false; I am proceeded by the following error: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\Backend\MySQL-Module.php on line 49 Yet when I do the following statement: echo $Module['MySQL']->RowCount("SELECT * FROM xhost_accounts WHERE (account_username = '{$Module['MySQL']->Escape($AccountUsername)}' OR account_email = '{$Module['MySQL']->Escape($AccountUsername)}') AND account_password = MD5('{$AccountPassword}')") It gives me the output of 2 (That's the correct table row count)? Does anybody have any insight into why this could be happening thanks.
  21. Hello there, I have a issue. My issue is that I parse PHP code executed by people via a command like so !php echo("hello there"); would output "hello there". Here is my command: case ':!php': $message = ""; for($i=4; $i <= (count($this->ex)); $i++) { $message .= $this->ex[$i]." "; } ob_start(); @eval($message); $output = ob_get_contents(); fputs($this->socket,"PRIVMSG #volt :{$output}\r\n"); ob_end_flush(); break; $message contains the code to be executed. But the problem is it won't return more than one line. I really want it to be able to output multiple lights from eval E.G if someone where to output a item that is split up into multiple lines. Does anybody know how to accomplish this?
  22. Hello there, I've come across a issue with using PHP's mail function due to the fact I've tried a assortment of different headers yet Hotmail continues to place my sent emails in the junk folder. Here is my method of emailing my clients: function Email($AccountID, $Subject, $Message) { if($this->IsValidAccount($AccountID)) { $Account = $this->AccountKeys($AccountID); $headers .= 'To: '.$Account['account_client'].' <'.$Account['account_email'].'>' . "\r\n"; $headers .= "From: X-Host <no-reply@X-Host.co.uk>\r\n"; $headers .= "Reply-To: X-Host <no-reply@X-Host.co.uk>\r\n"; $headers .= "Return-Path: no-reply@X-Host.co.uk\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Organization: X-Host\r\n"; echo $Account['account_email']. $Subject. $Message; return mail($Account['account_email'], $Subject, $Message, $headers); } else return InvalidAccount; } So could anybody help me out please and tell me what headers I should be using.
  23. Hello there, Thank you for taking the time to visit my thread. I've been brainstorming for the past few days trying to establish the best method of a content management system. I'm curious since you are all highly advanced PHP coders what you think the best method of content management is I would like it to be presented in the URL in the following method: file.php?v=example So please share your ideas remember there is never a stupid suggestion I want to hear all your possibilities please!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.