Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Why have you not written a test program prior to using a form to check that your XML is valid? Start with a fixed variable holding the XML and then debug from there. Your XML is probably bad. Simple debugging. Have you read the DOMDocument class documentation in the php manual? http://uk2.php.net/manual/en/class.domdocument.php Here is a start: <?php // xml to be loaded $xml = "<root><node/></root>"; if(!$document = @DOMDocument::loadXML($xml)) { print "The XML is not valid."; } else { print "XML valid."; } ?>
  2. Yes. Finish it off. Use the array to construct the time.
  3. Hard code it in You need to place the code above any html (before anything is outputted to the screen) not below <?php if($_POST['Submit'] == 'Login') { if($_POST['myusername'] == "joe" && $_POST['mypassword'] == "bloggs") { // logged in // may want to store a session here // redirect header("Location:members.php"); exit(); } else { print "Invalid login"; } } ?>
  4. No, miles off and those functions wont work! Use this example and try to learn the date & time functions from the php manual <?php function timeDiff($time1) { $time2 = time(); $diff = array('years' => 0, 'months' => 0, 'weeks' => 0, 'days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' => 0); foreach(array('years','months','weeks','days','hours','minutes','seconds') as $unit) { while(true) { $next = strtotime("+1 $unit", $time1); if($next < $time2) { $time1 = $next; $diff[$unit]++; } else { break; } } } return($diff); } $postTime = strtotime("-2 hours"); $diffArray = timeDiff($postTime); print "<pre>"; print_r($diffArray); print "</pre>"; ?>
  5. This array value must not contain any data: $_POST['xml']; Check your form is correct.
  6. You can protect your web folder using a .htaccess document and htpasswd
  7. Bad Syntax $dom->loadXML('$post'); Corrected $dom->loadXML($post); Variables enclosed in single quotes are treated as a string.
  8. There seems to be lots of windows plugins to powerpoint or little tools for doing this. Not so sure about a server app that could be executed from your code.
  9. No you are on the wrong track. SOAP is a protocol for exchanging data. SOAP can be used to call web services (i.e RPC - Remote Procedure Call) however this is only one of its many uses. A web service is not an exe at all. An example of a web service maybe a weather feed. I can send a request to the weather service server along with parameters for the required days, country, city, etc and a response is returned with data I require. Other popular web services are provided by Amazon, Google, Yahoo, etc Example of what a SOAP request and response may look like: http://www.w3schools.com/SOAP/soap_example.asp
  10. SSL has nothing to do with email. For encrypted email you need something like PGP on your server. Take a look at: http://en.wikipedia.org/wiki/Pretty_Good_Privacy http://www.pantz.org/software/php/pgpemailwithphp.html
  11. SSL has nothing to do with email. For encrypted email you need something like PGP on your server. Take a look at: http://en.wikipedia.org/wiki/Pretty_Good_Privacy http://www.pantz.org/software/php/pgpemailwithphp.html
  12. Look at the php function manual examples for date / time differences http://uk2.php.net/manual/en/function.date.php
  13. There you go. gevans has given some basic code. Just turn it into a function i.e. function postTime($time) { return $string; }
  14. Of Course. You can write a function to display the date from the database record. You should record as a datetime or a unix timestamp
  15. This happens all the time to our sites. You can tell as the CSS classes and ids are the same names. The only issue is when someone trys to construct a competitor site using our layout. I don't think that there is a problem with taking the source to copy the layout as long as the content is not taken. I would however change HTML element ids, etc as Google may pick up on this.
  16. Does it really matter?
  17. It will work, just checkout the php manual pages for exec
  18. No, a varchar will not convert into a date type. I would add the new date field and use a script to convert the varchar version and update the date field. Then you can remove the varchar field containing the dates.
  19. You have an error in your query hence no database resource being returned. I can see it straight away: Bad $result = mysql_query("SELECT* from tble where id = 1"); Good $result = mysql_query("SELECT * FROM tble WHERE id = '1'"); You should also catch query errors i.e. if(!$result = mysql_query("SELECT * FROM tble WHERE id = '1'")) { die(mysql_error()); }
  20. Why do you have Arsenal & Barca as your avatar. Where you at the 2006 Champions League final?
  21. Give the script more memory. ini_set('memory_limit', '64M');
  22. Doesn't make sense, please explain.
  23. By forking it as a background process. exec("php /path/to/script.php > /dev/null &"); header("Location:file.php"); exit();
  24. $ext = strtolower(strrchr($_FILES['fieldname']['name'], ".")); $ext = substr($ext, 1); $accepted = array('ppt', 'jpeg', 'jpg'); if(!in_array($ext, $accepted)) { print "Invalid file type"; } Make sure you edit $_FILES['fieldname'] to the name of your form field
×
×
  • 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.