php-general Digest 22 Nov 2007 15:05:38 -0000 Issue 5142
php-general Digest 22 Nov 2007 15:05:38 - Issue 5142 Topics (messages 264954 through 264964): Re: Basic question - PHP usage of SVG files 264954 by: Larry Garfield image galleries 264955 by: Lisa A 264958 by: Colin Guthrie Re: Should I put pictures into a database? 264956 by: Lester Caine 264957 by: Robert Cummings getenv ... i think 264959 by: Steven Macintyre 264961 by: M. Sokolewicz 264962 by: Per Jessen imap_search - criterion ON 264960 by: Max Frigge 264963 by: Zoltán Németh Re: Code Critique Please :) 264964 by: Per Jessen Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- On Wednesday 21 November 2007, Dave M G wrote: Larry, Thank you for responding. I think you missed the point. SVG is just text. ... There's no need for SVG support per se, as SimpleXML provides all you need anyway. I did miss the point - thanks for setting me straight. However, I'm still unsure about using SVGs. On the one hand, what I'm using as source files are originally in SVG format and I want to be able to dynamically resize and scale them without loss of clarity. That sounds like an excellent reason to use SVG for your image manipulation. But, after they have been resized and scaled, then I think I need to send the resulting image to the browser in some raster image format. Indications are that SVG support on browsers is still not as uniform as PNG or other raster graphics formats. Yeah, Firefox is the only browser I know of with native SVG support worth a damn. Konqueror keeps talking about it but I don't know if it's any good yet. Not sure about Opera or Safari. IE requires a plugin from Adobe, which the last time I was playing with it (which has been a while, but there were no signs of plans to improve it at the time) was OK, but not great and embedded a la flash in a fixed, immutable box. At that last step, assuming that I have manipulated the images to my satisfaction with SimpleXML, can I then output the result in PNG or JPG with PHP? With native PHP, I don't believe so. However, I know that there are assorted command line tools and Java tools to do so. I naturally can't think of them off the top of my head, but I know they exist. You could exec() out to them to cache the rasterized combined image to disk and then serve that. I don't know off hand if there's a PECL module or some user-space PHP code to do that. It's worth spending 10 min Googling it, though. I'm not so sure this can be done. The tricky part is that I am building PHP scripts that could be deployed on servers with different PHP settings, so I'm not confident that I can rely on PEAR or ImageMagick functions being present. Are they standard on PHP 5? Now that could be a problem. You'd have to find either some PHP user-space library or a CLI C library that you could bundle with the app. I'm fairly certain nothing like that is in stock PHP 5. As for finding a good such library, as I said Google would know better than I. (Or maybe I should say Yahoo, since they use PHP. g) Forgive me if my questions are clueless to the point of making the questions unclear. They make a lot more sense now, actually. :-) -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson ---End Message--- ---BeginMessage--- Does anyone know of an image gallery I can use on multiple pages of a website. I'd like to be able to click on the thumbnails and see a larger image. Hopefully something simple and easy to install. thanks, Lisa A ---End Message--- ---BeginMessage--- Lisa A wrote: Does anyone know of an image gallery I can use on multiple pages of a website. I'd like to be able to click on the thumbnails and see a larger image. Hopefully something simple and easy to install. There is Gallery 2, http://gallery.menalto.com/ but that's a bit heavy weight perhaps for your needs. Something involving Lightbox or perhaps a JQuery based system woudl be nice and lightweight fro the client end (they are javascript systems for displaying larger images from thumbnails nicely) and just doing your own lightweight PHP backend is a good soltuion. Col ---End Message--- ---BeginMessage--- Michael McGlothlin wrote: I use a custom file system that caches large amounts of
php-general Digest 23 Nov 2007 07:12:11 -0000 Issue 5143
php-general Digest 23 Nov 2007 07:12:11 - Issue 5143 Topics (messages 264965 through 264980): Re: Code Critique Please :) 264965 by: Simeon F. Willbanks 264968 by: Oscar Gosdinski 264969 by: Robert Cummings Question about urlencode 264966 by: Colin Guthrie 264978 by: TG Logic Help please 264967 by: Mohamed Jama 264971 by: Richard Heyes Re: getenv ... i think 264970 by: Andrés Robinet Parsing XML with DTD 264972 by: Skip Evans 264973 by: Per Jessen 264974 by: Jochem Maas 264975 by: Skip Evans 264976 by: Andrés Robinet Re: image galleries 264977 by: Martin Marques Re: PHP + Amazon to retrieve book data 264979 by: Dan Joseph Page not displayed/Forbidden on PHP forms 264980 by: Jeffrey Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- No I did not, thanks! For those that need more information, here is a good tutorial: http://en.wikibooks.org/wiki/XML_-_Managing_Data_Exchange/Converting_MySQL_to_XML Simeon On Nov 22, 2007, at 10:05 AM, [EMAIL PROTECTED] wrote: You know that mysql has an output option for producing XML ? /Per Jessen, Zürich ---End Message--- ---BeginMessage--- On Nov 21, 2007 2:05 PM, Simeon F. Willbanks [EMAIL PROTECTED] wrote: 3. Object Oriented principles I see that you tried to implement Singleton pattern in the DB class, but you have a mistake. $dbConnection attribute is not a static member, so every time you call the constructor $dbConnection won't be initialized, so your code will always initialize this attribute. There is something that i always wonder about Singleton pattern in PHP, do you really have a benefit using this pattern in PHP? The idea behind this pattern is that only one instance of the class is created, it works great in Java because all requests are processed inside a JVM and this instance created will really be the only one defined. Because in PHP every request has its own environment, you will have several instances of this class per request processed. 4. Strategy Design Pattern - Interface used for column attribute parsing I've checked the code in MySQLToXML.phps and i see a lot of ParseDatabaseColumnAttributeXXX classes that implements ParseDatabaseColumnAttribute interface. I think that those classes should be methods of a DatabaseColumnAttributeParser instead of defining so many classes. Also the names of those classes suggest me that they are methods not objects. -- Saludos Oscar ---End Message--- ---BeginMessage--- On Thu, 2007-11-22 at 12:46 -0500, Oscar Gosdinski wrote: There is something that i always wonder about Singleton pattern in PHP, do you really have a benefit using this pattern in PHP? The idea behind this pattern is that only one instance of the class is created, it works great in Java because all requests are processed inside a JVM and this instance created will really be the only one defined. Because in PHP every request has its own environment, you will have several instances of this class per request processed. Doesn't matter... you may have multiple requests for the object within the same HTTP request. Singleton pattern is very valid in PHP. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... ---End Message--- ---BeginMessage--- Hi, OK this one is a little embarrasing. I've been doing this for years and I just wonder if I'm wrong Say you have an exit link on your site, e.g. /leave.php, which accepts a url get arg. You use this page to record stats/whatever and then issue a Location: header to take the user to the correct location. Fairly standard yeah? Well I've been doing something like: $url = 'http://colin.guthr.ie/'; echo 'a href=/leave.php?url='.urlencode($url).'Click/a'; The logic in /leave.php does not need to call urldecode as it's done automatically by PHP. This has worked well for me in the browsers I've used (IE, FF etc.) Recently, though, when using google webmaster tools I noticed that I was getting a lot of 404's and this ultimately stemmed from the double urlencoding of these url paramaters whereby the % signs used to encode characters like / as %2F were encoded themselves leading to %252F. PHP would automatically urldecode this to %2F but that still leaves me with an encoded variable. Ugg. So my question is, is the google bot just getting it wrong? Is it reading the link and seeing a % and encoding it? Or is it finding a page somewhere randomly on the interweb which has incorrectly double encoded it and going from there? It
[PHP] Re: image galleries
Lisa A wrote: Does anyone know of an image gallery I can use on multiple pages of a website. I'd like to be able to click on the thumbnails and see a larger image. Hopefully something simple and easy to install. There is Gallery 2, http://gallery.menalto.com/ but that's a bit heavy weight perhaps for your needs. Something involving Lightbox or perhaps a JQuery based system woudl be nice and lightweight fro the client end (they are javascript systems for displaying larger images from thumbnails nicely) and just doing your own lightweight PHP backend is a good soltuion. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getenv ... i think
Hi all, http://steven.macintyre.name/myscript.phps is my code as it stands The purpose of the code is as follows; Its for a non-profit company - wanting to offer support banners for users who pay for them right ... as in donation. They want to be able to restrict those banners to a certain period the bought period and I want to restrict them to only access the banners from the specified URL when they signed up. IE ... if you signed up with http://www.yourlovelydomain.com i want to be able to limit the display of these banners depending on the hash and somehow - checking the domain its coming from Any ideas - am i on the right track ? If i take OUT the getenv if then, it works ... so i know that is where the problem is. S -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap_search - criterion ON
Hey there, i am trying to use the imap_search function oh PHP. In the documentation it says i can use ON to search for a date. Whenever i try that I get: Unknown search criterion: ON Which is wired because ON is even mentioned in the IMAP2 criteria?!? Any ideas what's wrong? Greets, Max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getenv ... i think
Steven Macintyre wrote: Hi all, http://steven.macintyre.name/myscript.phps is my code as it stands The purpose of the code is as follows; Its for a non-profit company - wanting to offer support banners for users who pay for them right ... as in donation. They want to be able to restrict those banners to a certain period the bought period and I want to restrict them to only access the banners from the specified URL when they signed up. IE ... if you signed up with http://www.yourlovelydomain.com i want to be able to limit the display of these banners depending on the hash and somehow - checking the domain its coming from Any ideas - am i on the right track ? If i take OUT the getenv if then, it works ... so i know that is where the problem is. S First of all, be VERY MINDFUL of SQL-injection attacks. Right now your code is *very* vulnerable. Now, your problem is exactly as you stated: you don't get the data in the expected format. getenv (REMOTE_HOST) is NOT the referrer. Furthermore, the referrer (which I don't recall what it is sent as exactly, as 'REFERER' I guess (usually gotten via $_SERVER or $_ENV, but getenv() should also work)) is not 'just' the domain name but also includes the path, so you have a huge chance that it won't be exactly what you expect it to be. Parse the url (parse_url() is your friend), extract the host and match against that. - Tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getenv ... i think
Steven Macintyre wrote: If i take OUT the getenv if then, it works ... so i know that is where the problem is. I didnt bother with reading all your code, but maybe you should use $_SERVER['REMOTE_HOST'] instead of the getenv() call ? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_search - criterion ON
2007. 11. 22, csütörtök keltezéssel 21.15-kor Max Frigge ezt írta: Hey there, i am trying to use the imap_search function oh PHP. In the documentation it says i can use ON to search for a date. Whenever i try that I get: Unknown search criterion: ON Which is wired because ON is even mentioned in the IMAP2 criteria?!? yep, ON is correct according to rfc3501 (IMAPv4rev1) Any ideas what's wrong? the problem is probably with the imap server. maybe it is not rfc compliant or something. greets Zoltán Németh Greets, Max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Critique Please :)
Simeon F. Willbanks wrote: Hello, I am trying to increase my knowledge and understanding of OO and OO Design Patterns. I'd like to request a critique of a program that extracts MySQL table information and translates it into XML. You know that mysql has an output option for producing XML ? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Critique Please :)
No I did not, thanks! For those that need more information, here is a good tutorial: http://en.wikibooks.org/wiki/XML_-_Managing_Data_Exchange/Converting_MySQL_to_XML Simeon On Nov 22, 2007, at 10:05 AM, [EMAIL PROTECTED] wrote: You know that mysql has an output option for producing XML ? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about urlencode....
Hi, OK this one is a little embarrasing. I've been doing this for years and I just wonder if I'm wrong Say you have an exit link on your site, e.g. /leave.php, which accepts a url get arg. You use this page to record stats/whatever and then issue a Location: header to take the user to the correct location. Fairly standard yeah? Well I've been doing something like: $url = 'http://colin.guthr.ie/'; echo 'a href=/leave.php?url='.urlencode($url).'Click/a'; The logic in /leave.php does not need to call urldecode as it's done automatically by PHP. This has worked well for me in the browsers I've used (IE, FF etc.) Recently, though, when using google webmaster tools I noticed that I was getting a lot of 404's and this ultimately stemmed from the double urlencoding of these url paramaters whereby the % signs used to encode characters like / as %2F were encoded themselves leading to %252F. PHP would automatically urldecode this to %2F but that still leaves me with an encoded variable. Ugg. So my question is, is the google bot just getting it wrong? Is it reading the link and seeing a % and encoding it? Or is it finding a page somewhere randomly on the interweb which has incorrectly double encoded it and going from there? It doesn't give you an referrer info which makes tracking down such errors pretty tricky :( I could just call urldecode manually, but I'm curious as to why I should need to. Anyone fought with this before? Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Logic Help please
Hi, I am doing an online calendar for holiday application. Now I got a table with these fields among many others. `req_id` int(11) NOT NULL auto_increment, `req_date` date NOT NULL, `username` varchar(100) NOT NULL, `start_date` date NOT NULL, `end_date` date NOT NULL, `days_off` int(11) NOT NULL, With start_date is something like [ 1 - 10 - 2007 ] and end_date is like [ 20 - 10 -2007 ]. I am thinking whats the best way to present such data ? and how to show overlapping days between users ? Thanks very much in advance -Original Message- From: Simeon F. Willbanks [mailto:[EMAIL PROTECTED] Sent: 22 November 2007 15:23 To: php-general@lists.php.net Subject: Re: [PHP] Code Critique Please :) No I did not, thanks! For those that need more information, here is a good tutorial: http://en.wikibooks.org/wiki/XML_-_Managing_Data_Exchange/Converting_MySQL_to_XML Simeon On Nov 22, 2007, at 10:05 AM, [EMAIL PROTECTED] wrote: You know that mysql has an output option for producing XML ? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Critique Please :)
On Nov 21, 2007 2:05 PM, Simeon F. Willbanks [EMAIL PROTECTED] wrote: 3. Object Oriented principles I see that you tried to implement Singleton pattern in the DB class, but you have a mistake. $dbConnection attribute is not a static member, so every time you call the constructor $dbConnection won't be initialized, so your code will always initialize this attribute. There is something that i always wonder about Singleton pattern in PHP, do you really have a benefit using this pattern in PHP? The idea behind this pattern is that only one instance of the class is created, it works great in Java because all requests are processed inside a JVM and this instance created will really be the only one defined. Because in PHP every request has its own environment, you will have several instances of this class per request processed. 4. Strategy Design Pattern - Interface used for column attribute parsing I've checked the code in MySQLToXML.phps and i see a lot of ParseDatabaseColumnAttributeXXX classes that implements ParseDatabaseColumnAttribute interface. I think that those classes should be methods of a DatabaseColumnAttributeParser instead of defining so many classes. Also the names of those classes suggest me that they are methods not objects. -- Saludos Oscar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Critique Please :)
On Thu, 2007-11-22 at 12:46 -0500, Oscar Gosdinski wrote: There is something that i always wonder about Singleton pattern in PHP, do you really have a benefit using this pattern in PHP? The idea behind this pattern is that only one instance of the class is created, it works great in Java because all requests are processed inside a JVM and this instance created will really be the only one defined. Because in PHP every request has its own environment, you will have several instances of this class per request processed. Doesn't matter... you may have multiple requests for the object within the same HTTP request. Singleton pattern is very valid in PHP. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getenv ... i think
-Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Thursday, November 22, 2007 8:08 AM To: php-general@lists.php.net Subject: Re: [PHP] getenv ... i think Steven Macintyre wrote: If i take OUT the getenv if then, it works ... so i know that is where the problem is. I didnt bother with reading all your code, but maybe you should use $_SERVER['REMOTE_HOST'] instead of the getenv() call ? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Maybe this is what you want... take a look (in a syntax highlighting PHP editor): ?php $hash = $_GET['hash']; require_once('db.class.php'); $db = new db_class; $db-connect(); /* You should have an escape method in the db class, otherwise take a look at mysql_real_escape_string - for MySQL Also, beware of magic quotes if they are enabled they can mess things up (not in this case, but as a general hint). I usually put things like these in an .htaccess file. Here's a sample, for a site under construction: php_flag short_open_tag on php_flag register_globals off php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag magic_quotes_sybase off # Switch to off in production stage php_flag display_errors on php_value error_reporting 2039 # This setting depends on you requirements php_value max_execution_time 300 */ $safeHash = $db-escape($hash); /* If your db class doesn't have an escape method you can do $safeHash = mysql_real_escape_string($hash); */ $r = $db-select(SELECT duration, label, website FROM hhcu_codonations where hash = '$safeHash' AND valid = '1'); while ($row=$db-get_row($r)) { // found record - lets see if we can display the image and which image extract ($row); $now = time(); if ($duration = $now) { /* The call on this is as follows; img src=http://mydev.co.za/myscript.php?hash=ARBHASHCODE; border='0' */ $referer = $_SERVER['HTTP_REFERER']; $params = parse_url($referer); // Beware of gotchas if the referer has no www in the host param // We'll add www. to the host if it's not there $host = (substr($params['host'], 0, 4) == 'www.') ? $params['host'] : 'www.'.$params['host']; // Now $host holds something like www.subscribersite.com $refererWebsite = $params['scheme'].'://'.$host.'/'; /* So now, the referer is the expected referer or not You don't need to use MD5 here, you've already checked the hash when you queried the DB. You now need to check that the referer is right for the supplied hash I'm assuming here you are only hashing the website's url. You would only need to check the hash against the request headers if you use a more complex hashing strategy like the following define('HASH_SALT', 'a secret string'); $websiteUrl = 'http://www.subscribersite.com/'; $websiteIP = '60.50.40.30'; $hashToStoreInDB = md5($websiteUrl.$websiteIP.HASH_SALT); But if you use such a method, you wouldn't need to check the referer either, you'd build a tentative hash out of the $_SERVER parameters (HTTP_REFERER, REMOTE_ADDR) and the HASH_SALT constant, match that tentative hash against the supplied hash ($_GET['hash']), and then look up that hash in the database if both hashes match... that would be all */ if ($refererWebsite == $website) { switch ($label) { // ... code to follow } } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Logic Help please
Hi, I am doing an online calendar for holiday application. Now I got a table with these fields among many others. `req_id` int(11) NOT NULL auto_increment, `req_date` date NOT NULL, `username` varchar(100) NOT NULL, `start_date` date NOT NULL, `end_date` date NOT NULL, `days_off` int(11) NOT NULL, With start_date is something like [ 1 - 10 - 2007 ] and end_date is like [ 20 - 10 -2007 ]. I am thinking whats the best way to present such data ? and how to show overlapping days between users ? Something like: Jan Feb 1 2 3 4 1 2 3 4 ... + Richard|o o o o o o o o Fred|x x o o o o o o Mohamed|o o o x x o o o With HTML you could use colours to represent days/weeks off making it more apparent, eg. nothing/white for no holiday booked, and red for one booked. And if you're going to go to the day granularity, an IFRAME might be needed with left/right scrolling. -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing XML with DTD
Hey all, I've been asked if it's possible to parse XML files given a DTD file that describes the elements within it, so I've been looking through the docs at php.net. So far I've found this: http://us.php.net/manual/en/ref.xml.php Which has some samples on, but nothing that I see will take a DTD file and parse the XML accordingly. I'm thinking something like this is probably possible. I'm still looking through the docs, but if anyone can point me in the right direction would be appreciated. Thanks! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX DHTML development framework. http://phpenguin.bigskypenguin.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML with DTD
Hey Jochem all, Thanks much for this tip. I will check it out. A little further reading looks like PEAR provides some XML and DTD capabilities? Anyone have any experience with this? Also, the reason I asked about the DTD is that these XML files are really extensive, providing lots of varied info about literature, history, a whole ton of topics, so I thought parsing the DTD will be necessary to know what kinds of data I'm really looking at. I'll check out Jochem's suggestion now, but would also like to hear if anyone has used PEAR, and also about the need for the DTD for big, complicated XML files. Would it be helpful if I pasted one of the XML files to the list? Thanks again! Skip Jochem Maas wrote: Skip Evans wrote: Hey all, I've been asked if it's possible to parse XML files given a DTD file that describes the elements within it, so I've been looking through the docs at php.net. So far I've found this: http://us.php.net/manual/en/ref.xml.php Which has some samples on, but nothing that I see will take a DTD file and parse the XML accordingly. use php5 and the DOM extension (not XML and not DOMXML): http://us.php.net/manual/en/ref.dom.php I'm thinking something like this is probably possible. I'm still looking through the docs, but if anyone can point me in the right direction would be appreciated. Thanks! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX DHTML development framework. http://phpenguin.bigskypenguin.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML with DTD
Skip Evans wrote: I've been asked if it's possible to parse XML files given a DTD file that describes the elements within it, Yes it is. Which has some samples on, but nothing that I see will take a DTD file and parse the XML accordingly. I'm thinking something like this is probably possible. You don't actually need to DTD to parse it, but it does help with the syntax-check of the contents. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing XML with DTD
Skip Evans wrote: Hey all, I've been asked if it's possible to parse XML files given a DTD file that describes the elements within it, so I've been looking through the docs at php.net. So far I've found this: http://us.php.net/manual/en/ref.xml.php Which has some samples on, but nothing that I see will take a DTD file and parse the XML accordingly. use php5 and the DOM extension (not XML and not DOMXML): http://us.php.net/manual/en/ref.dom.php I'm thinking something like this is probably possible. I'm still looking through the docs, but if anyone can point me in the right direction would be appreciated. Thanks! Skip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing XML with DTD
-Original Message- From: Skip Evans [mailto:[EMAIL PROTECTED] Sent: Thursday, November 22, 2007 5:35 PM To: Jochem Maas Cc: PHP-General Subject: Re: [PHP] Parsing XML with DTD Hey Jochem all, Thanks much for this tip. I will check it out. A little further reading looks like PEAR provides some XML and DTD capabilities? Anyone have any experience with this? Also, the reason I asked about the DTD is that these XML files are really extensive, providing lots of varied info about literature, history, a whole ton of topics, so I thought parsing the DTD will be necessary to know what kinds of data I'm really looking at. I'll check out Jochem's suggestion now, but would also like to hear if anyone has used PEAR, and also about the need for the DTD for big, complicated XML files. Would it be helpful if I pasted one of the XML files to the list? Thanks again! Skip Jochem Maas wrote: Skip Evans wrote: Hey all, I've been asked if it's possible to parse XML files given a DTD file that describes the elements within it, so I've been looking through the docs at php.net. So far I've found this: http://us.php.net/manual/en/ref.xml.php Which has some samples on, but nothing that I see will take a DTD file and parse the XML accordingly. use php5 and the DOM extension (not XML and not DOMXML): http://us.php.net/manual/en/ref.dom.php I'm thinking something like this is probably possible. I'm still looking through the docs, but if anyone can point me in the right direction would be appreciated. Thanks! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX DHTML development framework. http://phpenguin.bigskypenguin.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I believe the DTD would only be helpful to you if you are validating the XML stream yourself... If you only need to know what kind of data you are looking at, you can just grab the doctype property for the DocumentElement and compare it to a set of (known by you) predefined doctypes... After that, you can implement a walk through the elements of the XML stream knowing what you can expect about it. This will simplify your programming logic, unless there are infinite doctypes for the data source in question. For validation, you can use this http://us.php.net/manual/en/function.dom-domdocument-validate.php (only if you are interested in the document being well formed according to the DTD) For identifying the DTD, check the DocumentElement doctype property and the DOMDocumentType class http://us.php.net/manual/en/ref.dom.php. Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image galleries
Lisa A escribió: Does anyone know of an image gallery I can use on multiple pages of a website. I'd like to be able to click on the thumbnails and see a larger image. Hopefully something simple and easy to install. gallery2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about urlencode....
Unless your URL is more complicated than your example, you shouldn't need to use urlencode() at all. You'd need to use it in a case where your string may contain characters that aren't valid in URLs like spaces and such: $baseurl = http://www.somesearchsite.com/search=;; $searchfor = Grace O'Mally; $searchurl = $baseurl . urlencode($searchfor); Since you set your URL explicitly and it's not something entered by a user, you shouldn't need it. Try that and see if it fixes your other problem with double encoding.. or at least gives a better clue as to where it's coming from. Slainte! -TG - Original Message - From: Colin Guthrie [EMAIL PROTECTED] To: php-general@lists.php.net Date: Thu, 22 Nov 2007 16:19:18 + Subject: [PHP] Question about urlencode Hi, OK this one is a little embarrasing. I've been doing this for years and I just wonder if I'm wrong Say you have an exit link on your site, e.g. /leave.php, which accepts a url get arg. You use this page to record stats/whatever and then issue a Location: header to take the user to the correct location. Fairly standard yeah? Well I've been doing something like: $url = 'http://colin.guthr.ie/'; echo 'a href=/leave.php?url='.urlencode($url).'Click/a'; The logic in /leave.php does not need to call urldecode as it's done automatically by PHP. This has worked well for me in the browsers I've used (IE, FF etc.) Recently, though, when using google webmaster tools I noticed that I was getting a lot of 404's and this ultimately stemmed from the double urlencoding of these url paramaters whereby the % signs used to encode characters like / as %2F were encoded themselves leading to %252F. PHP would automatically urldecode this to %2F but that still leaves me with an encoded variable. Ugg. So my question is, is the google bot just getting it wrong? Is it reading the link and seeing a % and encoding it? Or is it finding a page somewhere randomly on the interweb which has incorrectly double encoded it and going from there? It doesn't give you an referrer info which makes tracking down such errors pretty tricky :( I could just call urldecode manually, but I'm curious as to why I should need to. Anyone fought with this before? Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + Amazon to retrieve book data
Hi Scott, This should help: http://hades.phparch.com/ceres/public/article/index.php/art::web_services::php5_soap/2 -Dan Joseph On Nov 21, 2007 7:39 AM, Scott Wilcox [EMAIL PROTECTED] wrote: Hey folks, Does anyone have any resources or links to resources concerning obtaining book data via Amazons web services? Any help/pointers appreciated. Scott. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -Dan Joseph Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Page not displayed/Forbidden on PHP forms
I would check the follwing: - If the problematic host has apache's mod_security enabled. The system administrator can tell you if mod_security is disallowing some of the input (which might cause the 403 forbidden). - PHP.INI parameters max_execution_time, max_input_time and max_input_nesting_level (more info is at the online php manual) you can query these values through ini_get, and you can set them through .htaccess files, e.g. php_value max_execution_time 300 (if the hosting company allows their use). - Call ignore_user_abort at the top of the processing script (CAREFULLY read the notes for that function) and query the value returned by connection_status, or connection_aborted (maybe create a log file for the returnded values through successive requests to keep track of any issue) - Check what (cache) headers the server or your processing script is sending to the browser. - Also, if $_REQUEST processing is a time consuming operation and you use ob_start, ob_end_flush, etc you can try flushing the output buffer from time to time (if your programming logic allows for that). Well, this is quite a list... but if they are getting 403 forbidden it might be an issue with the server configuration (such as a highly restricted mod_security configuration), rather than server performance or speed. Hope that helps. Ohh, by the way, if you can send the culprit URL to us for testing it will help a lot (BUT DON'T DO THAT if this is a private system, or a system for which you don't want to get any additional traffic). Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -Original Message- From: Jeffrey [mailto:[EMAIL PROTECTED] Sent: Friday, November 23, 2007 4:12 AM To: php-general@lists.php.net Subject: [PHP] Page not displayed/Forbidden on PHP forms We are running identical web applications with two different hosts. Both are LAMP. With one of hosts, we are having reports of users seeing Page not displayed or 403 Forbidden after submitting forms. These forms are always sending data to the same page from which they started and the problem is not consistent. (ie. sometimes the forms work fine, sometimes they deliver the error). The problem only seems to have occurred with users on IE and mostly who are a significant distance from the server. This does not seem to be occurring at the other host. The problem host is not being responsive about solving the problem (which will cost them our business). Could this be a PHP time-out issue? Something in the PHP settings or is it likely a server issue or something else. Your expertise - as always - is much appreciated! Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Page not displayed/Forbidden on PHP forms
We are running identical web applications with two different hosts. Both are LAMP. With one of hosts, we are having reports of users seeing Page not displayed or 403 Forbidden after submitting forms. These forms are always sending data to the same page from which they started and the problem is not consistent. (ie. sometimes the forms work fine, sometimes they deliver the error). The problem only seems to have occurred with users on IE and mostly who are a significant distance from the server. This does not seem to be occurring at the other host. The problem host is not being responsive about solving the problem (which will cost them our business). Could this be a PHP time-out issue? Something in the PHP settings or is it likely a server issue or something else. Your expertise - as always - is much appreciated! Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php