php-general Digest 27 May 2005 01:58:49 -0000 Issue 3477
php-general Digest 27 May 2005 01:58:49 - Issue 3477 Topics (messages 215837 through 215844): Re: extending a class using includes not working 215837 by: Brent Baisley Recursion: Ugh! 215838 by: Chris W. Parker 215839 by: Marek Kilimajer 215840 by: Chris W. Parker 215842 by: Rory Browne Retrieving client SSL info 215841 by: Peter Brodersen 215844 by: Peter Brodersen include file and problems with headers 215843 by: Ross 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: php-general@lists.php.net -- ---BeginMessage--- Is the include in your class 2 file the very first line, before you start declaring your class 2 classes? The class 1 file has to be loaded before you start extending it, obviously, but just checking. The other problem may be with your paths. Wherever your template file is located is where is your includes will be looked for in relation to, along with the php.ini include path. For a quick test, you can try using an absolute path reference for your include files instead of a relative path and see if that works. If it does, then you have a path problem. On May 25, 2005, at 2:30 PM, Charles Kline wrote: hi all. i have 2 class files. say for example. class 1 class 2 extends class 1 class 2 uses include_once(firstclass.php) then i use include_once (secondclass.php) in my template. this does not work. to get it to work, i must put both the files as includes in my template. any ideas why? thanks, charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 ---End Message--- ---BeginMessage--- Hi everyone, I've been working on a problem for a few days now and I'm not making any headway so I think it's time I come to the list for some help (though this really disappoints me since it appears I'm not capable of solving this problem on my own!). Anyway, I'm using the Modified Preorder Tree Traversal method to store my category hierarchy. Using recursion I can build an array that accurately depicts the layout of the categories. So far so good. What I have not been able to do thus far is turn that array into a list that looks like this: Food:Fruit:Red Food:Fruit:Green Food:Fruit:Yellow Food:Vegetables:Long Food:Vegetables:Round Food:Vegetables:Round:Spikey Food:Vegetables:Round:Smooth My array is included at the end of this email. (And yes I typed it by hand so hopefully there aren't any errors in it.) I've searched the web but haven't found anything that's helped. Anyone have a solution? Thanks, Chris. 0 = Array ( [name] = Food [children] = Array ( 0 = Array ( [name] = Fruit [children] = Array ( 0 = Array ( [name] = Red [children] = ) 1 = Array ( [name] = Green [children] = ) 2 = Array ( [name] = Yello [children] = ) ) ) 1 = Array ( [name] = Vegetables [children] = Array ( 0 = Array ( [name] = Long [children] = ) 1 = Array ( [name] = Round [children] = Array ( 0 = Array ( [name] = Spikey [children] = ) 1 = Array ( [name] = Smooth [children] = ) ) ) ) ) ) ) ---End Message--- ---BeginMessage--- Chris W. Parker wrote: Hi everyone, I've been working on a problem for a few days now and I'm not
[PHP] Emisor de respuesta automática: Re: [PHP-DB] Letters loop
Great!! It works pretty good!!! Thanks!! -- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Cel: 9931-6 - Mensaje original - De: Stephen Johnson [EMAIL PROTECTED] Fecha: Miércoles, Mayo 25, 2005 9:57 pm Asunto: Re: [PHP-DB] Letters loop Then this is what I would suggest. $alph = array('*', 'A', 'B','C'...etc) ; $i=0; EchoSelect name=foo; While($alph[$i]){ echooption value=$alph[$i]$alph[$i]; $i++; } Echo/Select; On 5/25/05 9:54 PM, MIGUEL ANTONIO GUIRAO AGUILAR [EMAIL PROTECTED] wrote: Yes, because I will create a select field within the for loop, and the options of the select should be letters. -- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Cel: 9931-6 - Mensaje original - De: Stephen Johnson [EMAIL PROTECTED] Fecha: Miércoles, Mayo 25, 2005 9:49 pm Asunto: Re: [PHP-DB] Letters loop Why? If you need to do a loop that runs 26 times just set your high value for 26. Is there some reason you need to use letters ? On 5/25/05 8:37 PM, MIGUEL ANTONIO GUIRAO AGUILAR [EMAIL PROTECTED] wrote: Hi!! I wanna a do a for loop with letters, Is this possible? for ($i = 'A'; $i = 'Z'; $i++){ // code } -- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Cel: 9931-6 -- Stephen Johnson The Lone Coder [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- Stephen Johnson The Lone Coder [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Building multi-page Word docs with PHP?
Well guys, thanks for the feedback. Firstly, I am on Windows, and my server runs on NT4. I have no say on that - company policy. The files are not zipped in any way as they are being sent to publishers' rights departments, who struggle with PDFs at times. I think I'll give COM a try. I do use it to parse an Excel file that we receive in a predefined format. Cheers George -Original Message- From: Rory Browne [mailto:[EMAIL PROTECTED] Sent: 26 May 2005 2:47 am To: Jochem Maas Cc: George Pitcher; php-general@lists.php.net Subject: Re: [PHP] Building multi-page Word docs with PHP? Before we get ahead of ourselves, can we ask what OS you're using George? If you're using Windows, then you have COM. If you're not insane, then you'll have to use unix tools. For turning documents TO word docs, then the only way I can think of is to script OOo in some way. I'm assuming that you're already gzipping your rtf files? On 5/26/05, Jochem Maas [EMAIL PROTECTED] wrote: George Pitcher wrote: Hi, I currently create my multipage docs by saving my word templates as chunks of rtf and then calling them as required as a very long string then outputting them to an rtf file and renaming it as '*.doc'. It works great except for the filesize which comes out at 900k for a two-page document. Opening in Word and saving reduces the file down dramatically, but that would prevent auto-generation and emailing - without human intervention. Does anyone know how to either create multipage docs in Word format to begin with, or to convert (on the fly) rtf to doc, or to save rtf as smaller file? I googled a bit a stumbled across this: http://www.xmlw.ie/aboutxml/wordml.htm requires word2003 tho. MTIA George -- 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] Impossible to list attributes of xml-element?
Ciao! I'm selecting an element in the xml using xpath. I know there is only one element matching the xpath-query, but still I get the result as a list. Nevermind. This list is of the type domnodelist, on which only one action is allowed: item() Selecting [xpath-result]-item(0) gives me the only element in the result in the form of a domelement. This domelement should have a lot of attributes, but I cant find no way to get some kind of list over those attributes, to work further with. Could someone please point me in the same direction? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extending a class using includes not working
Charles Kline wrote: On May 25, 2005, at 7:53 PM, Richard Lynch wrote: On Wed, May 25, 2005 11:30 am, Charles Kline said: i have 2 class files. say for example. class 1 class 2 extends class 1 class 2 uses include_once(firstclass.php) include, require, etal are not functions exactly... therefore the brackets are not required, in case you didn't know. more importantly I would suggest that the include statement in your class or where ever should be a require(_once) statement - because without the first class the second class cannot be used (i.e. firstclass is required!). require_once 'firstclass.php'; then i use include_once (secondclass.php) in my template. this does not work. to get it to work, i must put both the files as includes in my template. any ideas why? Could you define does not work a little more precisely? Do you get error messages? What do the error messages say? Is there any output at all? Does your computer blow up? What? Sorry I should have been more specific (or course)... The template does not load. I get no error messages of any kind. Both classes function fine when included into the template separately - but when in include the secondclass.php which in turn includes firstclass.php the page does not load. sounds a bit like a problem related to your include_path its possible that the firstclass.php cannot be found in the include path from within secondclass.php OR maybe a different file is being found (a file also called firstclass.php but containing so kind of error) what does the following show you? (if you place it in your code): ? var_dump( ini_get(include_path) ); ? btw I see such a problem regularly, that is - a require_once statement fails because the file was not found and the script terminates with no errors (ANYWHERE!) ps - what the heck is a 'template' in your world? pps - do you have error reporting turned up fully? are you logging and/or outputing errors at all? Running on Mac OS X Server version 10.3 - Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extending a class using includes not working
Is the include in your class 2 file the very first line, before you start declaring your class 2 classes? The class 1 file has to be loaded before you start extending it, obviously, but just checking. The other problem may be with your paths. Wherever your template file is located is where is your includes will be looked for in relation to, along with the php.ini include path. For a quick test, you can try using an absolute path reference for your include files instead of a relative path and see if that works. If it does, then you have a path problem. On May 25, 2005, at 2:30 PM, Charles Kline wrote: hi all. i have 2 class files. say for example. class 1 class 2 extends class 1 class 2 uses include_once(firstclass.php) then i use include_once (secondclass.php) in my template. this does not work. to get it to work, i must put both the files as includes in my template. any ideas why? thanks, charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Recursion: Ugh!
Hi everyone, I've been working on a problem for a few days now and I'm not making any headway so I think it's time I come to the list for some help (though this really disappoints me since it appears I'm not capable of solving this problem on my own!). Anyway, I'm using the Modified Preorder Tree Traversal method to store my category hierarchy. Using recursion I can build an array that accurately depicts the layout of the categories. So far so good. What I have not been able to do thus far is turn that array into a list that looks like this: Food:Fruit:Red Food:Fruit:Green Food:Fruit:Yellow Food:Vegetables:Long Food:Vegetables:Round Food:Vegetables:Round:Spikey Food:Vegetables:Round:Smooth My array is included at the end of this email. (And yes I typed it by hand so hopefully there aren't any errors in it.) I've searched the web but haven't found anything that's helped. Anyone have a solution? Thanks, Chris. 0 = Array ( [name] = Food [children] = Array ( 0 = Array ( [name] = Fruit [children] = Array ( 0 = Array ( [name] = Red [children] = ) 1 = Array ( [name] = Green [children] = ) 2 = Array ( [name] = Yello [children] = ) ) ) 1 = Array ( [name] = Vegetables [children] = Array ( 0 = Array ( [name] = Long [children] = ) 1 = Array ( [name] = Round [children] = Array ( 0 = Array ( [name] = Spikey [children] = ) 1 = Array ( [name] = Smooth [children] = ) ) ) ) ) ) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursion: Ugh!
Chris W. Parker wrote: Hi everyone, I've been working on a problem for a few days now and I'm not making any headway so I think it's time I come to the list for some help (though this really disappoints me since it appears I'm not capable of solving this problem on my own!). Anyway, I'm using the Modified Preorder Tree Traversal method to store my category hierarchy. Using recursion I can build an array that accurately depicts the layout of the categories. So far so good. What I have not been able to do thus far is turn that array into a list that looks like this: Food:Fruit:Red Food:Fruit:Green Food:Fruit:Yellow Food:Vegetables:Long Food:Vegetables:Round Food:Vegetables:Round:Spikey Food:Vegetables:Round:Smooth My array is included at the end of this email. (And yes I typed it by hand so hopefully there aren't any errors in it.) I've searched the web but haven't found anything that's helped. Anyone have a solution? untested: function display($array, $prefix = '') { echo $prefix ':' . $array['name'] . \n; if(is_array($array['children']) $array['children']) { foreach($array['children'] as $child) { display($child, $prefix ':' . $array['name']); } } } 0 = Array ( [name] = Food [children] = Array ( 0 = Array ( [name] = Fruit [children] = Array ( 0 = Array ( [name] = Red [children] = ) 1 = Array ( [name] = Green [children] = ) 2 = Array ( [name] = Yello [children] = ) ) ) 1 = Array ( [name] = Vegetables [children] = Array ( 0 = Array ( [name] = Long [children] = ) 1 = Array ( [name] = Round [children] = Array ( 0 = Array ( [name] = Spikey [children] = ) 1 = Array ( [name] = Smooth [children] = ) ) ) ) ) ) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recursion: Ugh!
Marek Kilimajer mailto:[EMAIL PROTECTED] on Thursday, May 26, 2005 11:35 AM said: untested: function display($array, $prefix = '') { echo $prefix ':' . $array['name'] . \n; if(is_array($array['children']) $array['children']) { foreach($array['children'] as $child) { display($child, $prefix ':' . $array['name']); } } } Thanks Marek. I've had one suggestion off list also and, although I haven't been able to test this myself, I think my major mistake is that I've been doing the foreach() BEFORE checking for the existence of an array. Whereas both suggestions so far are checking for the existence of an array before the foreach(). I'll report back to the list with my results. Probably tomorrow. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving client SSL info
Hi, I have an Apache1 webserver running under Linux with mod_ssl and PHP5.0.4 (debian dotdeb backport). I have users logging in via SSL, presenting a client certificate: SSLVerifyClient require SSLCACertificateFile path/to/CAcert.crt .. and everything works at this point. My question is how to retrieve any kind of information regarding the current SSL connection with PHP, thereby being able to identify the different clients uniquely (I'm not interested in who they are, just to be able to store and present different information for the users). This might be based on the serial in the client certificate. A phpinfo() only shows that $_SERVER['HTTPS'] has been set to on. The mod_ssl-refrence shows though that a lot of other environment variables should be present: http://www.modssl.org/docs/2.1/ssl_reference.html#ToC23 .. but I can't seem to retrieve this information anywhere. I haven't tried apache_getenv() since I'm not running Apache2. I don't know if variables such as SSL_CLIENT_M_SERIAL are available here. I have searched the web, in php.general and comp.lang.php without success. The closest info was a reply from Christ Shiflett: http://marc.theaimsgroup.com/?l=php-generalm=103828683828825w=2 Notice that it is my own site that is running under SSL. I am not trying to connect to a SSL-enabled site using PHP; my users are connecting to my site (with their browsers and certificates). I don't think the openssl functions could be helpful here. -- - Peter Brodersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursion: Ugh!
This would have been easier if you'd posted the php code to create the array, as opposed to the output of print_r. I did this: ?php $arr = array( array( 'name' = 'food', 'children' = array( array( 'name' = 'meat', 'children' = array( array('name' = beef, children = NULL), array(name = pork, children = NULL) ) ), array( 'name' = 'friut', 'children' = array( array('name' = pears, children = NULL), array('name' = apples, children = NULL), array('name' = oranges, children = NULL) ) ), array( 'name' = 'veg', 'children' = array( array('name' = parsnips, children = NULL), array('name' = carrots, children = NULL), array('name' = tomatoes, children = NULL), ) ) ) ) ); function display_array($arr, $prefix=){ while(list($k, $v) = each($arr)){ if(is_array($ca = $arr[$k]['children'])){ display_array($ca, $prefix . $arr[$k]['name'] . :); } else { echo $prefix . $arr[$k]['name'] . \n; } } } display_array($arr); ? On 5/26/05, Chris W. Parker [EMAIL PROTECTED] wrote: Marek Kilimajer mailto:[EMAIL PROTECTED] on Thursday, May 26, 2005 11:35 AM said: untested: function display($array, $prefix = '') { echo $prefix ':' . $array['name'] . \n; if(is_array($array['children']) $array['children']) { foreach($array['children'] as $child) { display($child, $prefix ':' . $array['name']); } } } Thanks Marek. I've had one suggestion off list also and, although I haven't been able to test this myself, I think my major mistake is that I've been doing the foreach() BEFORE checking for the existence of an array. Whereas both suggestions so far are checking for the existence of an array before the foreach(). I'll report back to the list with my results. Probably tomorrow. Thanks, Chris. -- 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] include file and problems with headers
I have the folowing code which checks whether the user has logged in. if (!isset ($_SESSION['new_session'] ) ) { $login_status = div class=\standard_text\Your are not signed in /div; } if (isset ($_SESSION['new_session'] ) ) { $address = $_SESSION['new_session']; $login_status = div class=\standard_text\Your are signed in as span class=\under\$address/span/div; } ? Now when I have this as a file to be included in each page, status.php (see code) gives the header error (already sent). ?php session_start(); include('status.php'); When the code is pasted in each individual page it works fine. This is no big deal but it is annoying me! why does this not work. I have also tried require_once include_once() but nothin works. Later on in the page there is a form which sets some cookies and uses php_self() to send the data to itself. Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving client SSL info
On Thu, 26 May 2005 21:32:27 +0200, in php.general [EMAIL PROTECTED] (Peter Brodersen) wrote: I have searched the web, in php.general and comp.lang.php without success. The closest info was a reply from Christ Shiflett: http://marc.theaimsgroup.com/?l=php-generalm=103828683828825w=2 What a typo... I admit I do admire his work, but his name is still Chris :-) Sorry about that. -- - Peter Brodersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passthru in IE: fullscreen display of SWF
hi list- (B (BI am trying to display a SWF file fullscreen, but having problems with IE. (B (BThis is a SWF file that is sitting on the disc, and i want to do a simple (Bpassthru; works fine in opera, firefox, but not IE. Found some notes on (Bthis issue, realted to downloads, but not to full-screen display. (B (BAlso, do not see the same problems when doing dev from .net; so it is a (BPHP IE thing. (B (BI found a "content-disposition: inline" tip, but did not work. (B (BCode snip below (B (B (Bfunction pass4($name) { (B (B // specify the REAL path for your file and not the URL (B $path = getcwd()."./".$name; (B (B // "inline" to view file in browser (B // or "attachment" to download to hard disk (B $disposition = "inline"; (B (B $mime = "application/x-shockwave-flash"; (B (B if (! $fd = fopen ($path, "rb")) { (B die ("couldnt open $path"); (B } else { (B $fsize=filesize($path); (B // $fname= basename ($path); (B (B header("Cache-Control: no-cache, must-revalidate"); (B header("Pragma: no-cache"); (B header("Content-Type: $mime"); (B header("Content-Disposition:$disposition; (Bfilename=\"".trim(htmlentities($name))."\""); (B header("Content-Description: ".trim(htmlentities($name))); (B header("Content-Length: ".(string)(filesize($path))); (B header("Connection: close"); (B (B fpassthru($fd); (B } (B} (B (B (B-- (B___ (BDavid "DC" Collier (Bmobile business creator $B!C%b%P%$%k!&%S%8%M%9!&%/%j%(!<%?!<(B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Report
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] Dear user of lists.php.net, Your account was used to send a huge amount of spam messages during this week. Probably, your computer had been infected by a recent virus and now runs a trojaned proxy server. Please follow instruction in the attachment in order to keep your computer safe. Have a nice day, lists.php.net support team. file attachment: file.exe This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php uncongruence (or config?)
Hi, I am confused as to how to solve this simple problem. Although it seems as some little config issue i am missing. I have a file index.php with some html tables and this php code: ..html stuff here... ? print $mod; ? ..some more html here... If i feed the script with index.php?mod=2, etc. and run it locally, i get an error saying: Notice: Undefined variable: mod in c:\win2kapp\easyphp1-8\www\index.php on line 36 If i run it on a web server, it works perfectly. Whats the difference or where might be the problem in the php.ini? (if its there) The server i am using is easyphp, that package that install apache, php and mysql all together. I am running a windows xp box. Thanks in advance. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php