php-general Digest 27 Feb 2007 17:18:51 -0000 Issue 4649
php-general Digest 27 Feb 2007 17:18:51 - Issue 4649 Topics (messages 249476 through 249506): Re: Array question 249476 by: Hap-Hang Yu 249483 by: Ford, Mike 249500 by: Gerry D Array question - maybe UTF? 249477 by: Gerry D $_SERVER[DOCUMENT_ROOT] IIS6 windows2003 249478 by: Marco Sottana get wikipedia content 249479 by: Marco Sottana 249481 by: Stut Re: audio CAPTCHA - was Combining sound files 249480 by: Németh Zoltán Cast to unset 249482 by: Robert Enyedi 249492 by: Robert Cummings Populating array with function 249484 by: Dotan Cohen 249485 by: Brad Bonkoski 249486 by: Arpad Ray 249487 by: Dotan Cohen 249488 by: Dotan Cohen 249489 by: Dave Goodchild 249490 by: Jochem Maas 249491 by: Dotan Cohen 249498 by: Al 249499 by: Robert Cummings PHP shell_exec 249493 by: h 249494 by: Németh Zoltán 249495 by: Andrei 249496 by: Peter Lauri 249503 by: Colin Guthrie PHP Clustering System, beta testers 249497 by: Mark USPS DPV AMS Postal w/ PHP 249501 by: Chris Ditty 249502 by: Chris Ditty 249504 by: Chris Shiflett 249505 by: Chris Ditty PHP 4.x for FC6 249506 by: edwardspl.ita.org.mo 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--- Try: $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $search = 'apple'; foreach($fruit as $key = $val) { if ($val == $search) { echo $search found: array key is $key, value is $val; } } 2007/2/27, Gerry D [EMAIL PROTECTED]: I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE ) $n = $c; else { $n = $fruit[$key]; // how to get the value??? } the array_search works ok, but how do I get the value? all I get back is 'a' or 'b', not 'apple' or 'banana'... TIA Gerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -- Hap-Hang Yu, Jay ---End Message--- ---BeginMessage--- On 27 February 2007 04:23, Gerry D wrote: I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE ) $n = $c; else { $n = $fruit[$key]; // how to get the value??? } the array_search works ok, but how do I get the value? all I get back is 'a' or 'b', not 'apple' or 'banana'... Please show a little more code, as it looks to me as though this should work how you think it should. Specifically: how do we know what is in $c? how do you know the array_search works? how do you know $n is only getting 'a', 'b', or 'c'? (Hint: var_dump() is your friend!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm ---End Message--- ---BeginMessage--- Mike, See entire function under topic Array question - maybe UTF?... I am trying to change accented characters to their equivalent without accents. And yes, the arrays look fine after var_dump()... Gerry On 2/27/07, Ford, Mike [EMAIL PROTECTED] wrote: On 27 February 2007 04:23, Gerry D wrote: I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE ) $n = $c; else { $n = $fruit[$key]; // how to get the value??? } the array_search works ok, but how do I get the value? all I get back is 'a' or 'b', not 'apple' or 'banana'... Please show a little more code, as it looks to me as though this should work how you think it should. Specifically: how do we know what is in $c? how do you know the
[PHP] $_SERVER[DOCUMENT_ROOT] IIS6 windows2003
i have installed php in a IIS6 into a windows2003 i lost $_SERVER[DOCUMENT_ROOT] why ??
Re: [PHP] audio CAPTCHA - was Combining sound files
2007. 02. 26, hétfő keltezéssel 12.06-kor tedd ezt írta: Hi: Dumb error, please try again: http://www.sperling.com/a/c Plus, the point is to click the Speak CAPTCHA button and see if it speaks. XP/IE7: the error message is gone, but button does nothing Linux/Firefox: speak button redirects through s1.php-s5.php, they all show the following error (or similar) : Notice: Undefined index: captcha in /home/httpd/vhosts/sperling.com/httpdocs/a/c/a.php on line 19 and Firefox tells me I need to install some missing plugin for the content... (which may be true ;) ) greets Zoltán Németh Thanks, tedd I got the same notice on the top of the page. besides that, when clicking the speak captcha button nothing happens greets Zoltán Németh 2007. 02. 26, hétf‘ keltezéssel 08.12-kor benifactor ezt írta: tried, and failed. got this error: Notice: Undefined variable: captcha in /home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29 and no captcha was displayed. - Original Message - From: tedd [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, February 26, 2007 8:04 AM Subject: [PHP] audio CAPTCHA - was Combining sound files Hi gang: Thanks for all the advice regarding combining sound files. I shall look into all of it. In the meantime, I am trying a different solution and would appreciate your review of the technique: http://www.sperling.com/a/c/ The point of this experiment is to speak the numbers required for a CAPTCHA protection scheme. I've had a few blind users report that this works for them, but considering all the different platforms and talents on this list, I thought that I would ask Does this work (i.e., speak the numbers) for you? The numbers to be spoken are printed on the top of this page for your notice. If you would be so kind, please review, provide me your platform type and success. Thanks. tedd PS: What does this have to do with php? Well... a good deal of the code is php and a mix of a bunch of other stuff (we don't live in a vacuum) -- so please permit me this indulgence. -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get wikipedia content
Marco Sottana wrote: anyone knows a script that can get wikipedia content in .php ? The easiest way would be to download the DB and then build some PHP to access it. http://en.wikipedia.org/wiki/Wikipedia:Database_download Make sure you read everything on that page, and make sure you follow their rules. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Array question
On 27 February 2007 04:23, Gerry D wrote: I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE ) $n = $c; else { $n = $fruit[$key]; // how to get the value??? } the array_search works ok, but how do I get the value? all I get back is 'a' or 'b', not 'apple' or 'banana'... Please show a little more code, as it looks to me as though this should work how you think it should. Specifically: how do we know what is in $c? how do you know the array_search works? how do you know $n is only getting 'a', 'b', or 'c'? (Hint: var_dump() is your friend!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
Dotan Cohen wrote: I need to populate an array with the contents of a directory. The following code does not populate the $thumbnailFiles array like I expect that it would: ?php function listFiles ($directory) { $files=array(); $dir = dir($directory); while ($entry = $dir-read()) { if ( !is_dir($entry) ) { $files[] = $entry; perhaps look into the array_push() function http://www.php.net/array_push print $entry.br /; // DEBUG CODE - REMOVE ME } } $dir-close(); return $files; } $thumbnailsDirectory=/home/user/public_html/photostorage/160x120; $lqDirectory=/home/user/public_html/photostorage/240x320; $mqDirectory=/home/user/public_html/photostorage/800x600; $hqDirectory=/home/user/public_html/photostorage/1600x1200; $thumbnailFiles=array(); $lqFiles=array(); $mqFiles=array(); $hqFiles=array(); $thumbnailFiles=listFiles($thumbnailsDirectory); printpre; print_r($thumbnailsFiles); print/pre; ? The print statement does in fact print the files, so I know that I've gotten _that_ far. How should I return the contents of $files to $thumbnailFiles? Dotan Cohen http://lyricslist.com/lyrics/artist_albums/612/zion_i.html http://what-is-what.com/what_is/php.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
Brad Bonkoski wrote: $files[] = $entry; perhaps look into the array_push() function http://www.php.net/array_push $files[] = $entry; is perfectly fine. $thumbnailFiles=listFiles($thumbnailsDirectory); printpre; print_r($thumbnailsFiles); print/pre; The code is fine, spot the typo. Arpad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
On 27/02/07, Brad Bonkoski [EMAIL PROTECTED] wrote: perhaps look into the array_push() function http://www.php.net/array_push Thanks, but I cannot use array_push() as I don't know the name of the array that I'll be pushing to. There are four calls to the listFiles function, and each will populate a different array. Dotan Cohen http://what-is-what.com/what_is/digg.html http://english-lyrics.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
You have a typo in your code...
Re: [PHP] Populating array with function
On 27/02/07, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 27/02/07, Brad Bonkoski [EMAIL PROTECTED] wrote: perhaps look into the array_push() function http://www.php.net/array_push Thanks, but I cannot use array_push() as I don't know the name of the array that I'll be pushing to. There are four calls to the listFiles function, and each will populate a different array. the use of array_push() is not needed but the premise that it cannot be used is wrong - the array inside the function is always called $files. your problem is due to a simple typo, you could have checked the actual return value of the function and seen that it does return the array: var_dump( listFiles($thumbnailsDirectory) ); That's what I was doing with this code: printpre; print_r($thumbnailsFiles); print/pre; Thanks, all. Silly typo does it every time! Dotan Cohen http://what-is-what.com/what_is/xmp.html http://lyricslist.com/lyrics/artist_albums/287/k_s_choice.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cast to unset
On Tue, 2007-02-27 at 11:36 +0200, Robert Enyedi wrote: In the PHP grammar I encountered the feature of casting to unset, e.g. (unset)$a. I did not manage to find any specific documentation on this, only people wandering what it might do (http://blog.thinkphp.de/archives/33-Casted-fun..html). So what exactly does cast to unset do? Returns null. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP shell_exec
Hi I have been using the shell_exec command to perform several server queries quite succesfully i.e. analysing files systems by gettin ginformation returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to target a command like this on another server? So from server A where I am running a web app, needs to run the shell_exec('df -kP') on server B, which also has php installed, so that i can display the results in my web app on server A. Hope that makes sense! Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A. Any help greatly appreciated Regards Ade
Re: [PHP] PHP shell_exec
2007. 02. 27, kedd keltezéssel 13.17-kor h ezt írta: Hi I have been using the shell_exec command to perform several server queries quite succesfully i.e. analysing files systems by gettin ginformation returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to target a command like this on another server? So from server A where I am running a web app, needs to run the shell_exec('df -kP') on server B, which also has php installed, so that i can display the results in my web app on server A. Hope that makes sense! Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A. Any help greatly appreciated Regards Ade maybe you need ssh2_exec http://hu.php.net/manual/hu/function.ssh2-exec.php hope that helps Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP shell_exec
Hi Ade, Sure you can. You must develop 2 scripts. One that will act as server and one as client. So if you want to get details of server B from server A you should have the server into B and client into A. Be sure the communication between these 2 servers is securised (using a certificate or build you own encryption for communication, restrict script response depending on server ips etc...) as you want to pass sensitive data between them. Communication can be done using curl library or simply with fopen (if allow_url_fopen allows it). parameters can be passed using XML or simple parsed plain text. Andy h wrote: Hi I have been using the shell_exec command to perform several server queries quite succesfully i.e. analysing files systems by gettin ginformation returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to target a command like this on another server? So from server A where I am running a web app, needs to run the shell_exec('df -kP') on server B, which also has php installed, so that i can display the results in my web app on server A. Hope that makes sense! Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A. Any help greatly appreciated Regards Ade . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP shell_exec
ssh2_exec would do it for you... Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: h [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 27, 2007 3:18 PM To: php-general@lists.php.net Subject: [PHP] PHP shell_exec Hi I have been using the shell_exec command to perform several server queries quite succesfully i.e. analysing files systems by gettin ginformation returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to target a command like this on another server? So from server A where I am running a web app, needs to run the shell_exec('df -kP') on server B, which also has php installed, so that i can display the results in my web app on server A. Hope that makes sense! Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A. Any help greatly appreciated Regards Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Clustering System, beta testers
I have a PHP clustering back end server, MCache. It is available in source form at http://www.mohawksoft.org It allows multiple PHP web servers to share session information without any changes to PHP code and without NFS or a database. It is based on a backend server mcached and a PHP extension. It is currently running on a couple websites and works successfully with packages like Squirrelmail (which uses frames) and a few other roll your own sites type things. A technical discussion of why mcache is a good thing is here: http://www.mohawksoft.org/?q=node/36 The work in progress user guide is here: http://www.mohawksoft.org/?q=node/8 Any people willing to test would be appreciated, as would any suggestions on how to improve the project. I would be more than willing to help deploy this project on your site to get feedback I can use to improve the project. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
A good php editor, with code completion, will help prevent this. I like phpEdit. It even has a built-in syntax checker, which would have caught your error immediately. Dotan Cohen wrote: On 27/02/07, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 27/02/07, Brad Bonkoski [EMAIL PROTECTED] wrote: perhaps look into the array_push() function http://www.php.net/array_push Thanks, but I cannot use array_push() as I don't know the name of the array that I'll be pushing to. There are four calls to the listFiles function, and each will populate a different array. the use of array_push() is not needed but the premise that it cannot be used is wrong - the array inside the function is always called $files. your problem is due to a simple typo, you could have checked the actual return value of the function and seen that it does return the array: var_dump( listFiles($thumbnailsDirectory) ); That's what I was doing with this code: printpre; print_r($thumbnailsFiles); print/pre; Thanks, all. Silly typo does it every time! Dotan Cohen http://what-is-what.com/what_is/xmp.html http://lyricslist.com/lyrics/artist_albums/287/k_s_choice.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
On Tue, 2007-02-27 at 09:05 -0500, Al wrote: A good php editor, with code completion, will help prevent this. A decent brain with ample memory will suffice also. Upgrade packages not available (yet) :) Cheers, Rob. I like phpEdit. It even has a built-in syntax checker, which would have caught your error immediately. Dotan Cohen wrote: On 27/02/07, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 27/02/07, Brad Bonkoski [EMAIL PROTECTED] wrote: perhaps look into the array_push() function http://www.php.net/array_push Thanks, but I cannot use array_push() as I don't know the name of the array that I'll be pushing to. There are four calls to the listFiles function, and each will populate a different array. the use of array_push() is not needed but the premise that it cannot be used is wrong - the array inside the function is always called $files. your problem is due to a simple typo, you could have checked the actual return value of the function and seen that it does return the array: var_dump( listFiles($thumbnailsDirectory) ); That's what I was doing with this code: printpre; print_r($thumbnailsFiles); print/pre; Thanks, all. Silly typo does it every time! -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array question
Mike, See entire function under topic Array question - maybe UTF?... I am trying to change accented characters to their equivalent without accents. And yes, the arrays look fine after var_dump()... Gerry On 2/27/07, Ford, Mike [EMAIL PROTECTED] wrote: On 27 February 2007 04:23, Gerry D wrote: I have a question on how to retrieve the value that corresponds to a key in an array. $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry'); $key = array_search($c, $fruit); if ( $key === FALSE ) $n = $c; else { $n = $fruit[$key]; // how to get the value??? } the array_search works ok, but how do I get the value? all I get back is 'a' or 'b', not 'apple' or 'banana'... Please show a little more code, as it looks to me as though this should work how you think it should. Specifically: how do we know what is in $c? how do you know the array_search works? how do you know $n is only getting 'a', 'b', or 'c'? (Hint: var_dump() is your friend!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] USPS DPV AMS Postal w/ PHP
Has anyone ever used php to access the DPV and AMS Postal cds from the USPS? If so, can you share any basic examples on how to get started with it? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] USPS DPV AMS Postal w/ PHP
I'll check into them frowning on that. Currently, I just want to see if I can do it. Trust me, I am in NO way a competitor to you. :) I'm just a bored geek. :D On 2/27/07, Jason Pruim [EMAIL PROTECTED] wrote: Hi Chris, From my understanding wouldn't the postal service frown upon that? I mean they don't even let you copy the data off the CD's onto your computer for faster access... Currently I just receive the Delivery Statistics Reports on CD. Will start receiving the DPV from my software company very shortly. Are you in the mailing industry? If so where? Want to make sure we aren't competitors ;) On Feb 27, 2007, at 10:17 AM, Chris Ditty wrote: Has anyone ever used php to access the DPV and AMS Postal cds from the USPS? If so, can you share any basic examples on how to get started with it? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim [EMAIL PROTECTED] Production Technology Manager MQC Specialist (2005 certified) 3251 132nd Ave Holland MI 49424 616.399.2355 www.raoset.com America will never be destroyed from the outside. If we falter and lose our freedoms, it will be because we destroyed ourselves. -Abraham Lincoln -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP shell_exec
h wrote: I have been using the shell_exec command to perform several server queries quite succesfully i.e. analysing files systems by gettin ginformation returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to target a command like this on another server? So from server A where I am running a web app, needs to run the shell_exec('df -kP') on server B, which also has php installed, so that i can display the results in my web app on server A. Hope that makes sense! Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A. If you need to inspect e.g. free space on remote servers it may be more sensible to use SNMP or some such similar protocol/system that is designed for exactly this purpose rather than try to hack up a system in PHP (tho' I do love my hacking!) Have a look at Nagios. I'd imagine your servers will have some degree of health monitoring/reporting installed anyway for your own peace of mind, so it shouldn't be too hard to hook into that system. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] USPS DPV AMS Postal w/ PHP
Chris Ditty wrote: Has anyone ever used php to access the DPV and AMS Postal cds from the USPS? If so, can you share any basic examples on how to get started with it? Andrew and Randy (two previous AME leads) started a project a while ago called phpZ4: http://sf.net/projects/phpz4/ I'd contact them to see what they recommend. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] USPS DPV AMS Postal w/ PHP
Thanks Chris. I was thinking that Randy did something like that. I was planning on calling him for the project name. On 2/27/07, Chris Shiflett [EMAIL PROTECTED] wrote: Chris Ditty wrote: Has anyone ever used php to access the DPV and AMS Postal cds from the USPS? If so, can you share any basic examples on how to get started with it? Andrew and Randy (two previous AME leads) started a project a while ago called phpZ4: http://sf.net/projects/phpz4/ I'd contact them to see what they recommend. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extract printable text from web page using preg_match
M5 wrote: I am trying to write a regex function to extract the readable (visible, screen-rendered) portion of any web page. Specifically, I only want the text between the body tags, excluding any script or style tags within the document, also excluding comments. Has anyone here seen such a regex? Is it possible to do in one expression? Alternative suggestion: lynx --dump http://www.example.com/; Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extract printable text from web page using preg_match
I believe it is better to use strpos() in this case because it's faster. ?php $start = strpos(strtolower($website_code), 'body'); // not necessary $end = strpos(strtolower($website_code), '/body'); $code = substr($website_code, $start, $end-$start); echo strip_tags($code); // clean text ? This is very simple, but there are many HTML parsers out there if you want to do more complex stuff. Martin --- M5 napsal(a): I am trying to write a regex function to extract the readable (visible, screen-rendered) portion of any web page. Specifically, I only want the text between the body tags, excluding any script or style tags within the document, also excluding comments. Has anyone here seen such a regex? Is it possible to do in one expression? ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extract printable text from web page using preg_match
I am trying to write a regex function to extract the readable (visible, screen-rendered) portion of any web page. Specifically, I only want the text between the body tags, excluding any script or style tags within the document, also excluding comments. Has anyone here seen such a regex? Is it possible to do in one expression? ...Rene
Re: [PHP] Extract printable text from web page using preg_match
- Original Message - From: M5 [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, February 27, 2007 6:47 PM Subject: [PHP] Extract printable text from web page using preg_match I am trying to write a regex function to extract the readable (visible, screen-rendered) portion of any web page. Specifically, I only want the text between the body tags, excluding any script or style tags within the document, also excluding comments. Has anyone here seen such a regex? Is it possible to do in one expression? ...Rene Though it might be possible to do by handling the HTML document as a plain string, the fact is lots of HTML is nor well formatted. As sugested, using strpos for the start and end tags might be a faster and easier solution than a regex, but no browser will complain if it reaches the end of the document and found no closing body tag. An initial body tag might have lots of attributes, such as onLoad, class, style, target you name it, you'll eventually find it. Unless you know the 'quality' of the documents you plan to parse, I would sugest you use a DOM parser. PHP ships with two alternatives, depending on the version, which might or might not be installed in your setup, otherwise, you'll have to google for something you may use. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
I always wondered if anyone had a perfect brain. Us ordinary mortals require help. Robert Cummings wrote: On Tue, 2007-02-27 at 09:05 -0500, Al wrote: A good php editor, with code completion, will help prevent this. A decent brain with ample memory will suffice also. Upgrade packages not available (yet) :) Cheers, Rob. I like phpEdit. It even has a built-in syntax checker, which would have caught your error immediately. Dotan Cohen wrote: On 27/02/07, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 27/02/07, Brad Bonkoski [EMAIL PROTECTED] wrote: perhaps look into the array_push() function http://www.php.net/array_push Thanks, but I cannot use array_push() as I don't know the name of the array that I'll be pushing to. There are four calls to the listFiles function, and each will populate a different array. the use of array_push() is not needed but the premise that it cannot be used is wrong - the array inside the function is always called $files. your problem is due to a simple typo, you could have checked the actual return value of the function and seen that it does return the array: var_dump( listFiles($thumbnailsDirectory) ); That's what I was doing with this code: printpre; print_r($thumbnailsFiles); print/pre; Thanks, all. Silly typo does it every time! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does PHP require patch for Daylight Savings Time 2007 change
I am running Apache HTTP 1.3 with PHP 4.2.2 and MySQL 3.23. Do I need to apply any kind of patches to my PHP related to Daylight Savings Time 2007 change? ___ Dzenan Causevic Web Applications Developer NaviSite, Inc. 315-453-2912 x5346 (Office) 315-278-7371 (Cell) www.NaviSite.com http://www.NaviSite.com This e-mail is the property of NaviSite, Inc. It is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential, or otherwise protected from disclosure. Distribution or copying of this e-mail, or the information contained herein, to anyone other than the intended recipient is prohibited.
Re: [PHP] Extract printable text from web page using preg_match
On Tue, February 27, 2007 11:47 am, M5 wrote: I am trying to write a regex function to extract the readable (visible, screen-rendered) portion of any web page. Specifically, I only want the text between the body tags, excluding any script or style tags within the document, also excluding comments. Has anyone here seen such a regex? Is it possible to do in one expression? I think http://php.net/striptags may be your best bet... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] shell_exec, batch files, and IIS on Windows
The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP shell_exec
On Tue, February 27, 2007 7:17 am, h wrote: I have been using the shell_exec command to perform several server queries quite succesfully i.e. analysing files systems by gettin ginformation returned by df -kP (shell_exec('df -kP')). do any of you guts know if it is possible to target a command like this on another server? So from server A where I am running a web app, needs to run the shell_exec('df -kP') on server B, which also has php installed, so that i can display the results in my web app on server A. Hope that makes sense! Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server A. Well, there are several options here. One option is to just build a password-protected web page on the other server that does the exec() (or readfile for cpuinfo). Then you can have PHP on server A do file_get_contents on the URL, if allow_url_fopen is ON Depending on how complex the target command is, you could also look into running WebServices such as SOAP, RPC, REST, etc. A valuable source of this kind of thing is from the zillion control panels for webhosting that are out there I think you might maybe be able to tunnel a command through SSH as a one-off, but perhaps I'm just dreaming I read about that in man ssh a few months ago. To a large degree, HOW you do this depends much more on what commands you want to allow, and even more importantly, disallow, than on anything involving PHP. In fact, PHP itself is only a thinly-disguised wrapper for whatever you will come up with. So you're better off asking about this kind of thing on an OS or Linux distribution mailing list, probably. The PHP bit will end up just being ?php exec($something)? no matter how you look at it. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cast to unset
On Tue, February 27, 2007 3:36 am, Robert Enyedi wrote: In the PHP grammar I encountered the feature of casting to unset, e.g. (unset)$a. I did not manage to find any specific documentation on this, only people wandering what it might do (http://blog.thinkphp.de/archives/33-Casted-fun..html). So what exactly does cast to unset do? If it ain't a Documented Feature, don't use it. :-) I presume it's the same as unset($a); though. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
Or just turning on E_NOTICE, which you should do anyway. On Tue, February 27, 2007 8:05 am, Al wrote: A good php editor, with code completion, will help prevent this. I like phpEdit. It even has a built-in syntax checker, which would have caught your error immediately. Dotan Cohen wrote: On 27/02/07, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 27/02/07, Brad Bonkoski [EMAIL PROTECTED] wrote: perhaps look into the array_push() function http://www.php.net/array_push Thanks, but I cannot use array_push() as I don't know the name of the array that I'll be pushing to. There are four calls to the listFiles function, and each will populate a different array. the use of array_push() is not needed but the premise that it cannot be used is wrong - the array inside the function is always called $files. your problem is due to a simple typo, you could have checked the actual return value of the function and seen that it does return the array: var_dump( listFiles($thumbnailsDirectory) ); That's what I was doing with this code: printpre; print_r($thumbnailsFiles); print/pre; Thanks, all. Silly typo does it every time! Dotan Cohen http://what-is-what.com/what_is/xmp.html http://lyricslist.com/lyrics/artist_albums/287/k_s_choice.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get wikipedia content
On Tue, February 27, 2007 2:12 am, Marco Sottana wrote: anyone knows a script that can get wikipedia content in .php ? ?php file_get_contents(http://en.wikipedia.org/wiki/$foo;); ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shell_exec, batch files, and IIS on Windows
The user that runs the php script under iis (IUSER_maschine name) should have permissions to execute the cmd.exe file, the .bat file and all the commands included in the .bat file. - Frank The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. -- 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] gettext online editor?
hello, for translating our web applications, we use to create an XML file with the labels; one label for each entry; one file for each language. This let us: 1. create one file (in french) and let someone do the translations 2. provide the 'key users' (admins) of the application a php page that can be used to edit/change these translations 3. include the xml files into our cvs so that changes are managed 4. provide a new language to the application simply by adding the corresponding file if needed, we can split the file on a functional basis to reduce the amount of data to be loaded. Most of the time however, we simply have some form labels, feedback messages, menu items : less than 50 labels per page. So this works very well. Recently a collegue showed us gettext. As it seems very powerful, the main disadvantage I can see is that translations files are not directly editable. The admin users cannot edit the files and correct/change the translations. Moreover, we work mainly on windows and I'd rather minimize the number of softwares needed by the developers to do their work (php editor, oci, mysql, mssql clients, cvs, svn, firefox, moz, ie, uml editor, ... so many already!) So my question is: do you know if there is any way of editing the gettext translation files from a http page? I mean, without the need to execute a 'compile' (or whatever) action on the webserver. do you have any comment on translating the applications? of course gettext seems powerful, with caching an so on. But I really believe the new SimpleXML can load a translation file very quickly, and php offers enough functionalities to do cache of the labels in the current language... thank you Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettext online editor?
- Original Message - From: Vincent DUPONT [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, February 27, 2007 10:33 PM Subject: [PHP] gettext online editor? hello, for translating our web applications, we use to create an XML file with the labels; one label for each entry; one file for each language. This let us: 1. create one file (in french) and let someone do the translations 2. provide the 'key users' (admins) of the application a php page that can be used to edit/change these translations 3. include the xml files into our cvs so that changes are managed 4. provide a new language to the application simply by adding the corresponding file if needed, we can split the file on a functional basis to reduce the amount of data to be loaded. Most of the time however, we simply have some form labels, feedback messages, menu items : less than 50 labels per page. So this works very well. Recently a collegue showed us gettext. As it seems very powerful, the main disadvantage I can see is that translations files are not directly editable. The admin users cannot edit the files and correct/change the translations. Moreover, we work mainly on windows and I'd rather minimize the number of softwares needed by the developers to do their work (php editor, oci, mysql, mssql clients, cvs, svn, firefox, moz, ie, uml editor, ... so many already!) So my question is: do you know if there is any way of editing the gettext translation files from a http page? I mean, without the need to execute a 'compile' (or whatever) action on the webserver. You might want to check PHP-gettext at http://savannah.nongnu.org/projects/php-gettext/. Since it reads external gettext files and stores them internally in PHP data structures (well, arrays) you might patch their data structures. Anyway, it might not be better than your current setup. do you have any comment on translating the applications? yes, but they are in Spanish, (http://www.satyam.com.ar/blog/2007/01/17/internacionalizacion-y-localizacion-indice/) sorry, Europeans often are multi-lingual, perhaps ... of course gettext seems powerful, with caching an so on. But I really believe the new SimpleXML can load a translation file very quickly, and php offers enough functionalities to do cache of the labels in the current language... thank you Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.4/703 - Release Date: 26/02/2007 14:56 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] shell_exec, batch files, and IIS on Windows
hi, maybe you can try this: in the IIS properties, you can define the user running your IIS service. Ususally this is IUSR_xxx, but you can set a administrator user (see directory Security/ anonymous user) try to put your win login (prefixed with your domain\ and give your password. If you can execute your cmd and batch file, then you can be sure that the problem if an authorisation problem. Afterward, re-enter the IUSR_xx user as the anonymous user, because running as administrator is rather dangerous!! Also, try the 'Integrated windows Authentication', if this is checked, the anaonymous will NOY be used, but your own login will be used instead. As an example, if the Use integrated authentication is active, try a phpinfo() and you should find your own windows login as AUTH_USER (or others, don't remember). (if you have a login prompt, you can avoid it from the IE setting) Also, have a look at the event viewer and at the IIS log file. Maybe you will see the error reported by IIS... Vincent Dupont Principal Consultant OpenSource Competence Center Ausy Belgium http://www.ausy.be -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Tue 2/27/2007 22:20 To: Shu Chow Cc: php-general@lists.php.net Subject: Re: [PHP] shell_exec, batch files, and IIS on Windows The user that runs the php script under iis (IUSER_maschine name) should have permissions to execute the cmd.exe file, the .bat file and all the commands included in the .bat file. - Frank The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
On 27/02/07, Al [EMAIL PROTECTED] wrote: A good php editor, with code completion, will help prevent this. I like phpEdit. It even has a built-in syntax checker, which would have caught your error immediately. As soon as the Linux version comes out I'll be sure to give it a whirl. Thanks. Dotan Cohen http://lyricslist.com/lyrics/artist_albums/443/seger_bob.html http://what-is-what.com/what_is/touch.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Submit
Once you submit the form, it's a done deal, and you're going to get a response back... Maybe you want some kind of AJAX-y thing somewhere? On Mon, February 26, 2007 10:23 am, Dan Shirah wrote: Hello all, I have a page that has multiple submits on it. One submit is within my javascriptfor form checking, the other submit is a button used to populate all customer information if an order ID is entered. Problem: I cannot get the two to coincide at the same time. They both use the submit function to send the data to the same page instead of their unique individual pages. Code: Below are the code snipets. ?php echo ?xml version=\1.0\ encoding=\iso-8859-1\?.; ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; HEAD script language=JavaScript !-- function closeThis() { if (window.confirm(Are you sure you want to cancel the payment request?)) this.window.close(); } *function checkForm() {* // ** START ** if (inputForm.cc_phone_number.value == ) { alert( Please enter a phone number. ); inputForm.cc_phone_number.focus(); return; } if (inputForm.receipt.value == ) { alert( Please select whether or not a receipt was requested. ); inputForm.phone_number.focus(); return; } if (inputForm.cc_first_name.value == ) { alert( Please enter a first name. ); inputForm.cc_first_name.focus(); return; } if (inputForm.cc_last_name.value == ) { alert( Please enter a last name. ); inputForm.cc_last_name.focus(); return; } if (!(document.inputForm.cc_comments.value ==)) { if (document.inputForm.cc_comments.value.length 250) { alert(The Comments must be less than 250 characters.\nIt is currently + document.inputForm.window_name.value.length + characters.); document.inputForm.window_name.focus(); return; } } * document.inputForm.submit();* } //-- /script LINK rel=stylesheet type=text/css href=../../CSS/background.css /head body *form name=inputForm action=save.php method=post enctype=multipart/form-data* table align=center border=0 cellpadding=0 cellspacing=0 width=680 tr td height=13 align=center class=tblheadstrongCredit Card Information/strong/td /tr *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH* table align=center border=0 cellpadding=0 cellspacing=0 width=680 tr *This is the other submit that I need to go a page other than the one specified in the form* *td width=62a href=DeferredPayment3.phpinput type=submit name=retrieve value=Retrieve/a/td* td width=8/td /tr /table br / br / table align=center border=0 cellpadding=0 cellspacing=0 width=680 tr *Call to the javascript checkForm function* *td width=64 align=lefta href=javascript:checkForm() title=SaveSave/a/td * td width=616 align=lefta href=javascript:closeThis() title=CloseClose/a/td /tr /table /form /body /html -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Submit
On Mon, February 26, 2007 1:14 pm, David Giragosian wrote: However, since I have a form within a form, it is giving me problems. You simply cannot nest one form inside another, if that's what you are doing... Don't do that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 and PHP5
On Mon, February 26, 2007 7:49 am, Martin Marques wrote: Is it posible to run apache with PHP4 and PHP5 on different virtual domains? Search the list archives for Rasmus Lerdorf and ProxyPass and I think you'll find a fairly easy way to do it. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER['PHP_SELF'] in a included file
I don't think it does know, nor care, nor should it... Why would it need to know that?... You may find the info you want in a backtrace function at http://php.net/ On Mon, February 26, 2007 8:15 am, clive wrote: Thanks Vincent,Stut and Olaf. Thats __file___ is exactly what I needed :) now for another brain teaser for your collective brains, How does a function know what file it was called from. a.php includes functions.php in a.php we call function test(); which is declared in functions.php Is there anyway for test(); to echo called from a.php with out passing 'a.php' or ___FILE___ as a parameter to the function? Im busy googling now for a answer. -- Regards, Clive. Real Time Travel Connections {No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array issues
Just add another array for each with $artist as the key. while ($artist, $vote, $email) = mysql_fetch_row($results)){ $votes[$artist] = $vote; $emails[$artist] = $email; } Although, actually, there is probably some better ways to do what you are doing, but with only the query to look at, it's hard to tell... On Mon, February 26, 2007 6:13 am, Steven Macintyre wrote: Hi all, I am working on a project for someone and with the brief I received before - I created a record per action with the following information; Artist[tab]artist[tab]artist[tab] etc as a entry for artists Then I have the same for titles etc ... What I have been doing is creating the array's and combining them ... with artist as a key and song as a value... Now ... they are requesting that I have the an additional 3 fields ... how would I now accomplish this? Bear in mind its php 4 and I am using a combine_array generic from the www.php.net site in lieu of array_combine. I have paste a sample record below; INSERT INTO ` votes_records` (`id`, `date`, `who`, `title`, `description`, `image`, `email`, `artists`, `titles`, `votes`, `weeks`, `twoweekpos`, `oneweekpos`, `debut`) VALUES (22, '2007-02-26 12:29:15', 1, 'Test Again', '', '', '', 'Artist 1Artist 2', 'Song 1Song 2', '1', '51', '20', '10', '2005/02/092005/02/09'); The net effect that I need to get - is take that information and display it per item so people can vote. S -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array issues
Richard Lynch wrote: Just add another array for each with $artist as the key. while ($artist, $vote, $email) = mysql_fetch_row($results)){ I think you ment while ( list($artist, $vote, $email) = mysql_fetch_row($results) ){ $votes[$artist] = $vote; $emails[$artist] = $email; } Although, actually, there is probably some better ways to do what you are doing, but with only the query to look at, it's hard to tell... On Mon, February 26, 2007 6:13 am, Steven Macintyre wrote: Hi all, I am working on a project for someone and with the brief I received before - I created a record per action with the following information; Artist[tab]artist[tab]artist[tab] etc as a entry for artists Then I have the same for titles etc ... What I have been doing is creating the array's and combining them ... with artist as a key and song as a value... Now ... they are requesting that I have the an additional 3 fields ... how would I now accomplish this? Bear in mind its php 4 and I am using a combine_array generic from the www.php.net site in lieu of array_combine. I have paste a sample record below; INSERT INTO ` votes_records` (`id`, `date`, `who`, `title`, `description`, `image`, `email`, `artists`, `titles`, `votes`, `weeks`, `twoweekpos`, `oneweekpos`, `debut`) VALUES (22, '2007-02-26 12:29:15', 1, 'Test Again', '', '', '', 'Artist 1Artist 2', 'Song 1Song 2', '1', '51', '20', '10', '2005/02/092005/02/09'); The net effect that I need to get - is take that information and display it per item so people can vote. S -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
On Tue, February 27, 2007 3:47 pm, Dotan Cohen wrote: On 27/02/07, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2007-02-27 at 09:05 -0500, Al wrote: A good php editor, with code completion, will help prevent this. A decent brain with ample memory will suffice also. Upgrade packages not available (yet) :) Cheers, Rob. I've run yum -y update brain this week, but I've got a conflicting package: baby 0.1.7. The package is a self-executing job, very nicely done might I add, but it wakes up the system every three hours or so. The only error message that it throws is wah wah wah, and I've been unable to google the meaning. It seems to always be the same error message, no matter what the cause: diaper buffer overflow, system resources (milk) running low, over- or under- heating, they all throw the same error. Anybody else experience this? Any suggestions / known solutions? For the resource underflow, ask your doctor if you can start using water for the late-night resource replenishment. baby 0.1.7 is satisfied enough with water, but will more quickly get out of the habit of waking up for it, since it's only water, and not full-blown milk. I think all the rest of them just take time to resolve, and the error messages will distinguish themselves fairly shortly, at least as to severity of error. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shell_exec, batch files, and IIS on Windows
On Tue, February 27, 2007 2:59 pm, Shu Chow wrote: The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. No real insight, but a couple philosophical questions that may lead somebody who actually does Windows into something... When one runs a .bat file, isn't one already *IN* some kind of cmd.exe shell of some type to start with? OTOH, what is PHP doing with exec() on Windows if not firing up some kind of cmd.exe shell? You could run a test with Apache/Windows/exec fairly quickly on any box, without hitting the IT guys up with the request. Have proof in hand that IIS is culprit and Apache is saviour. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error handling for Memcached PHP Extension
Didja see this one: http://us3.php.net/manual/en/function.memcache-debug.php Not, perhaps, the best answer, and maybe even not possible in your environment, but it may be useful for development, if not production. You could also check the getServerStats functions to see if their stats provide any indication that the server is up/down. And finally, I suspect that you could submit a patch to get a memcache_error() function without TOO much effort... On Sun, February 25, 2007 5:35 pm, Cabbar Duzayak wrote: Hi, Before I start, I am not sure whether I should have sent this to Memcached or PHP mailing list. So, for those who are subscribed to both, I apologize. I have started using the PHP extension at http://pecl.php.net/package/memcache for memcached. But, one problem I am having right now is that, php functions tells you nothing about errors. For example, when you call Memcache::get, it returns true or false, but when it returns false does this mean item is not found, or Memcached is down, or there is a cache corruption / compression error, etc. etc. And, this also is the case for Memcache::set, again when it returns false, you have no idea about what is going on. I tried turning debugging on, and this did not help much. As far as I can see, memcache internally sets error nos, but this extension completely ignores this information. And, I saw something like: PHP Notice: Memcache::get(): marked server 'localhost:11211' as failed in my php logs for some of the requests (like 5-10 out of a thousand), but server was up, and everthing was normal, and the request right after this one succeeded. In summary, is it possible to get these errors from PHP somehow so that we can have an idea about what is going on and how we can handle them? Possibly with something like mysql_error or mysql_errno functions? Thanks in advance... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to retrieve pictures from postgreSQL DB
As another option, you could, in theory, use mime_magic or the new fileinfo or I think there's a GD function to guess at the type... Personally, I think your first mistake was putting the image into the DB at all. Unless you're the CIA doing pixel comparisons actually in SQL stored procedures or something. :-) That particular horse has been beaten to death on this list, so search the archives for more on storing images in DB versus filesystem. On Sun, February 25, 2007 1:31 pm, Alain Roger wrote: Hi, I previously sent email about process how to retrieve and save pictures in postgreSQL DB. Now i know how to save them in DB, however i would like to know how can i retrieve the pictures and display them without knowing the picture extension ? i mean that in my DB i have GIFs, JPGs pictures. 1. My following code display without problem JPEG picture but what about GIF ? 2. How can i display picture without using == header('Content-type: image/jpeg'); Because this must be before displaying pictures. 3. what should i do if i want to display several types of pictures in the PHP page ? My code : ?php $dbconn = pg_connect($conn_string) or die('Could not connect: ' . pg_last_error()); $res = pg_query(SELECT * FROM immense.photo where photo_id=20); $raw = pg_fetch_result($res, 'photo_image'); if (!$res) { echo An error occured.\n; exit; } else { header('Content-type: image/jpeg'); echo pg_unescape_bytea($raw); } // Closing connection pg_close($dbconn); ? -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] indexing with fopen
You are essentially re-inventing ht://dig which is probably a Bad Idea. But if you want to fopen() a URL, you have to have 'http://' on the front of it, so PHP knows it's a URL, and not a very oddly-named file. On Sun, February 25, 2007 12:43 pm, Miguel Vaz wrote: Hi, I am trying to add a search to the site i am developing but i ran into a bit of a problem. Since the site is mainly dynamic (lots of includes and mysql queries), i thought of building an index table that will contain the insides of all the pages in the site tree. I was thinking of opening each page with fopen, stripping the html, and storing it in a database table. Then i would only search there. The problem is that i cant seem to read the pages with fopen: example of urls: index.php?m=1 index.php?m=1s=3 If i try to do this: $page=fopen('index.php?m=1',r); if($page){ while (!feof($page)) { $buff = fgets($page,4096); $totalpage .= $buff; } }else{ echo error; } I dont get the resolved content in $totalpage, but i get the includes and php commands that are inside index.php, which i find very strange. Should they resolve before they are retrieved? Any help is highly appreciated. Thanks. Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to display images stored in DB
On Sun, February 25, 2007 8:27 pm, Kevin Waterson wrote: This one time, at band camp, zerof [EMAIL PROTECTED] wrote: It is not a good practice to store pictures in DataBases, use links, instead of. Rubbish, where are your benchmarks? In the archives. Unless your images are teeny-tiny and can take advantage of buffer sizes on MySQL client/server interaction, you'll get SLIGHTLY better performance with images from file system. *ALL* of the arguments on this topic, and benchmarks, are in the PHP General archives. Several times over. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading into website directory for Php files
On Sun, February 25, 2007 11:30 am, StainOnRug wrote: Hello again.. I recently posted a question about include files.. I appreciate the responses I received but my question wasnât answered.. its my fault I didnât explain myself 100%.. I know how to use the include files.. What I am trying to figure out is. How do I upload the include files into my Include folder. I cant make the path myself because I donât have access to the config file. I have my website on yahoo web hosting. So how do I physically upload the file into that include folder which is .:/include:/usr/lib/php residing on my website. I donât have ftp access to the folder. I cant view the fold on my ftp program to upload the file.. do I upload it through php script? Can I change the path to a folder on my website?? Thank you soo much everyone! You can't upload to THOSE directories, because everybody on your same Yahoo! machine uses those directories as a shared resource. You hopefully are able to create a NEW directory, next to your html directory, and upload there. Then you can change the PHP include path via .htaccess or with set_include_path to have your directory tacked onto the list of directories PHP will search for include. -- View this message in context: http://www.nabble.com/Uploading-into-website-directory-for-Php-files-tf3288031.html#a9145868 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Combining sound files
On Sun, February 25, 2007 9:22 am, tedd wrote: Hi gang: I can combine two mp3 sound files together by simply: // load first $file = a.mp3; $handle = fopen($file, rb); $size = filesize($file); $load = fread($handle, $size); fclose($handle); // load second $file = b.mp3; $handle = fopen($file, rb); $size = filesize($file); $load .= fread($handle, $size); fclose($handle); // save both as one audio file $filename = tmp/a.mp3; $file = fopen( $filename, wb ); fwrite( $file, $load); fclose( $file ); I am not certain that that creates a truly valid MP3 file, but it does seem to work in all the players I've ever tried. I do it all the time with ID3 tags on the fly from the DB and the actual MP3 data from a static file. Anybody know a good MP3 validator in command line Linux, off the top of their heads? My last attempt to Google didn't yeild anything, but that was a couple years ago... However, I can't do the same with .WAV files. Does anyone know a way to combine .WAV files similar to the way shown above? The first 256 bytes of a .WAV file contains magic numbers indicating the bit-size (16-bit, 8-bit, whatever) and sampling rate (44.1 kHz, 22.05 kHz, 96kHz, etc) and imaging (stereo, mono, and I think maybe others) as well as the total number of samples (I.e., file length). There are also some slots for things like copyright, comments etc, as I recall. You're going to have to find specs on that header info, read the first 256 bytes of each file, compute new numbers to put into the .wav header, and write out the new 256 bytes and then the remainders of the two files. If the two files are NOT both the same bit/sample rate, then you'd have some REAL fun trying to scale/re-sample the actual audio... :-) You may find it easier/faster to just locate a .wav splicer command line tool and run exec with it. Though perhaps not nearly as fun, depending on your definition of fun. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PHP require patch for Daylight Savings Time 2007 change
Causevic, Dzenan wrote: I am running Apache HTTP 1.3 with PHP 4.2.2 and MySQL 3.23. Do I need to apply any kind of patches to my PHP related to Daylight Savings Time 2007 change? The -internals list might be a better place to search / ask. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: audio CAPTCHA - was Combining sound files
On Mon, February 26, 2007 11:16 am, Colin Guthrie wrote: tedd wrote: PS: What does this have to do with php? Well... a good deal of the code is php and a mix of a bunch of other stuff (we don't live in a vacuum) -- so please permit me this indulgence. Personally, I think this would be quite easy to do in flash... tho' I don't really know flash, it just seems like the kind of thing it would be good at :) Also look at some of the mods for e.g. phpBB, as I'm sure they've got audible captchas and the like. As I pointed out to Tedd off-list... How many blind users are going to bother to install Flash?... And, of course, Linux users are SOL, unless they've finally got their new version out of Beta where people can find it. Unless you're Richard Lynch, who has GIVEN UP on installing Flash ever again, since it always sucks down way too much RAM and CPU and frequently crashes, and you can't leave the browser open after you use it without sacrificing all that RAM/CPU you'll never get back again (until you close all the browser down)... I've reached a point where my Flash experiences have been too unpleasant to make it worth installing (much like Microsoft software) and my usual entree (Google) almost always finds me a non-Flash version of the content I wanted. I haven't missed it yet. And it's nice to have a lot of ads replaced with a simple white box with a green puzzle piece. :-) This is OBVIOUSLY just my personal opinion and choice! YMMV -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OCI8 under WINDOWS
Restart Apache and see what it spits into the log when it tries to load it. Post that message here for interpretation, if it's not clear. A message not unlike: OCI: dll could not be loaded often means that OCI was trying to load ANOTHER DLL that it couldn't find, not that OCI itself was not loading. Why the error message doesn't tell you which DLL it couldn't load is way beyond my ken... On Mon, February 26, 2007 2:11 am, Miguel J. Jiménez wrote: Hi, I am trying to use oci8.dll under PHP 5.2 and Apache 2 under Windows XP... The system variables are all configured (TNS_ADMIN, SQLPATH, LD_LIBRARY_PATH, etc...). I use ORACLE Instant Client and sqlplus works OK ... PHP-CLI loads the extension without any problem but I cannot get it load under APACHE (with the help of phpinfo()) ... Any idea why it won't load? -- Miguel J. Jiménez Área de Internet/XSL/PHP [EMAIL PROTECTED] ISOTROL Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta. Parque Tecnológico Cartuja '93, 41092 Sevilla. Teléfono: 955 036 800 - Fax: 955 036 849 http://www.isotrol.com La dicotonomía entre desarrollo económico y sostenibilidad es falsa. Si nos quedamos sin planeta no habrá economía que valga (Al Gore, Ex-Vicepresidente de EE.UU.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP+MySQL website cache ? Yes/No
Are you making a single eshop for just one store, or are you planning on your eshop being distributed to a zillion users?... Cuz unless your store gets a MILLION hits, the generation of static HTML instead of just using PHP will probably not save you very much at all. Write the application the most straight-forward way you can, and then check for acceptable performance. If it's not acceptable, use valgrind or xdebug to find the bottleneck, and fix it. Repeat this step until performance is acceptable. Trying to fix your performance before you know what the bottleneck is, is almost always a complete waste of time/resources. On Sun, February 25, 2007 4:49 am, Martin Zvarík wrote: Hi, I am making an eshop and I am thinking about caching system. You understand, that it cannot be entirely cached because visitor has it's own shopping cart etc. So, my thought is to cache only few blocks like Categories, Navigation menu etc. by storing it to an HTML file. The advantages are that it doesn't have to query database and generate the HTML code again, but my question is: Is it good approach? Shouldn't we optimize database instead of restoring the data on harddrive? Thank you for ideas, Martin Zvarik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP+MySQL website cache ? Yes/No
Your cart and all that has to open a DB connection anyway. Unless you do something horribly wrong in DB design, running one more simple query is CHEAP once you pay the price of making a connection. Benchmark it on your hardware and find out. On Sun, February 25, 2007 5:06 am, Martin Zvarík wrote: I know it does, but I think it is still faster to include a generated HTML file than query a database. But is it worth the miliseconds? --- Peter Lauri napsal(a): MySQL has caching functions I believe. Read here: http://dev.mysql.com/doc/refman/5.0/en/query-cache.html Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Martin Zvarík [mailto:[EMAIL PROTECTED] Sent: Sunday, February 25, 2007 12:50 PM To: php-general@lists.php.net Subject: [PHP] PHP+MySQL website cache ? Yes/No Hi, I am making an eshop and I am thinking about caching system. You understand, that it cannot be entirely cached because visitor has it's own shopping cart etc. So, my thought is to cache only few blocks like Categories, Navigation menu etc. by storing it to an HTML file. The advantages are that it doesn't have to query database and generate the HTML code again, but my question is: Is it good approach? Shouldn't we optimize database instead of restoring the data on harddrive? Thank you for ideas, Martin Zvarik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] input on sessions vs cookies
Save us a lot of grief and just use PHP built-in sessions until you can prove them to not meet your needs. On Sat, February 24, 2007 7:48 pm, benifactor wrote: i would like your input on session vs cookies regarding login data like usernames/passwords ect... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - FC6 as Web Server
On Sat, February 24, 2007 8:44 pm, Chris wrote: I haven't done it with FC6 but have with previous versions of redhat as far back as 6.2 (I'm sure someone else will say they've done it for longer :P). I still have my RedHat 4 CDs from cheapbytes in their original cardboard shipping envelope, from back when I would have had to download via modem as the alternative... I may need to pull them out to get that ancient laptop back into service, as I don't think it has the horses to run much more than that. RedHat 6 definitely failed, when I last tried this game... I'm sure others go back even further than me, of course. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE6 session issues
I recall having a problem with PHP on Windows and IE where however long the session timeout was, that's how long the session lasted, as either the server or the browser was never sending/getting the new cookies. Well, actually, there was an additional 10-minute offset, as the web server clock was *OFF* from GTM by 10 minutes, but that's another story... Anyway, I quit that job before I got around to really figuring out what was wrong. It could easily have been the session code failing to be called correctly, even though everything else worked (as well as anything works in Windows) okay. Another fun issue is that if you have, say, a forum installed that changes the cookie session time limit, and your application AND the forum are both using the default cookie settings for the name, then you may find that visitors to the forum have much shorter/longer sessions than you expected. This is what changing the session_name will fix. You'd really have to define your session issues and what blank entries coming in have to do with anything for anybody to help you, though. On Sat, February 24, 2007 5:19 am, Dave Goodchild wrote: Hi all. I am running an online charity lottery and am having issues with IE6 and sessions. To fix them, I added the following at the top of each file: ini_set('session.name', 'tlc'); header(Cache-control: private); session_start(); ...ran a local test in IE6 worked fine, then noticed more blank entries coming in. I am not using third-party cookies, the system is built on php sessions, any more ideas? -- http://www.web-buddha.co.uk -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET doesn't work as POST
On Sat, February 24, 2007 1:50 pm, Larry Garfield wrote: Yes, you can end up with both a GET and a POST. (I'm not sure if it's technically legal in the HTTP standard, but it can happen in practice, IIRC.) Having GET data included with a POST request, where the GET is just part of the URL, is perfectly normal and spec in the RFC, last I checked. If you manage to have POST data included with a GET request, I'd be looking for a new web-server software, I think... Your browser SHOULD just append the INPUT as more GET args with a GET. If your *JAVASCRIPT* does not do that correctly, then, really, we cannot begin to help you here, as you've got [bleeped] up javascript, so take it to a JS list/forum/guru. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
Use ?php phpinfo();? and see what *IS* there. If what you want isn't there, then the web server didn't provide it. If the web server didn't provide it, PHP can't be blamed for not passing it on to you, which is *ALL* PHP does here. So what you have is a web-server configuration issue in that case. On Mon, February 26, 2007 11:18 am, Ryan wrote: Tried that ($PHP_AUTH_USER) and it is also empty. On 2/24/07, dave [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 try echo $PHP_AUTH_USER; Ryan wrote: Richard, I looked at phpinfo() as you said, same thing... _SERVER[REMOTE_USER]no value You may be right, this may not be available, but I don't want to keep throwing a login screen in front of users for no apparent reason. Thanks, Ryan On 2/23/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, February 21, 2007 1:01 pm, Ryan wrote: I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); None of these work. Has anyone done this?? If the answer you are seeking isn't available in: ?php phpinfo();? run on the page where you are trying to do this, then you probably can't get the answer you want. Running http://php.net/ldap to re-connect and re-authenticate will probably be fairly cheap, since LDAP is supposed to be pretty dang fast in the first place, and whatever caching is going on for the LDAP or OS calls behind LDAP virtually guarantees that the data you want is in RAM. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF4AgsGPhC6XW20oARAmruAJ9zpCz5q6mN6rwlRHkyXgtox9ZvWACgnrXa TFy3y3YOWfFPaFctYAFbDFo= =6tjM -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: input on sessions vs cookies
Re-authenticate and make them login again when they do something particularly dangerous/serious/big-time. Nothing you've listed matches the above, except maybe changing their current password to a new one. I suppose you could do it just to change any profile setting, but some goofball out there wants a random avatar hack script, and then they'll just be leaking their login credentials too easily, so that's a net loss. On Sun, February 25, 2007 6:57 pm, Tosca wrote: It's a website where you can reply to news, blogs and other messages and with a forum. On 2/26/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sun, February 25, 2007 6:45 pm, Tosca wrote: Quote from Fahad Pervaiz [EMAIL PROTECTED]: To ensure best security use database as well. Store IP, Session ID, username, login time. After every few minutes you can re authenticate the user against these parameters. I have a login system with sessions and a database where I store session ID, username and what kind of user they are (like admin, moderator of regular member). This I check every time a page is refreshed. Is this secure enough? Are you running a bank? Or is it just a community forum? Without context, nobody on earth can answer this. Start reading here: http://phpsec.org to have a better handle on PHP security. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - FC6 as Web Server
While it might not be specific to php, there are some people out there who are both systems admins and web developers. I do agree however that this is not the most appropriate list. Peter: If you want to take this offline, send me a private email. I've configured what you are looking for and Fedora Core 6 happens to be my distro of choice. PS: For anyone on the list, if you have the same intentions, try to avoid ftp and use sftp instead for security issues. Sincerely, Tom Cruickshank On 2/24/07, Chris [EMAIL PROTECTED] wrote: I just got a plain FC6 server running. Anyone here who configured a FC6 for several domains with mail, ftp, virtual domains etc? I haven't done it with FC6 but have with previous versions of redhat as far back as 6.2 (I'm sure someone else will say they've done it for longer :P). What does this have to do with php? I have absolutely no idea... If you're having specific issues, try a more appropriate list. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] destructor sequence explained
Hello Can someone please help explain how the order of object destructors called at shutdown is determined, especially with regards to objects composed of other objects? For example in the code below, the first example calls the destructors exactly in the order I would expect. Since object B is still referenced by object A, A is destroyed first, then B. However in the second example, it appears that object B is destroyed before object A, even though A still references B. Can someone please shed some light on this? Thanks. James ?php class A{ public function __construct($b){ $this-b = $b; } public function __destruct(){ echo __class__ . destroyed\n; } } class B{ public function __destruct(){ echo __class__ . destroyed\n; } } $b = new B(); $a = new A($b); ? Outputs: A destroyed B destroyed However if I add the class A{ public function __construct($b){ $this-b = $b; $this-myself = $this;// --- This is the only change } public function __destruct(){ echo __class__ . destroyed\n; } } class B{ public function __destruct(){ echo __class__ . destroyed\n; } } $b = new B(); $a = new A($b); ? That outputs: B destroyed A destroyed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating array with function
On 28/02/07, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, February 27, 2007 3:47 pm, Dotan Cohen wrote: On 27/02/07, Robert Cummings [EMAIL PROTECTED] wrote: On Tue, 2007-02-27 at 09:05 -0500, Al wrote: A good php editor, with code completion, will help prevent this. A decent brain with ample memory will suffice also. Upgrade packages not available (yet) :) Cheers, Rob. I've run yum -y update brain this week, but I've got a conflicting package: baby 0.1.7. The package is a self-executing job, very nicely done might I add, but it wakes up the system every three hours or so. The only error message that it throws is wah wah wah, and I've been unable to google the meaning. It seems to always be the same error message, no matter what the cause: diaper buffer overflow, system resources (milk) running low, over- or under- heating, they all throw the same error. Anybody else experience this? Any suggestions / known solutions? For the resource underflow, ask your doctor if you can start using water for the late-night resource replenishment. baby 0.1.7 is satisfied enough with water, but will more quickly get out of the habit of waking up for it, since it's only water, and not full-blown milk. I think all the rest of them just take time to resolve, and the error messages will distinguish themselves fairly shortly, at least as to severity of error. I'll 'float' the idea of water to the sysadmin. She might like that suggestion. Thanks. Dotan Cohen http://technology-sleuth.com/long_answer/why_are_internet_greeting_cards_dangerous.html http://lyricslist.com/lyrics/artist_albums/651/faces.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] destructor sequence explained
On Tue, February 27, 2007 6:11 pm, james james wrote: Can someone please help explain how the order of object destructors called at shutdown is determined, especially with regards to objects composed of other objects? I think that changed from version to version, so unless you are on a dedicated server, you have to manage any order dependencies for yourself... I do not think there *IS* a documented ordering to this. You get whatever order PHP feels like using. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who in this list would you...
On Wed, 2007-02-28 at 00:08 +0200, Peter Lauri wrote: . ask to join a project you are working on? I am working on a larger and longer project and we are looking for one more developer. He should be strong in object oriented programming. A general problem solver would be beneficial as there are some automated processes that need to be improved. Fluent in Regular Expressions and familiar working in a Linux environment. Knowing basics of Perl and C would be a plus. He would need to work in-house. And the location is somewhere in Scandinavia. He could work as sub contractor or employed for my company. I know who I would ask, but I might have a suck way of reading people :-) First off... knock out all the noobs *PUNCH PUNCH*. Second knock off all the members who don't like OOP *BANG BANG*. Third... hmmm... trust your gut? :B This message has been brought to you with embedded virtual violence. Anyone punched or shot should immediately be thankful they didn't actually get punched or shot. No virtual pets were harmed! VSPCA attended all virtual animal scenes to ensure proper handling and rendering (-- pun not intended :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Who in this list would you...
[snip] He would need to work in-house. And the location is somewhere in Scandinavia. He could work as sub contractor or employed for my company. [/snip] I don't know too many list denizens who live in Scandinavia, so that severely limits your choices. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
Richard et al., You are right, the variable was not being provided for the apache server. Essentially I found the answer here http://httpd.apache.org/docs/1.3/misc/FAQ-F.html#remote-user-var The document has to be protected in order for apache create the REMOTE_USER variable. This was an apache subtlety I didn't know about. As soon as I protected it with an .htaccess file, it worked fine and the user showed up in this variable. $_SERVER['REMOTE_USER'] Thanks, Ryan On 2/27/07, Richard Lynch [EMAIL PROTECTED] wrote: Use ?php phpinfo();? and see what *IS* there. If what you want isn't there, then the web server didn't provide it. If the web server didn't provide it, PHP can't be blamed for not passing it on to you, which is *ALL* PHP does here. So what you have is a web-server configuration issue in that case. On Mon, February 26, 2007 11:18 am, Ryan wrote: Tried that ($PHP_AUTH_USER) and it is also empty. On 2/24/07, dave [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 try echo $PHP_AUTH_USER; Ryan wrote: Richard, I looked at phpinfo() as you said, same thing... _SERVER[REMOTE_USER]no value You may be right, this may not be available, but I don't want to keep throwing a login screen in front of users for no apparent reason. Thanks, Ryan On 2/23/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, February 21, 2007 1:01 pm, Ryan wrote: I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); None of these work. Has anyone done this?? If the answer you are seeking isn't available in: ?php phpinfo();? run on the page where you are trying to do this, then you probably can't get the answer you want. Running http://php.net/ldap to re-connect and re-authenticate will probably be fairly cheap, since LDAP is supposed to be pretty dang fast in the first place, and whatever caching is going on for the LDAP or OS calls behind LDAP virtually guarantees that the data you want is in RAM. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF4AgsGPhC6XW20oARAmruAJ9zpCz5q6mN6rwlRHkyXgtox9ZvWACgnrXa TFy3y3YOWfFPaFctYAFbDFo= =6tjM -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] operational musings
On Tue, 2007-02-27 at 18:59 -0600, Jay Blanchard wrote: Howdy cats and kittens! I had an interesting thought after watching a demo of a POS system and wondered if the same type of methodology could be applied in a PHP application. I haven't thought this all the way through, but a fully-hatched idea like this could signal a major change in applications designed with PHP. In the POS if the network connectivity was lost the store could continue to operate, once the network connectivity was restored the data from each store would sync back up and data would be sent to the central server, yadda, yadda, yadda. Of course this is in a client/server application with an executable residing on each workstation. So, if you wanted to do this with PHP you would likely have to have a local web /database server (each store), establish a socket (primary and store servers?) to watch for an outage/restore and then write the code to support the sync up. Can it be done with PHP? It would definitely be worth the trouble given the frequency that connections to stores get lost. Let's make a check list: local webserver -- check local database server -- check socket support -- check write code -- check All signs point to YES :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] operational musings
Without any more than a few minutes worth of work, you can make MySQL do that with replication. Your in-store system could act as a slave to for the central system databases (any central updates trickle down to the slave automatically) and your in-store machine could be the master for the store_xyz database(s). Network disconnect? No problem! Network reconnect? Easy! In-store machine failure? No problem! Just update the tables from the central master! Work? Almost none! And since this is a PHP list... ?= 'jon' ? Jay Blanchard wrote: Howdy cats and kittens! I had an interesting thought after watching a demo of a POS system and wondered if the same type of methodology could be applied in a PHP application. I haven't thought this all the way through, but a fully-hatched idea like this could signal a major change in applications designed with PHP. In the POS if the network connectivity was lost the store could continue to operate, once the network connectivity was restored the data from each store would sync back up and data would be sent to the central server, yadda, yadda, yadda. Of course this is in a client/server application with an executable residing on each workstation. So, if you wanted to do this with PHP you would likely have to have a local web /database server (each store), establish a socket (primary and store servers?) to watch for an outage/restore and then write the code to support the sync up. Can it be done with PHP? It would definitely be worth the trouble given the frequency that connections to stores get lost. Thanks in advance for ideas, thoughts, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to display images stored in DB
This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote: *ALL* of the arguments on this topic, and benchmarks, are in the PHP General archives. I am not concerned with past benchmarks done by others, I am asking what current benchmarks this user has made to make his claim. Kevin -- Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] operational musings
The company I work for is currently doing this... using PHP in a retail environment, with a Linux server in every store, talking to the POS controller via a socket, storing data in a database (postgres), and processing retail transactions in real-time. And, sending results of those transactions to a central server (which isn't running Linux, PHP, or Apache). I'm finding the PHP socket support to be unreliable, though. Everything's fine when we have one socket open to talk to the store controller. I open the socket and bind to an address:port, the store controller connects to it just fine, and we move on. However, right now, we're using Postgres as a queue between two programs that are processing transactions. I'm trying to get rid of Postgres and use a pair of IPC sockets (created with socket_create_pair() and using pcntl_fork()). The IPC sockets seem to be totally unreliable, at this point. Sometimes, when I call socket_write(), the function just never returns. My application doesn't die but, the line of code immediately following the socket_write() function never gets executed in the parent process. The child process receives the data and logs it successfully. So, I know the socket_write function is getting called and doing something. It just never returns. Anyone here have any ideas? I can send more details, and even chunks of pertinent code. -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 27, 2007 8:13 PM To: Jay Blanchard Cc: php-general@lists.php.net Subject: Re: [PHP] operational musings On Tue, 2007-02-27 at 18:59 -0600, Jay Blanchard wrote: Howdy cats and kittens! I had an interesting thought after watching a demo of a POS system and wondered if the same type of methodology could be applied in a PHP application. I haven't thought this all the way through, but a fully-hatched idea like this could signal a major change in applications designed with PHP. In the POS if the network connectivity was lost the store could continue to operate, once the network connectivity was restored the data from each store would sync back up and data would be sent to the central server, yadda, yadda, yadda. Of course this is in a client/server application with an executable residing on each workstation. So, if you wanted to do this with PHP you would likely have to have a local web /database server (each store), establish a socket (primary and store servers?) to watch for an outage/restore and then write the code to support the sync up. Can it be done with PHP? It would definitely be worth the trouble given the frequency that connections to stores get lost. Let's make a check list: local webserver -- check local database server -- check socket support -- check write code -- check All signs point to YES :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] operational musings
From my experience, database replication from the central server to each of the stores won't scale... We use a timed (every X minutes), home-brewed protocol that does something similar to a synchronization. And, we don't synchronize the entire database at central server (as there are parts of the central server database that only apply to specific stores). And, there's *A LOT* of data at the central server... more than you want your local server databases dealing with if they're going to keep up with any strict performance expectations (ie. a real-time transaction processing system in an very busy retail location). -Original Message- From: Jon Anderson [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 27, 2007 8:38 PM To: Jay Blanchard Cc: php-general@lists.php.net Subject: Re: [PHP] operational musings Without any more than a few minutes worth of work, you can make MySQL do that with replication. Your in-store system could act as a slave to for the central system databases (any central updates trickle down to the slave automatically) and your in-store machine could be the master for the store_xyz database(s). Network disconnect? No problem! Network reconnect? Easy! In-store machine failure? No problem! Just update the tables from the central master! Work? Almost none! And since this is a PHP list... ?= 'jon' ? Jay Blanchard wrote: Howdy cats and kittens! I had an interesting thought after watching a demo of a POS system and wondered if the same type of methodology could be applied in a PHP application. I haven't thought this all the way through, but a fully-hatched idea like this could signal a major change in applications designed with PHP. In the POS if the network connectivity was lost the store could continue to operate, once the network connectivity was restored the data from each store would sync back up and data would be sent to the central server, yadda, yadda, yadda. Of course this is in a client/server application with an executable residing on each workstation. So, if you wanted to do this with PHP you would likely have to have a local web /database server (each store), establish a socket (primary and store servers?) to watch for an outage/restore and then write the code to support the sync up. Can it be done with PHP? It would definitely be worth the trouble given the frequency that connections to stores get lost. Thanks in advance for ideas, thoughts, etc. -- 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] shell_exec, batch files, and IIS on Windows
Thanks, guys, for the responses. I'll check the events and IIS logs tomorrow. This afternoon, I put the IIS user into the Administrators group, but no luck - the same exact thing, or lack of thing, happened. I told this to the IT head and he agrees that it's probably not a permissions issue. After that he kind of warmed up to installing Apache on that box. They're absolutely not anti-Apache, just overworked and understaffed :/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo text - anti-spam-spider measure
How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] echo text - anti-spam-spider measure
I'm not sure with both of your questions. I'm too lazy to try. Untested: But to encode it, you would use preg_replace_callback('~([\d\w])~', create_function('$a', 'return #.ord($a[0]).;;'), $theEmail); Hopefully that works? On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Who in this list would you...
[snap] [snip] He would need to work in-house. And the location is somewhere in Scandinavia. He could work as sub contractor or employed for my company. [/snip] I don't know too many list denizens who live in Scandinavia, so that severely limits your choices. [/snap] I live in Thailand but that didn't stop me from joining the project at a worldly well known company as a consultant. And now we are looking for more guys as the project is growing... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo text - anti-spam-spider measure
It works. =P I tested it. Try it here! =P http://themfund.com/snippets/test.php On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: I'm not sure with both of your questions. I'm too lazy to try. Untested: But to encode it, you would use preg_replace_callback('~([\d\w])~', create_function('$a', 'return #.ord($a[0]).;;'), $theEmail); Hopefully that works? On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] echo text - anti-spam-spider measure
I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo text - anti-spam-spider measure
^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] echo text - anti-spam-spider measure
Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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] PHP Documentation in XML
Does anyone know where I could find PHP Documentation in XML or in an SQL dump? I'm trying to write an IRC bot that can retrieve information on php functions, and am realizing this would be the easiest way. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] echo text - anti-spam-spider measure
Neat, and thnaks. How spam-spider-proof is it? I will try this though. But I will also try it with mailto:; in entities as well. Thanks! John !-- HERE ARE THE ENTITIES -- a href=mailto:#109;#101;@#115;#111;#109;#101;#119;#104;#101;#114;#101;.#99;#111;#109;;#109;#101;@#115;#111;#109;#101;#119;#104;#101;#114;#101;.#99;#111;#109;/a !--ENTITIES ABOVE!-- Casey Chu wrote: It works. =P I tested it. Try it here! =P http://themfund.com/snippets/test.php On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: I'm not sure with both of your questions. I'm too lazy to try. Untested: But to encode it, you would use preg_replace_callback('~([\d\w])~', create_function('$a', 'return #.ord($a[0]).;;'), $theEmail); Hopefully that works? On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: How do I encode it? And would the href tag work? Casey Chu wrote: ^ So put that into a a href tag. On 2/27/07, Casey Chu [EMAIL PROTECTED] wrote: Try using Javascript? Or use all entities? For example: mailto:php-general@lists.php.net would turn into #109;#97;#105;#108;#116;#111;#58;#112;#104;#112;#45;#103;#101;#110;#101;#114;#97;#108;#64;#108;#105;#115;#116;#115;#46;#112;#104;#112;#46;#110;#101;#116; On 2/27/07, John Taylor-Johnston [EMAIL PROTECTED] wrote: I need an anti-spam-spider measure for my site. Too many addresses are getting raked. In once instance, I created a flash page: http://erasethis.glquebec.org/English/contact.htm But I just don't have the time to create a flash image for every single instance, most of which come from dynamically printed PHP pages from a MySQL database. Could I dynamically create a flash image, input the email and tell the flash image to mailto:[EMAIL PROTECTED] Do anyone have a solution? Does one already exist? My idea was to create a PHP script and output to a png. But I see many problems, including: 1) How do I avoid echoing the email address in the a href= tag? 2) How would I write a png that would be long and high enough? 3) How would the same script display the png? In short, I can't see far enough how to do this and avoid spider-raking in the HTML or header the content of the image. Any advice, code or input would be appreciated, John a href=?php #what do I put here? $mydata-email = [EMAIL PROTECTED]; echo $??; ?img src=?php |header('Content-type: image/png');| #How do I display the image? $mydata-email = [EMAIL PROTECTED]; echo $??; ? width=??? height=??? -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extract printable text from web page using preg_match
On 27-Feb-07, at 1:44 PM, Richard Lynch wrote: On Tue, February 27, 2007 11:47 am, M5 wrote: I am trying to write a regex function to extract the readable (visible, screen-rendered) portion of any web page. Specifically, I only want the text between the body tags, excluding any script or style tags within the document, also excluding comments. Has anyone here seen such a regex? Is it possible to do in one expression? I think http://php.net/striptags may be your best bet... No, it's not a very good solution. Striptags will leave everything within head, style and script (in the body or out). Comments are also included. I know it's possible to use non reg-ex strpos/substr to extra everything within body, but as another poster correctly said, this assumes a consistent HTML document (which there is not). I realize now that such a regex would be rather sophisticated, but I thought surely it must exist, since text-scrapping the readable content of a web page must not be rare. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] echo text - anti-spam-spider measure
John Taylor-Johnston wrote: Neat, and thnaks. How spam-spider-proof is it? I will try this though. But I will also try it with mailto:; in entities as well. Thanks! John !-- HERE ARE THE ENTITIES -- a href=mailto:#109;#101;@#115;#111;#109;#101;#119;#104;#101;#114;#101;.#99;#111;#109;;#109;#101;@#115;#111;#109;#101;#119;#104;#101;#114;#101;.#99;#111;#109;/a !--ENTITIES ABOVE!-- Of all the possible methods, entities are the easiest for bots to handle. They just need to decode the entities. More reliable methods involve using javascript to write out the mailto: tag. Do it in several statements. But even then, some of the smarter spiders will execute simple javascript like that. You can make it better by using onload to execute the javascript which means the spider will need to implement that, which I don't believe they do at the moment. Of course the best way is to use an image and don't link it. If it's just a way for visitors to contact you, use a contact form. You don't expose the email address and can control it a lot better. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who in this list would you...
Peter Lauri wrote: [snap] [snip] He would need to work in-house. And the location is somewhere in Scandinavia. He could work as sub contractor or employed for my company. [/snip] I don't know too many list denizens who live in Scandinavia, so that severely limits your choices. [/snap] I live in Thailand but that didn't stop me from joining the project at a worldly well known company as a consultant. And now we are looking for more guys as the project is growing... Eh? You're the one saying they must live in Scandanavia and work in-house, not Jay... -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Your input would be appreciated.
Hello My name is Lara Thynne and I am a PhD candidate at Deakin University Australia. I am currently running a survey at the following address. https://dcarf.deakin.edu.au/surveys/oss/ The survey is completely confidential and looks at your views and motivations to use Open Source software and to participate in the community. It will only take a few minutes and your contact details will not be recorded. You can withdraw your participation at any stage. I sincerely apologize for the spammish nature of this e-mail - I don't mean to abuse this list. I am trying to collect responses from as many open source developers and users as possible and a mailing list like this is probably the best way to reach many of you. Please personally CC me with any questions/comments posted to the list in response. Thanks again Lara P.S The program that I am using is open source, of course (www.phpsurveyor.org)! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php