-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
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."; } ?>
-
[SOLVED] dynamic date tracker for blog posts
JonnoTheDev replied to Lambneck's topic in PHP Coding Help
Yes. Finish it off. Use the array to construct the time. -
username/pwd protection without database?
JonnoTheDev replied to gangsterwanster1's topic in PHP Coding Help
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"; } } ?> -
[SOLVED] dynamic date tracker for blog posts
JonnoTheDev replied to Lambneck's topic in PHP Coding Help
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>"; ?> -
This array value must not contain any data: $_POST['xml']; Check your form is correct.
-
username/pwd protection without database?
JonnoTheDev replied to gangsterwanster1's topic in PHP Coding Help
You can protect your web folder using a .htaccess document and htpasswd -
Bad Syntax $dom->loadXML('$post'); Corrected $dom->loadXML($post); Variables enclosed in single quotes are treated as a string.
-
ppt slides display on webpagePosted: Tue May 26, 2009 11:02 am
JonnoTheDev replied to ibcravi's topic in PHP Coding Help
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. -
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
-
mail(encrypted data) by default on secure site?
JonnoTheDev replied to andbria1's topic in Other Web Server Software
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 -
[SOLVED] mail(encrypted data) by default on secure site?
JonnoTheDev replied to andbria1's topic in PHP Coding Help
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 -
[SOLVED] dynamic date tracker for blog posts
JonnoTheDev replied to Lambneck's topic in PHP Coding Help
Look at the php function manual examples for date / time differences http://uk2.php.net/manual/en/function.date.php -
[SOLVED] dynamic date tracker for blog posts
JonnoTheDev replied to Lambneck's topic in PHP Coding Help
correct -
[SOLVED] dynamic date tracker for blog posts
JonnoTheDev replied to Lambneck's topic in PHP Coding Help
There you go. gevans has given some basic code. Just turn it into a function i.e. function postTime($time) { return $string; } -
[SOLVED] dynamic date tracker for blog posts
JonnoTheDev replied to Lambneck's topic in PHP Coding Help
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 -
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.
-
Does it really matter?
-
Launch file in background and then redirect page
JonnoTheDev replied to everisk's topic in PHP Coding Help
It will work, just checkout the php manual pages for exec -
Making major table alterations; how to protect data?
JonnoTheDev replied to Benmcfc's topic in MySQL Help
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. -
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()); }
-
Why do you have Arsenal & Barca as your avatar. Where you at the 2006 Champions League final?
-
Ran Out Of Memory - How Can I Recreate This?
JonnoTheDev replied to refiking's topic in PHP Coding Help
Give the script more memory. ini_set('memory_limit', '64M'); -
Doesn't make sense, please explain.
-
Launch file in background and then redirect page
JonnoTheDev replied to everisk's topic in PHP Coding Help
By forking it as a background process. exec("php /path/to/script.php > /dev/null &"); header("Location:file.php"); exit(); -
$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