Jump to content

ksmatthews

Members
  • Posts

    97
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ksmatthews's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi All, I need to update our local Mysql DB server with data from the live server on a daily basis ... The simplest approach is to use the mysqldump utility on the live server to create a dump file and then to import that dump file locally. This can be done using a simple shell script. I could also go down the road of database replication using master - slave. There are many articles on how to best do this ... Basically we have 2 DB server - the local one needs to be kept in sync with the live one ... What is the best way to do this ? regards, Steven M
  2. Hi All, I usually use apache virtual domains for all web development. Today however I have enabled 'user web pages' using the following directive UserDir public_html and by enabling mods-available/userdir.conf. After re-starting apache I can now access web pages in my home dir using for example ... http://localhost/~steven/test/myfile.html UNFORTUNATELY I cannot run any php scripts like ... http://localhost/~stevenm/test/index.php only the plain non - interpreted text is displayed but running php in my virtual domains works OK. Why is my PHP not working for localhost ? regards, Steven M
  3. HI There, I am using this type of code to self load a submitted form <form name = "testform" method = "post" action = "<?=$_SERVER['PHP_SELF']?>" onsubmit = "return check_data()" > Apart from using $_SERVER['PHP_SELF'] is there another way of determining the current URL within a script ? regards, Steven Matthews
  4. I want to create 2 select menus - one static (Menu 1) and the other (Menu 2) populated according to the selection made in Menu 1. Data will will be pulled from a CSV file. Menu 2 will not have any values in it until an option from Menu 1 has been selected. Then, the options available will be limited based on the Item 1 selection. PHP must be used to read the CSV file and to capture the data (using arrays) I met this problem before and my approach then was to call a function using the onChange event for Menu1 ... <script type = "text/javascript">function update_select(obj){ window.location.href="./call_stats_main.php?choice=" + obj.value;} </script> onchange="update_select(this) This would reload the page passing a parameter to the URL (?choice=) I could then use $_GET['choice'] to capture the selected value and dynamically populate Menu 2 according to this value. It is the onchange event that triggers the population of menu 2. I would like to know IF THERE IS A BETTER WAY, other than using ajax ? Steven M
  5. Try http://mysite/index.php/products/create !
  6. yes of course ... I am using virtual apache hosts Steven m
  7. HI All, I can no longer run my web apps ! When I try to run them in Firefox I simply get a prompt to download the files … I installed openvpn last night and ever since I have had this problem … I checked the files in /etc/apache2 and they were modified but I cannot figure out how. Certainly php has been turned off somewhere. Interestingly, I can run php5 as a binary from the command line – php5 is most certainly installed. More info … file /etc/apache2/mods-enabled/php5.load reads ... LoadModule php5_module /usr/lib/apache2/modules/libphp5.so I have restarted apache2 but to no avail … help ! What do you advise ? Steven Matthews
  8. Hi THere, They say that from a security standpoint, we should not implement root-level commands in a web interface .... I was involved in the creation of a web based front end for a third party telephony system (*Asterisk) running on linux. Here are some code snippets ... if(strstr($ID, 'dhcp')) { if($ID == 'dhcp_1') // DHCP $command = '/usr/bin/sudo /usr/sbin/rcdhcpd start'; // /etc/init.d/dhcpd GENERIC else if($ID == 'dhcp_2') $command = '/usr/bin/sudo /usr/sbin/rcdhcpd stop'; else $command = '/usr/bin/sudo /usr/sbin/rcdhcpd restart'; // run command exec($command); // run status check exec('/usr/bin/sudo /usr/sbin/rcdhcpd status', $output, $return_var); } // another snippet $command = 'rm -rf ' . $temp_folder; exec($command); // write to socket (authentication) if($socket) { fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: " . ASTERISK_UNAME . "\r\n"); fputs($socket, "Secret: " . ASTERISK_SECRET . "\r\n"); fputs($socket, "Events: off\r\n\r\n"); // loop through output from Asterisk $authentication_flag = false; while ($buf = fread($socket, 512)) { if(feof($socket)) break; if(strstr($buf, "Response: Success")) { $authentication_flag = true; break; } if(strstr($buf, "END COMMAND")) break; } if($authentication_flag == false) { echo 'No Asterisk !'; die(); } } Is this code poor practice ? If so, then I would be curious to know how web hosting companies provide web front ends to their linux based web hosts. Surely they too must be running root commands using sudo .... Any ideas ? regards, Steven Matthews
  9. <div class="dataContent" id="content_csvOutput_statement"> <textarea class="csvOutput">{CSV_OUTPUT}</textarea> </div> Steven M
  10. $arrTags['CSV_OUTPUT'] = implode("\n", $arrCsv); Note: $arrTags['CSV_OUTPUT'] is added to a text area control WITHIN a template I HAVE EVEN TRIED EXPLICITLY ADDING A '\n' BUT TO NO AVAIL ....
  11. Should get this ... 08-07-2010,277,CLICKATELL,CLICKATELL_June_Oct_09,GBP,33179.70,0.00,33179.70,Paid on 10/02/2010 08-07-2010,182,IPX,IPX_Jul09_23852,EUR,1654.55,0.00,1654.55,Paid on 02/12/2009 10-06-2010,406,NETM,07091486,EUR,721.17,0.00,721.17,Paid on 24/03/2010 08-04-2010,342,COMEXME,Comexme_July09 - Dec09,USD,2131.11,0.00,2131.11,Paid on 08/04/2010 But I get this ... 08-07-2010,277,CLICKATELL,CLICKATELL_June_Oct_09,GBP,33179.70,0.00,33179.70,Paid on 10/02/201008-07-2010,182,IPX,IPX_Jul09_23852,EUR,1654.55,0.00,1654.55,Paid on 02/12/200910-06-2010,406,NETM,07091486,EUR,721.17,0.00,721.17,Paid on 24/03/201008-04-2010,342,COMEXME,Comexme_July09 - Dec09,USD,2131.11,0.00,2131.11,Paid on 08/04/2010 WHY ? Is this a CSS issue ? Steven M
  12. Hi All, I am having problems writing to the textarea HTML object. Basically I am losing my new line char and the text looks awful and unintelligible. How can I get my new lines appended at the end so that each line is separate. Here is some code ... Creating EACH data line: $arrCsvRow = array( $arrTags['DATE_UPLOADED'], $arrTags['SCAN_NUMBER'], $arrTags['OPERATOR'], $arrTags['REFERENCE'], $arrTags['CURRENCY'], $arrTags['GOODS'], $arrTags['VAT'], $arrTags['TOTAL'], $arrTags['PAID_TITLE'] ); $arrCsv[] = implode(',', $arrCsvRow); etc .... Dumping it all at the end ... $arrTags['CSV_OUTPUT'] = implode("\n", $arrCsv); Note: $arrTags['CSV_OUTPUT'] is added to a text area control WITHIN a template Any advice appreciated, regards, ksmatthews
  13. Hi All, I am running a CLI script written in PHP to execute a remote web service. THe service calls a method 'GetUKLocationByCounty($param)' which returns XML. I keep getting an error when I pass a string to this method, as required. Here is part of the code ... $client = new SoapClient('http://www.webservicex.net /uklocation.asmx?wsdl', array('trace' => 1 )); // call method $response = $client->GetUKLocationByCounty('Cornwall'); // get last soap response echo $client->__getLastResponse(); The web service can be found at : http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=28 RESULT: PHP Fatal error: Uncaught SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or function 'GetUKLocationByCounty' expects parameter '@County', which was not supplied. at WebServicex.UKLocation.GetUKLocationByCounty(String County) --- End of inner exception stack trace --- in /home/steven/public_html/XML-load/soap_test2.php:16 Any ideas ? regards, Steven Matthews
  14. Hi All, I am running a CLI script written in PHP to execute a remote web service. The service calls a method 'GetUKLocationByCounty($param)' which returns XML. I keep getting an error when I pass a string to this method, as required. Here is part of the code ... $client = new SoapClient('http://www.webservicex.net /uklocation.asmx?wsdl', array('trace' => 1 )); // call method $response = $client->GetUKLocationByCounty('Cornwall'); // get last soap response echo $client->__getLastResponse(); The web service can be found at : http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=28 RESULT: PHP Fatal error: Uncaught SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or function 'GetUKLocationByCounty' expects parameter '@County', which was not supplied. at WebServicex.UKLocation.GetUKLocationByCounty(String County) --- End of inner exception stack trace --- in /home/steven/public_html/XML-load/soap_test2.php:16 Any ideas ? regards, Steven Matthews :'(
  15. HI, The page itself is divided into tabs (3 sections each with a clickable 'tab' at the top, a CSS feature). I am not referring to browser tabs ! I am using the jquery framework, Steven M
×
×
  • 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.