php-general Digest 4 Apr 2007 11:47:20 -0000 Issue 4715
php-general Digest 4 Apr 2007 11:47:20 - Issue 4715 Topics (messages 252015 through 252025): Re: Cannot remove PHP Version 5.2.1-0.dotdeb.1 252015 by: Miles Thompson 252018 by: Mario Guenterberg Re: Audio CAPTCHA review request 252016 by: Daevid Vincent dynamic web interface and size 252017 by: Alain Roger Re: PDO mssql + multiple rowsets 252019 by: Javier Ruiz 252020 by: Javier Ruiz help me to solve this math maze 252021 by: Faisal Murad 252022 by: Zoltán Németh 252023 by: Satyam 252024 by: Jochem Maas Problems downloading a PDF 252025 by: Mário Gamito 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--- Mario, Boy it's been a long day - it seems that every item I had in by configure batch had to be installed; then at the very end of the day it finally got to the --with-mysql. Had quite a scramble tryingto find the correct dev environment, then finally I was down to to two warning errors, one of which was for sqlite. Tried a make, but it wouldn't go, so I ran configure again, explicitly stating with no sqlite. Tried make again and it completed. Ran checkinstall and it packaged the puppy, installed it and signed off with a pleasant note on how to uninstall if necessary. Tomorrow we'll see how it works, and I hope I did not clobber mysql as part of this. There's an incompatibility between bzip2 and prefork-apache2-dev (or something like that). Running one clobbers the other, so since I needed apxs2 more than bzip2, that was dropped from the configuration. If you're interested I'll post another update tomorrow. Regards - Miles Thompson On 4/3/07, Mario Guenterberg [EMAIL PROTECTED] wrote: On Tue, Apr 03, 2007 at 08:50:31AM -0300, Miles Thompson wrote: Mario, That did it - when I tried to reload the phpinof.php script Apache did not know what to do with the file. Now I'll drag the compiler from it's dusty corner and start from scratch. Not the debian/ubuntu way but sometimes the best solution ;-) Thanks a million - Miles :-) Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - ---End Message--- ---BeginMessage--- On Tue, Apr 03, 2007 at 08:56:12PM -0300, Miles Thompson wrote: Mario, Boy it's been a long day - it seems that every item I had in by configure batch had to be installed; then at the very end of the day it finally got to the --with-mysql. Had quite a scramble tryingto find the correct dev environment, then finally I was down to to two warning errors, one of which was for sqlite. Tried a make, but it wouldn't go, so I ran configure again, explicitly stating with no sqlite. Tried make again and it completed. Ran checkinstall and it packaged the puppy, installed it and signed off with a pleasant note on how to uninstall if necessary. Tomorrow we'll see how it works, and I hope I did not clobber mysql as part of this. There's an incompatibility between bzip2 and prefork-apache2-dev (or something like that). Running one clobbers the other, so since I needed apxs2 more than bzip2, that was dropped from the configuration. If you're interested I'll post another update tomorrow. Hi Miles, can you post your ./configure options. apache2-prefork-dev is the right devel package and in my environment that works fine with bzip2 and sqlite. Have you installed the libsqlite0-dev and libsqlite3-dev packages and the libbz2-dev package? I've written a little install shellscript for my own use. Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - build-php5.sh Description: Bourne shell script ---End Message--- ---BeginMessage--- -Original Message- From: Daevid Vincent
Re: [PHP] Cannot remove PHP Version 5.2.1-0.dotdeb.1
On Tue, Apr 03, 2007 at 08:56:12PM -0300, Miles Thompson wrote: Mario, Boy it's been a long day - it seems that every item I had in by configure batch had to be installed; then at the very end of the day it finally got to the --with-mysql. Had quite a scramble tryingto find the correct dev environment, then finally I was down to to two warning errors, one of which was for sqlite. Tried a make, but it wouldn't go, so I ran configure again, explicitly stating with no sqlite. Tried make again and it completed. Ran checkinstall and it packaged the puppy, installed it and signed off with a pleasant note on how to uninstall if necessary. Tomorrow we'll see how it works, and I hope I did not clobber mysql as part of this. There's an incompatibility between bzip2 and prefork-apache2-dev (or something like that). Running one clobbers the other, so since I needed apxs2 more than bzip2, that was dropped from the configuration. If you're interested I'll post another update tomorrow. Hi Miles, can you post your ./configure options. apache2-prefork-dev is the right devel package and in my environment that works fine with bzip2 and sqlite. Have you installed the libsqlite0-dev and libsqlite3-dev packages and the libbz2-dev package? I've written a little install shellscript for my own use. Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - build-php5.sh Description: Bourne shell script -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] PDO mssql + multiple rowsets
I've seen there's an open bug on the missing feature I pointed out in my first email, but it's even not assigned and I cannot get an answer from the developer... so... does anybody know if there is any plan to finish the PDO-dblib driver? TIA -- Forwarded message -- From: Javier Ruiz [EMAIL PROTECTED] Date: Apr 2, 2007 9:54 AM Subject: Re: [PHP] PDO mssql + multiple rowsets To: Frank M. Kromann [EMAIL PROTECTED], php-general@lists.php.net Hi again. Sorry I was out of my city during the weekend and had no connection available... So Frank, please lemme know, is the feature (multiple rowsets) planned to be included in the pdo-dblib driver? I would like to know to include or not pdo in my development needs against mssql. Thanks, greetings! On 3/29/07, Frank M. Kromann [EMAIL PROTECTED] wrote: It Is doable. The native mssql/dblib extension does support that features. I just have'nt had the time to code it for pdo_dblib. - Frank I too have been having problems getting the PDO dblib for mssql to play well (getting the same error actually). If you find a reason or work around for it I would appreciate hearing about it. Thinking of going the odbc route myself if I can't get it to work. Respectfully, Ligaya Turmelle -Original Message- From: Javier Ruiz [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 28, 2007 8:21 PM To: php-general@lists.php.net Subject: [PHP] PDO mssql + multiple rowsets Hi! I want to use PDO in my apps for connecting to several RDBSs, one of them, sql server 2000 and 2005. I tried to use as DSN something like mssql:... (as I've seen in the php manual pages) but I get a PDOException with the message Unable to open PDO connection [wrapped: could not find driver]. I can work well with the mssql built-in functions (like mssql_connect, mssql_query and so on...) and even I can almost work perfectly using in my dsn dblib: So first question: is the PDO's driver mssql deprecated or is it me doing something wrong in the PHP installation? BTW, I use php-5.2.1 In case that the answer to the first question is that mssql is no more used as a PDO driver, I have a problem... I have stored procedures in sql server that return multiple rowsets, I've seen that PDO offers functionability to manage this, but not for the dblib driver... if I try to use the $stmt-nextRowSet() method, I get an exception like Driver does not support this function: driver does not support multiple rowsets What can I do then to work with my stored procs? Thanks in advance -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] PDO mssql + multiple rowsets
btw... the bug: http://pecl.php.net/bugs/bug.php?id=10530 -- Forwarded message -- From: Javier Ruiz [EMAIL PROTECTED] Date: Apr 4, 2007 9:10 AM Subject: Fwd: [PHP] PDO mssql + multiple rowsets To: php-general@lists.php.net I've seen there's an open bug on the missing feature I pointed out in my first email, but it's even not assigned and I cannot get an answer from the developer... so... does anybody know if there is any plan to finish the PDO-dblib driver? TIA -- Forwarded message -- From: Javier Ruiz [EMAIL PROTECTED] Date: Apr 2, 2007 9:54 AM Subject: Re: [PHP] PDO mssql + multiple rowsets To: Frank M. Kromann [EMAIL PROTECTED], php-general@lists.php.net Hi again. Sorry I was out of my city during the weekend and had no connection available... So Frank, please lemme know, is the feature (multiple rowsets) planned to be included in the pdo-dblib driver? I would like to know to include or not pdo in my development needs against mssql. Thanks, greetings! On 3/29/07, Frank M. Kromann [EMAIL PROTECTED] wrote: It Is doable. The native mssql/dblib extension does support that features. I just have'nt had the time to code it for pdo_dblib. - Frank I too have been having problems getting the PDO dblib for mssql to play well (getting the same error actually). If you find a reason or work around for it I would appreciate hearing about it. Thinking of going the odbc route myself if I can't get it to work. Respectfully, Ligaya Turmelle -Original Message- From: Javier Ruiz [mailto: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2007 8:21 PM To: php-general@lists.php.net Subject: [PHP] PDO mssql + multiple rowsets Hi! I want to use PDO in my apps for connecting to several RDBSs, one of them, sql server 2000 and 2005. I tried to use as DSN something like mssql:... (as I've seen in the php manual pages) but I get a PDOException with the message Unable to open PDO connection [wrapped: could not find driver]. I can work well with the mssql built-in functions (like mssql_connect, mssql_query and so on...) and even I can almost work perfectly using in my dsn dblib: So first question: is the PDO's driver mssql deprecated or is it me doing something wrong in the PHP installation? BTW, I use php-5.2.1 In case that the answer to the first question is that mssql is no more used as a PDO driver, I have a problem... I have stored procedures in sql server that return multiple rowsets, I've seen that PDO offers functionability to manage this, but not for the dblib driver... if I try to use the $stmt-nextRowSet() method, I get an exception like Driver does not support this function: driver does not support multiple rowsets What can I do then to work with my stored procs? Thanks in advance -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help me to solve this math maze
2007. 04. 4, szerda keltezéssel 12.44-kor Faisal Murad ezt írta: i am making a program to give money to a group of people lets say that i have to distribute 3000 among 12 people 6 of them are adult and will get 100% 6 them are children those will get 75% from the overall amount. a common solution might appear as divide 3000 to 12 which is 250 give 250 to adults and 75% percent of it to children which is 187.5 after this kind of calculation i have 375 more to give which was supposed to be equally distributed among them can anyone understand my problem and assists me. $adultmoney = $totalmoney / ($adultnumber + 0.75 * $childnumber); $childmoney = 0.75 * $adultmoney; greets Zoltán Németh faisal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help me to solve this math maze
You'll give 100 'units' to 6 of them, and 75 to 6, thus: 6 * 100 + 6 * 75 == 1050 units Each 'unit' is valued at: 3000 / 1050 == 2.8571 Thus, you give: 6 * 285.71 + 6 * 214.28 == 2999.94, and you may keep the change ;-) Satyam - Original Message - From: Faisal Murad [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, April 04, 2007 11:44 AM Subject: [PHP] help me to solve this math maze i am making a program to give money to a group of people lets say that i have to distribute 3000 among 12 people 6 of them are adult and will get 100% 6 them are children those will get 75% from the overall amount. a common solution might appear as divide 3000 to 12 which is 250 give 250 to adults and 75% percent of it to children which is 187.5 after this kind of calculation i have 375 more to give which was supposed to be equally distributed among them can anyone understand my problem and assists me. faisal No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.25/745 - Release Date: 03/04/2007 12:48 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help me to solve this math maze
Satyam wrote: You'll give 100 'units' to 6 of them, and 75 to 6, thus: 6 * 100 + 6 * 75 == 1050 units Each 'unit' is valued at: 3000 / 1050 == 2.8571 Thus, you give: 6 * 285.71 + 6 * 214.28 == 2999.94, and you may keep the change ;-) pity you don't work as bank director Satyam (notice that in real life it's the bank that always pockets the change ;-) Satyam - Original Message - From: Faisal Murad [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, April 04, 2007 11:44 AM Subject: [PHP] help me to solve this math maze i am making a program to give money to a group of people lets say that i have to distribute 3000 among 12 people 6 of them are adult and will get 100% 6 them are children those will get 75% from the overall amount. a common solution might appear as divide 3000 to 12 which is 250 give 250 to adults and 75% percent of it to children which is 187.5 after this kind of calculation i have 375 more to give which was supposed to be equally distributed among them can anyone understand my problem and assists me. faisal No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.25/745 - Release Date: 03/04/2007 12:48 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems downloading a PDF
Hi, I'm building this site that has several PDFs to download, but only to registered users. To prevent people to insert the full URL to the documents, i moved them outside Apache's DocumentRooot, which is /var/www. My site is in /var/www/telbit and i put the PDFs in /var/www I've coded in order to do the trick, but it's failing. I can't get the name of the file. Notice that the page which has the code is products-teststudio.php itself. The code follows my signature. Any help would be appreciated. Warm Regards -- :wq! Mário Gamito -- ?php if (isset($_SESSION['email'])) { echoa href=\products-teststudio.php?file=testudio.pdf\ rel=\external\Download TESTUDIO flyer/a; $file = $_GET['file']; // try to sanitize the filename if (preg_match('/[^A-Za-z0-9._]/', $file)) die(Invalid filename.); $path = '/var/www/'; $full = $path . $file; header('Content-type: application/pdf'); header(Content-Length: . filesize($full)); header('Content-disposition: attachment; filename='. basename($file) .''); readfile($full); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems downloading a PDF
-Original Message- From: Mário Gamito [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 1:46 PM To: php-general@lists.php.net Subject: [PHP] Problems downloading a PDF Hi, I'm building this site that has several PDFs to download, but only to registered users. To prevent people to insert the full URL to the documents, i moved them outside Apache's DocumentRooot, which is /var/www. My site is in /var/www/telbit and i put the PDFs in /var/www I've coded in order to do the trick, but it's failing. I can't get the name of the file. Notice that the page which has the code is products-teststudio.php itself. The code follows my signature. Any help would be appreciated. Warm Regards -- :wq! Mário Gamito -- ?php if (isset($_SESSION['email'])) { echoa href=\products-teststudio.php?file=testudio.pdf\ rel=\external\Download TESTUDIO flyer/a; $file = $_GET['file']; // try to sanitize the filename if (preg_match('/[^A-Za-z0-9._]/', $file)) die(Invalid filename.); $path = '/var/www/'; $full = $path . $file; header('Content-type: application/pdf'); header(Content-Length: . filesize($full)); header('Content-disposition: attachment; filename='. basename($file) .''); readfile($full); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php [Peter Lauri - DWS Asia] You are echoing stuff before sending the file that is not possible. So remove the echo and it should work. If not, try this for debugging: if(!is_readable($full)) echo the file $full is not readable by apache; else { //same as before } Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
2007. 04. 4, szerda keltezéssel 12.46-kor Mário Gamito ezt írta: Hi, I'm building this site that has several PDFs to download, but only to registered users. To prevent people to insert the full URL to the documents, i moved them outside Apache's DocumentRooot, which is /var/www. My site is in /var/www/telbit and i put the PDFs in /var/www I've coded in order to do the trick, but it's failing. I can't get the name of the file. Notice that the page which has the code is products-teststudio.php itself. The code follows my signature. Any help would be appreciated. Warm Regards -- :wq! Mário Gamito -- ?php if (isset($_SESSION['email'])) { echoa href=\products-teststudio.php?file=testudio.pdf\ rel=\external\Download TESTUDIO flyer/a; you cannot do this. you are sending output here, html output, so the webserver sends the html headers for it. and later you try to send a pdf and corresponding headers in the same script. that will never work. greets Zoltán Németh $file = $_GET['file']; // try to sanitize the filename if (preg_match('/[^A-Za-z0-9._]/', $file)) die(Invalid filename.); $path = '/var/www/'; $full = $path . $file; header('Content-type: application/pdf'); header(Content-Length: . filesize($full)); header('Content-disposition: attachment; filename='. basename($file) .''); readfile($full); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Mário Gamito wrote: To prevent people to insert the full URL to the documents, i moved them outside Apache's DocumentRooot, which is /var/www. My site is in /var/www/telbit and i put the PDFs in /var/www I've coded in order to do the trick, but it's failing. I can't get the name of the file. You don't need to basename() it, you already know what the filename is, because it was requested via $_GET['file']. I would insert a file_exist check before you try and send it. It might give you the cause of your problem. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot remove PHP Version 5.2.1-0.dotdeb.1
On 4/4/07, Mario Guenterberg [EMAIL PROTECTED] wrote: On Tue, Apr 03, 2007 at 08:56:12PM -0300, Miles Thompson wrote: Mario, Boy it's been a long day - it seems that every item I had in by configure batch had to be installed; then at the very end of the day it finally got to the --with-mysql. Had quite a scramble tryingto find the correct dev environment, then finally I was down to to two warning errors, one of which was for sqlite. Tried a make, but it wouldn't go, so I ran configure again, explicitly stating with no sqlite. Tried make again and it completed. Ran checkinstall and it packaged the puppy, installed it and signed off with a pleasant note on how to uninstall if necessary. Tomorrow we'll see how it works, and I hope I did not clobber mysql as part of this. There's an incompatibility between bzip2 and prefork-apache2-dev (or something like that). Running one clobbers the other, so since I needed apxs2 more than bzip2, that was dropped from the configuration. If you're interested I'll post another update tomorrow. Hi Miles, can you post your ./configure options. apache2-prefork-dev is the right devel package and in my environment that works fine with bzip2 and sqlite. Have you installed the libsqlite0-dev and libsqlite3-dev packages and the libbz2-dev package? I've written a little install shellscript for my own use. Greetings Mario -- sig snipped Mario, The contents of my configuration file are included below. I''m checking for the packages you mentioned and will add them. I'm feeling a lot more confident, having achieved a successful make and install - this is not something I do every day. Appreciate your advice - Miles #! /bin/sh ./configure --prefix=/usr/share --datadir=/usr/share/php \ --bindir=/usr/bin \ --with-apxs2=/usr/bin/apxs2 \ --with-mysql=/usr/include/mysql \ --with-mysqli \ --without-sqlite \ --without-pdo-sqlite \ --with-gd --enable-gd-imgstrttf --enable-gd-native-ttf \ --with-zlib-dir=/usr/lib \ --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib \ --with-tiff-dir=/usr/lib --with-ttf-dir=/usr/lib \ --with-freetype-dir=/usr/lib \ --enable-ftp \ --enable-memory-limit \ --enable-safe-mode \ --enable-bcmath \ --enable-calendar \ --enable-ctype --with-ftp \
Re: [PHP] Problems downloading a PDF
Richard Davey wrote: Mário Gamito wrote: To prevent people to insert the full URL to the documents, i moved them outside Apache's DocumentRooot, which is /var/www. My site is in /var/www/telbit and i put the PDFs in /var/www I've coded in order to do the trick, but it's failing. I can't get the name of the file. You don't need to basename() it, you already know what the filename is, because it was requested via $_GET['file']. I would say almost the opposite: ?php if (isset($_SESSION['email'])) { $error = false; if (isset($_GET['file'])) { $file = basename($_GET['file']); $full = '/var/www/' . $file; if (!is_readable($full)) $error = Invalid filename.;) } else { $error = No filename given.; } if ($error) { echo a href=\products-teststudio.php?file=testudio.pdf\, rel=\external\Download TESTUDIO flyer/a; exit; } header('Content-type: application/pdf'); header(Content-Length: . filesize($full)); header('Content-disposition: attachment; filename='. $file .''); readfile($full); exit; } else { echo Unauthorized Access!; } I would insert a file_exist check before you try and send it. It might give you the cause of your problem. always a good thing Cheers, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Jochem Maas wrote: You don't need to basename() it, you already know what the filename is, because it was requested via $_GET['file']. I would say almost the opposite: Let me rephrase: if you are properly validating the $_GET['file'] input anyway, basenaming it is a superfluous step that may hide possible attack attempts. Personally, I'd rather know if someone was messing around with a parameter. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Hi, Thank you all for your answers. I would say almost the opposite: I get a Page Not found. The problem is that $file variable is empty (tested with a print). Any ideas ? Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Hi, Ok, i've hardcoded the filename and i no longer get a 404 error. But the PDF file i get is this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 120 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 121 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 122 %PDF-1.4 %âãÏÓ 351 0 obj endobj xref 351 434 16 0 n 010281 0 n 010417 0 n 010574 0 n 010607 0 n 012850 0 n 012884 0 n 013037 0 n 013174 0 n 013704 0 n 014104 0 n 014488 0 n 014700 0 n 014747 0 n 014794 0 n 014842 0 n 014889 0 n 014937 0 n 014984 0 n 015033 0 n 015082 0 n 015130 0 n 015179 0 n 015228 0 n 015277 0 n 015326 (etc...) You are echoing stuff before sending the file that is not possible. So remove the echo and it should work. If not, try this for debugging: if(!is_readable($full)) echo the file $full is not readable by apache; else { //same as before } I'm not sure if i understand you :( Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
2007. 04. 4, szerda keltezéssel 14.04-kor Mário Gamito ezt írta: Hi, Ok, i've hardcoded the filename and i no longer get a 404 error. But the PDF file i get is this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 120 that's what I said before. you echo out some html before the file headers. that will never work. remove the echo statement on line 14 and you should be okay greets Zoltán Németh Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 121 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 122 %PDF-1.4 %âãÏÓ 351 0 obj endobj xref 351 434 16 0 n 010281 0 n 010417 0 n 010574 0 n 010607 0 n 012850 0 n 012884 0 n 013037 0 n 013174 0 n 013704 0 n 014104 0 n 014488 0 n 014700 0 n 014747 0 n 014794 0 n 014842 0 n 014889 0 n 014937 0 n 014984 0 n 015033 0 n 015082 0 n 015130 0 n 015179 0 n 015228 0 n 015277 0 n 015326 (etc...) You are echoing stuff before sending the file that is not possible. So remove the echo and it should work. If not, try this for debugging: if(!is_readable($full)) echo the file $full is not readable by apache; else { //same as before } I'm not sure if i understand you :( Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] storing functions
I am wondering how you store and recall your functions. I have an external file - functions.php, this includes all the functions for the site. It is included in the pages head and then I just use the functions when I need them. Does anyone have a better way to store/recall functions? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Hi, that's what I said before. you echo out some html before the file headers. that will never work. remove the echo statement on line 14 and you should be okay But i need the line echo a href=\products-testudio.php?file=testudio.pdf\, rel=\external\Download TESTUDIO flyer/a; to display the link for download!!! How can i sove this puzzle ? Full code follows my signature. Thanks for all your help guys. Warm Regards, -- :wq! Mário Gamito -- ?php if (isset($_SESSION['email'])) { $error = false; if (isset($_GET['file'])) { $file = basename($_GET['file']); $full = '/var/www/testudio.pdf'; if (!is_readable($full)) $error = Invalid filename.; } else { $error = No filename given.; } if ($error) { echo a href=\products-testudio.php?file=testudio.pdf\, rel=\external\Download TESTUDIO flyer/a; exit; } header('Content-type: application/pdf'); header(Content-Length: . filesize($full)); header('Content-disposition: attachment; filename=testudio.pdf'); readfile($full); exit; } else { echo Please, a href=\login.php\login/a to download the PDF; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Richard Davey wrote: Jochem Maas wrote: You don't need to basename() it, you already know what the filename is, because it was requested via $_GET['file']. I would say almost the opposite: Let me rephrase: if you are properly validating the $_GET['file'] input anyway, basenaming it is a superfluous step that may hide possible attack attempts. Personally, I'd rather know if someone was messing around with a parameter. fine. so exactly what is the 100% bullitproof validation that will catch every attack attempt? other than basename()ing the input and suffixing it to the relevant path and then checking that to see if the file exists?? (I'm assuming here that the directory in question contains only files that are available for download) given that the app will only generate urls for files that exist on the relevant path any file that is not found constitutes an attack of some sort. do you really care if the original url is: foo.php?file=bla.pdf and somebody does this (ending up with the file the original url pointed): foo.php?file=../../../bla.pdf ? Cheers, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing functions
Ross wrote: I am wondering how you store and recall your functions. I have an external file - functions.php, this includes all the functions for the site. It is included in the pages head and then I just use the functions when I need them. Does anyone have a better way to store/recall functions? having an army of chinese type in the required files from memory using altair 8000 interface for every request. only joking. what you have is a basic 'include' strategy, as functions.php grows you might consider splitting it into a number of files that group similar functions together, e.g. db.funcs.php output.funcs.php misc.func.php other than that I'm not sure what you are really asking? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Mário Gamito wrote: Hi, that's what I said before. you echo out some html before the file headers. that will never work. remove the echo statement on line 14 and you should be okay But i need the line echo a href=\products-testudio.php?file=testudio.pdf\, rel=\external\Download TESTUDIO flyer/a; to display the link for download!!! How can i sove this puzzle ? by reading the freaking replies that you get?!? :-), I did give you the answer to this in the rewritten code I offered. (granted there is a typo in that code, but I figure your capable enough to find the superfluous parentheses and remove it) I see you did take on some of what I proposed - but notice that in your latest bit of code the echo statement that outputs the link when there is an 'error' is *inside* the 'if (isset($_GET['FILE']))' block (which is not the case i the example I sent) Full code follows my signature. Thanks for all your help guys. Warm Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
2007. 04. 4, szerda keltezéssel 14.23-kor Mário Gamito ezt írta: Hi, that's what I said before. you echo out some html before the file headers. that will never work. remove the echo statement on line 14 and you should be okay But i need the line echo a href=\products-testudio.php?file=testudio.pdf\, rel=\external\Download TESTUDIO flyer/a; to display the link for download!!! you don't need that link in a downloaded file I'm sure. so your script has 2 modes: 1. display the download link 2. send the downloaded file so you should decide which mode is requested (for example by checking for $_GET['file'] - if it is set, a file is requested, otherwise not) and do the appropriate action for the request greets Zoltán Németh How can i sove this puzzle ? Full code follows my signature. Thanks for all your help guys. Warm Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Hi, by reading the freaking replies that you get?!? :-), I did give you the answer to this in the rewritten code I offered. (granted You the code you gave me i get Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 120 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 121 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 122 %PDF-1.4 %âãÏÓ 351 0 obj endobj xref 351 434 16 0 n 010281 Any ideas ? Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Audio CAPTCHA review request
At 4:59 PM -0700 4/3/07, Daevid Vincent wrote: -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] I will point you at http://www.cepstral.com/ for a possible solution to your .mp3 usage. You could use Cepstral's swift tool to say the text dynamically. Actually Ted, what I was referring to was that you could say actual words like rainbow6, or even made up strings such as A35SFX. Much like a text captcha does. As it stands, I think most audio captchas use simply digits, which means you only need to understand [0-9] in your voice-breaker-code (http://vorm.net/captchas). Mixing in letters means another 26 variants, and if you went with words (which 'swift' will 'speak'), then you're in another stratosphere all together... D. Vin: That's an interesting idea. As I said in my last post on this subject sound files can convey different meanings than just recognizing that the word seven means providing 7 as a solution. However, we run into the problem of those with cognitive disabilities who may not be able to resolve the CAPTCHA solution. As I see it, this is a double edged sword. If a blog, for example, requires cognitive skills to derive benefit from, is it unreasonable to present a cognitive problem for the user to solve? Let's take an extreme example -- What if you had a blog that discussed color arrangements, would be be acceptable for the blog owner to put up a color-blind CAPTCHA? Interesting topics for discussion, but probable not for this list. Thanks everyone. Cheers, tedd -- --- 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
Re: [PHP] storing functions
Em Quarta 04 Abril 2007 10:19, Ross escreveu: I am wondering how you store and recall your functions. I have an external file - functions.php, this includes all the functions for the site. It is included in the pages head and then I just use the functions when I need them. Does anyone have a better way to store/recall functions? R. For my projects, I'm using OOP... =] But if your projects are just contact forms, you don't need OOP. I believe that just split your files is a good way! =] []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Fortune finishes the great quotations, #6 But, soft! What light through yonder window breaks? It's nothing, honey. Go back to sleep. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF / Partially solved
Ok, I don't get the warnings anymore, but the PDF is still being displayed with its binary code inside in the PHP page: %PDF-1.4 %âãÏÓ 351 0 obj endobj xref 351 434 16 0 n 010281 0 n 010417 0 n 010574 0 n 010607 0 n 012850 0 n 012884 0 n 013037 0 n 013174 0 n 013704 0 n 014104 0 n 014488 0 n 014700 0 n 014747 Something must be wrong with the definition of the file type. Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing functions
- Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Ross [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, April 04, 2007 3:29 PM Subject: Re: [PHP] storing functions Ross wrote: I am wondering how you store and recall your functions. I have an external file - functions.php, this includes all the functions for the site. It is included in the pages head and then I just use the functions when I need them. Does anyone have a better way to store/recall functions? having an army of chinese type in the required files from memory using altair 8000 interface for every request. only joking. How I miss front panels in octal: http://en.wikipedia.org/wiki/Image:Altair8800.jpg This modern thing of having two hexadecimal digits that fit exactly on a byte boundary is child play. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing functions
I am wondering how you store and recall your functions. I have an external file - functions.php, this includes all the functions for the site. It is included in the pages head and then I just use the functions when I need them. Does anyone have a better way to store/recall functions? I have function.php in includes/functions folder with all functions I use on EVERY PAGE (connect to db, query, print results on screen while developing, buttons, etc.). And then the functions I use on some pages have separated (show_order.php, show_product.php, mysqlDate2friendlyDate.php, etc) and these wil be called/included when needed. -afan R. -- 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] Audio CAPTCHA review request
At 2:30 PM -0700 4/3/07, jochem wrote: Since you are asking for review: this audio captcha is almost certainly easily breakable. Tijnema is right with most of his comments, open source voice recognition software (the code he pointed to like spynx) will break this. I disagree with his point 3) below, obfuscating the speech with different bitrates etc. will in my opinion not work. How do I know? Unfortunately i do not have the time to properly test it, but I wrote a devoicecaptcha script to break the voice captchas of microsoft, google and paypal. You can download the code and test it with your code, see http://vorm.net/captchas. So unfortunately for you it will not work against spammers, but you are in good company of people trying ;-). Jochem: Thanks for the link, article (very interesting), and advice. The voice files that I am using could certainly be resolved by your method -- they are simple and your solution is pretty straightforward. However, I'm not convinced that all sound methodologies can be resolved as simply as that. For example -- your method looks for pauses/high points and then capsulizes segments for comparison against known sounds. That's OK, but what if there is other meaning in the sound? I often wondered why simple CAPTCHA's like Type the number seven four three, or What is the sum of two plus three?, or Spell cat, or Spell two wouldn't work? Certainly, one can create a routine coupled a dB to randomly produce thousands of different combinations of simple questions. Likewise, a sound file could be produced the same way. Perhaps I'm underestimating the capabilities of bots and overestimating the abilities of humans. I suspect that the distribution of both camps have an overlap and therein lies the problem. The problem may not have a solution. But to bring this back to my intent -- my intent here is to provide a simple audio CAPTCHA that could be used by anyone to provide some degree of protection for their personal use THAT would also be accessible to screen readers. It's not foolproof, but it appears to work in that regard. Interesting discussion -- thanks for your perspective. Cheers, tedd -- --- 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
Re: [PHP] Problems downloading a PDF
Mário Gamito wrote: Hi, by reading the freaking replies that you get?!? :-), I did give you the answer to this in the rewritten code I offered. (granted You the code you gave me i get I didn't write 120+ liones of code - so what your running is definitely not what I gave you. .. Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 120 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 121 Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php on line 122 %PDF-1.4 %âãÏÓ 351 0 obj endobj xref 351 434 16 0 n 010281 Any ideas ? Warm Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF / Partially solved
Mário Gamito wrote: Ok, I don't get the warnings anymore, but the PDF is still being displayed with its binary code inside in the PHP page: %PDF-1.4 %âãÏÓ 351 0 obj endobj xref 351 434 16 0 n 010281 0 n 010417 0 n 010574 0 n 010607 0 n 012850 0 n 012884 0 n 013037 0 n 013174 0 n 013704 0 n 014104 0 n 014488 0 n 014700 0 n 014747 Something must be wrong with the definition of the file type. if you know that there *must* be something wrong with the definition of the file type why not go and search around for answers related to generating download headers? the list is here to help, not spoonfeed. Warm Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic web interface and size
At 7:28 AM +0200 4/4/07, Alain Roger wrote: Hi, My question is not so much about PHP language but more about concept and PHP result. Basically i'm currently working on web application to administrate the web content of a website. My customer would like to have a nice web application interface, so it means a lot of images, and so on. However, he would like also to have as PHP/postgreSQL results some tables with quite enough information, so it means several fields data to collect and to show so, a huge width for each table. Here is my dilema... basically and based on web standard all website should have an interface of 1024px (less scrollbar = 1000 px) width. How can i display enough data on such width ? I was thinking to display data into a div and to make this div scrollable in order to respect those 1000px width. I would like to have your experiences point of view in such situation. Alain: This is a way I solved a similar problem: http://xn--nvg.com/demo -- if your browser complains about the domain, get a better browser. The difference between fixed and float is simply if you will allow more than one line per field and allow the table to accommodate the screen width OR force one line per field and expand the table beyond the screen width. Cheers, tedd -- --- 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
Re: [PHP] help me to solve this math maze
At 12:44 PM +0300 4/4/07, Faisal Murad wrote: i am making a program to give money to a group of people lets say that i have to distribute 3000 among 12 people 6 of them are adult and will get 100% 6 them are children those will get 75% from the overall amount. a common solution might appear as divide 3000 to 12 which is 250 give 250 to adults and 75% percent of it to children which is 187.5 after this kind of calculation i have 375 more to give which was supposed to be equally distributed among them can anyone understand my problem and assists me. faisal Considering that others provided a solution, here's mine. What's left over send to me. :-) tedd -- --- 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] Re: mixture of GET and POST
$self= $_SERVER['REQUEST_URI']; form enctype=\multipart/form-data\ action=\$self\ name=\applic_create\ method=\post\; The arguments will be included in the URL for GETs Or, simply Put the arguments in hidden inputs; e.g., input type=hidden ... They will be returned in the POST array Al Ross wrote: I have 3 'action' buttons and I am trying to send the $id from the radio button and the action to the same page so I can either, Add Edit or Remove the property from the database. Any ideas how I can get this to work? I can either POST the id's or GET the action but I can't seem to return both to the browser. Ta, R. -- form id=form1 name=form1 method=post action= div id=button_holder a href=?action=addid=?=$id;?Add Property/a a href=?action=removeRemove Property/a a href=?action=editEdit Property/a /div div id=table_header /div table id=properties_table ?php $query = SELECT * FROM properties; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ ? trtd class=col_one input type=radio name=id value=? echo $row['property_id'];?/td td class=col_two?php echo $row['property_id'];?/td td class=col_one?php echo $row['address'];?/td td class=col_two?php echo $row['postcode'];?/td td class=col_one£500/td td class=col_twoLive/td /tr ? } ? /table /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF
Jochem Maas wrote: fine. so exactly what is the 100% bullitproof validation that will catch every attack attempt? other than basename()ing the input and suffixing it to the relevant path and then checking that to see if the file exists?? It depends how you want to handle invalid data. If you're happy basenaming it to remove anything malicious, and then trying to see if the file still exists, then so be it. To me that is masking something bad to try and make it good, the end result being that you can't tell if someone is trying to screw with your script, or if you've simply got a typo in a link on your site somewhere. do you really care if the original url is: foo.php?file=bla.pdf and somebody does this (ending up with the file the original url pointed): foo.php?file=../../../bla.pdf Absolutely I care. One is an obvious attempt to circumvent my script, the other could be an error *I* made somewhere. Of course a better solution would be to never pass the filename on the query string anyway. Use a local look-up instead based on a key (a hard coded array, pulled from SQL, etc, whatever you want). But that is beyond the scope of what the guy was asking I guess. I honestly believe that having URLs such as getfile.php?file=something.pdf is like waving your wallet infront of a pickpocket, i.e. asking for trouble. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems downloading a PDF / Partially solved
Mário Gamito wrote: I don't get the warnings anymore, but the PDF is still being displayed with its binary code inside in the PHP page: Are you opening the file as a binary file? Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fwd: [PHP] PDO mssql + multiple rowsets
Support for multiple result sets will be added as soon as I (or someone else) get the time to do so. - Frank I've seen there's an open bug on the missing feature I pointed out in my first email, but it's even not assigned and I cannot get an answer from the developer... so... does anybody know if there is any plan to finish the PDO-dblib driver? TIA -- Forwarded message -- From: Javier Ruiz [EMAIL PROTECTED] Date: Apr 2, 2007 9:54 AM Subject: Re: [PHP] PDO mssql + multiple rowsets To: Frank M. Kromann [EMAIL PROTECTED], php-general@lists.php.net Hi again. Sorry I was out of my city during the weekend and had no connection available... So Frank, please lemme know, is the feature (multiple rowsets) planned to be included in the pdo-dblib driver? I would like to know to include or not pdo in my development needs against mssql. Thanks, greetings! On 3/29/07, Frank M. Kromann [EMAIL PROTECTED] wrote: It Is doable. The native mssql/dblib extension does support that features. I just have'nt had the time to code it for pdo_dblib. - Frank I too have been having problems getting the PDO dblib for mssql to play well (getting the same error actually). If you find a reason or work around for it I would appreciate hearing about it. Thinking of going the odbc route myself if I can't get it to work. Respectfully, Ligaya Turmelle -Original Message- From: Javier Ruiz [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 28, 2007 8:21 PM To: php-general@lists.php.net Subject: [PHP] PDO mssql + multiple rowsets Hi! I want to use PDO in my apps for connecting to several RDBSs, one of them, sql server 2000 and 2005. I tried to use as DSN something like mssql:... (as I've seen in the php manual pages) but I get a PDOException with the message Unable to open PDO connection [wrapped: could not find driver]. I can work well with the mssql built-in functions (like mssql_connect, mssql_query and so on...) and even I can almost work perfectly using in my dsn dblib: So first question: is the PDO's driver mssql deprecated or is it me doing something wrong in the PHP installation? BTW, I use php-5.2.1 In case that the answer to the first question is that mssql is no more used as a PDO driver, I have a problem... I have stored procedures in sql server that return multiple rowsets, I've seen that PDO offers functionability to manage this, but not for the dblib driver... if I try to use the $stmt-nextRowSet() method, I get an exception like Driver does not support this function: driver does not support multiple rowsets What can I do then to work with my stored procs? Thanks in advance -- 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] Install PECL
Hi All, I'm trying to install PECL package as install PEAR package, but there's error as : --- C:\PHPpear install http://localhost/pear/APC-3.0.13.tgz http://localhost/pear/APC-3.0.13.tgz downloading APC-3.0.13.tgz ... Starting to download APC-3.0.13.tgz (105,042 bytes) done: 105,042 bytes 40 source files, building ERROR: The DSP APC.dsp does not exist. Is my install method wrong? Or it was PECL install is different with PEAR install Thanks in advance bn
Re: [PHP] Install PECL
Bagus Nugroho wrote: Hi All, I'm trying to install PECL package as install PEAR package, but there's error as : --- C:\PHPpear install http://localhost/pear/APC-3.0.13.tgz http://localhost/pear/APC-3.0.13.tgz downloading APC-3.0.13.tgz ... Starting to download APC-3.0.13.tgz (105,042 bytes) done: 105,042 bytes 40 source files, building ERROR: The DSP APC.dsp does not exist. Is my install method wrong? you downloaded the APC src for *nix rather than windows, in fact I don't think there areready to roll PECL src packages (at least not for APC). did you read this page? : http://php.net/apc did you find this link: http://pecl4win.php.net/ Or it was PECL install is different with PEAR install IIRC 'pear install' is simply a wrapper for 'pecl install' as far as pecl packages are concerned. Thanks in advance bn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] finding a particular record within a MySQL result set
I've cross posted this to the MySQL list... Here's my original post. Is there some quick way to do the following in MySQL? (I know I can use PHP to search through the result set, but I wanted to see if there's a quick way using some sort of query) Let's say I know that Joe is from Maine. I want to do a query of all employees from Maine, ordered by hiring date, and figure out where Joe falls in that list. (i.e. which record number is he?) -James Here's my new plan of attack... Right now I'm trying to use PHP to do a binary search on the result set so I don't have to traverse the entire result set. I'm using PHP's mysql_data_seek() to move the pointer within the result set and looking at the data to do the necessary comparisons. What do people think of this approach? -James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Install PECL
Ok, thanks Best Regards bn From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Wed 04-Apr-2007 23:45 To: Bagus Nugroho Cc: php-general@lists.php.net Subject: Re: [PHP] Install PECL Bagus Nugroho wrote: Hi All, I'm trying to install PECL package as install PEAR package, but there's error as : --- C:\PHPpear install http://localhost/pear/APC-3.0.13.tgz http://localhost/pear/APC-3.0.13.tgz downloading APC-3.0.13.tgz ... Starting to download APC-3.0.13.tgz (105,042 bytes) done: 105,042 bytes 40 source files, building ERROR: The DSP APC.dsp does not exist. Is my install method wrong? you downloaded the APC src for *nix rather than windows, in fact I don't think there areready to roll PECL src packages (at least not for APC). did you read this page? : http://php.net/apc did you find this link: http://pecl4win.php.net/ Or it was PECL install is different with PEAR install IIRC 'pear install' is simply a wrapper for 'pecl install' as far as pecl packages are concerned. Thanks in advance bn
RE: [PHP] finding a particular record within a MySQL result set
I've cross posted this to the MySQL list... Here's my original post. Is there some quick way to do the following in MySQL? (I know I can use PHP to search through the result set, but I wanted to see if there's a quick way using some sort of query) Let's say I know that Joe is from Maine. I want to do a query of all employees from Maine, ordered by hiring date, and figure out where Joe falls in that list. (i.e. which record number is he?) -James Here's my new plan of attack... Right now I'm trying to use PHP to do a binary search on the result set so I don't have to traverse the entire result set. I'm using PHP's mysql_data_seek() to move the pointer within the result set and looking at the data to do the necessary comparisons. What do people think of this approach? You will probably get a better approach from the mysql list, but from a PHP solution perspective, I'd load up an array with the result set and use key() to get the number. The example at http://php.net/key does exactly that. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] finding a particular record within a MySQL result set
You will probably get a better approach from the mysql list, but from a PHP solution perspective, I'd load up an array with the result set and use key() to get the number. The example at http://php.net/key does exactly that. Or array_search() :) JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: storing functions
The way I organize my stuff is that I have all of my object code, functions, and what not in a specific folder within their own separate files. If there is enough of a certain category of files to flood the directory, I will place those in their own subdirectory. I have separate grouping files that will join together specific combinations of them to create a single line include for the top of my files. So for instance, I might have a main include that ties in the standard functions I want to use. If I need additional features, I can include another grouping file that adds more functionality to the page. If constants are needed, they are all placed in a separate config file. The reason I do things this way is foremost to keep things organized. By having a constant file/directory structure, I don't have to search through 6 files to determine where I put a certain function. With the separate include file groupings, I avoid meaninglessly adding 3x the amount of code to a page when it will only utilize a small subset of it. The downside of it is that you tend to accumulate a LOT of php files if your site gains significant scope. However since they are all organized with a common naming scheme, it's fairly easy to keep track of them. Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am wondering how you store and recall your functions. I have an external file - functions.php, this includes all the functions for the site. It is included in the pages head and then I just use the functions when I need them. Does anyone have a better way to store/recall functions? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] finding a particular record within a MySQL result set
I've looked at those, but both approaches requires traversing through the entire mysql result set to create another array ( could be memory intensive if the result set is large...100,000 ? ) -James On Apr 4, 2007, at 1:39 PM, Jim Moseby wrote: You will probably get a better approach from the mysql list, but from a PHP solution perspective, I'd load up an array with the result set and use key() to get the number. The example at http://php.net/key does exactly that. Or array_search() :) JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] finding a particular record within a MySQL result set
I've looked at those, but both approaches requires traversing through the entire mysql result set to create another array ( could be memory intensive if the result set is large...100,000 ? ) -James I agree. That's why I said the mysql group will give you better answers. Really, the best solution is to just get your answer from mysql. I am 100% sure you can forge an SQL query or series of queries that will return the number you want. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Suggestions for Web based FileServer/Mailaccess
* * Do not Cc: me, because I am on THIS list, if I write here.* * Keine Cc: an mich, bin auf DIESER Liste wenn ich hier schreibe. * * Ne me mettez pas en Cc:, je suis sur CETTE liste, si j'ecris ici. * * Hello, I am recoding some parts of my Intranet-Scripts and while in the file section, I want to add a Mailfolder (from courier-imap) to this directory, or contrary if I am on the Mailfolder section I want to add a file(space) to it. I do not know HOW to virtualize the overlaping of the Mailfolders and the Filespace to look like: -- /INBOX .Business .Tamay Dogan Network AGB.txt 3072x3072.logo.png .ML_php FAQ.txt .announce .general usefull_tips.txt contacts.db .ML_mail [EMAIL PROTECTED] FAQ.txt auth-smtp.txt -- Where the Maildirfolders are: ~/Maildir/INBOX ~/Maildir/INBOX.Business ~/Maildir/INBOX.Business.Tamay_Dogan_Network ~/Maildir/INBOX.ML_php ~/Maildir/INBOX.ML_php.announce ~/Maildir/INBOX.ML_php.general ~/Maildir/INBOX.ML_mail ~/Maildir/[EMAIL PROTECTED] which mean standard courier Mailfolders and the Filespace in ~/VFSPACE/ ~/VFSPACE/Business/ ~/VFSPACE/Business/Tamay_Dogan_Network/ ~/VFSPACE/ML_php/ ~/VFSPACE/ML_php/announce/ ~/VFSPACE/ML_php/general/ ~/VFSPACE/ML_mail/ ~/VFSPACE/ML_mail/[EMAIL PROTECTED] which should only created if a $USER put files into the section. Does anyone has already coded such stuff? Can point me to docs or something how to implement this? My Environement is: Debian GNU/Linux 4.0 Etch apache 1.3 (maybe update to v2 with WebDAV) php5 courier-imap PostgreSQL 7.4 (maybe update to 8.2) Greetings Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/6192519367100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Problems when running Java program
Hello, I have a Java program that gives me a string. When i run this program on the shell everything works fine but when i try to run using shell_exec i get Error occurred during initialization of VM Could not reserve enough space for code cache This script is currently on a VPS server with php4 running as CGI and phpsuexec enabled. What am i doing wrong? Thanks, Fernando. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: finding a particular record within a MySQL result set
Maybe I'm way off here, but when you're looking for his numbered place in the record set, can't you just count the people before him? ID NAME STATE DATE 1 JoeMaine 2006-02-12 2 JimMaine 2006-01-12 3 James Maine 2006-03-12 4 John Maine 2005-05-12 5 Jordan Maine 2006-02-11 Pseudo-sql below that is untested and probably has a typo in it: SELECT count(*) FROM employees WHERE STATE='Maine' AND DATE (SELECT DATE FROM employees WHERE ID=1); You count the number of people that have a starting date before his and the same state. Wouldn't he be the next record after that? Depending on if you want the count from 0 or 1, change the to =. James Tu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've cross posted this to the MySQL list... Here's my original post. Is there some quick way to do the following in MySQL? (I know I can use PHP to search through the result set, but I wanted to see if there's a quick way using some sort of query) Let's say I know that Joe is from Maine. I want to do a query of all employees from Maine, ordered by hiring date, and figure out where Joe falls in that list. (i.e. which record number is he?) -James Here's my new plan of attack... Right now I'm trying to use PHP to do a binary search on the result set so I don't have to traverse the entire result set. I'm using PHP's mysql_data_seek() to move the pointer within the result set and looking at the data to do the necessary comparisons. What do people think of this approach? -James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure database info in different environments
Ok, thanks for the feedback. I'll check it out. Regards, Bruce Jochem Maas [EMAIL PROTECTED] 3/04/2007 9:12 p.m. Bruce Cowin wrote: Hi, I have a generic database class that I built to connect to our different databases. From other posts that I've read, I think the safe thing is for me to put this file outside the web root, ensure it has a .php extension, set the include path to include this folder and include it in any pages that require it. Is this correct? Also, how do you handle the different environments: dev, test, and prod? I don't want to have to change the code every time I copy the file over. Do I have an independent file that determines if that folder should point to dev/test/prod? I generally use CVS to store my work and also to 'publish' stuff onto different setups/machines for testing/production, rather than moving/copying files manually - I find it alot easier to type 'cvs up -r SOME_TAG' and just have all the files updated with out having to think about which exactly files I must copy. I usually end up with a small config file that is not included in the [cvs] project (so it must be created manually for/in each installation) and have the project 'init' code check for the config file, require it and then test for the existance of some required constants/variables/etc - if the file is missing, not readable or expected constants/vars/etc are missing then the app dies with a suitable error message. Thanks for your help. Regards, Bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] finding a particular record within a MySQL result set
2007/4/4, James Tu [EMAIL PROTECTED]: I've cross posted this to the MySQL list... Here's my original post. Is there some quick way to do the following in MySQL? (I know I can use PHP to search through the result set, but I wanted to see if there's a quick way using some sort of query) Let's say I know that Joe is from Maine. I want to do a query of all employees from Maine, ordered by hiring date, and figure out where Joe falls in that list. (i.e. which record number is he?) -James Here's my new plan of attack... Right now I'm trying to use PHP to do a binary search on the result set so I don't have to traverse the entire result set. I'm using PHP's mysql_data_seek() to move the pointer within the result set and looking at the data to do the necessary comparisons. What do people think of this approach? -James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php There is a previous thread in this list regarding the same topic: http://marc.info/?t=11668863811 This is the solution I've used for this kind of problems, and posted as a response to that thread: http://marc.info/?m=116697534311544
Re: [PHP] crontab, PHP and MACOSX
On 3/28/07, Chris [EMAIL PROTECTED] wrote: There is a lot of require_once(' ') in the script and if i am not in the correct folder the script won't work. That is something php related ;) Change your require to something like this: require(dirname(__FILE__) . '/other_file_name.php'); -- Postgresql php tutorials http://www.designmagick.com/ Thanks for the hint. I found s solution to execute the php script from the cron scheduler: add a at the end of the crontab command Thank for your help. yvan
RE: [PHP] Audio CAPTCHA review request
I often wondered why simple CAPTCHA's like Type the number seven four three, or What is the sum of two plus three?, or Spell cat, or Spell two wouldn't work? Certainly, one can create a routine coupled a dB to randomly produce thousands of different combinations of simple questions. Likewise, a sound file could be produced the same way. HA! I was just about to write you that I just had this same brainstorm. Seems like it would be pretty hard to have a bot figure out what is the sum of two plus three?. I bet it would work like a champ (assuming you were helpful enough on your end to accept either five or 5... It drives me insane trying to post on the PHP.net function comments and it asks me that irritating question and I forget to spell out the answer. UGH! BTW, I should mention, I'm no fan of CAPTCHA in any form. Digg uses it, and it pisses me off because they do it for login and for posting. Seems it's all the rage with the kids these days, and I wonder how effective it is compared to how many people just won't post because of it -- I know I don't. But to bring this back to my intent -- my intent here is to provide a simple audio CAPTCHA that could be used by anyone to provide some degree of protection for their personal use THAT would also be accessible to screen readers. It's not foolproof, but it appears to work in that regard. Not sure you can make a one size fits all drop in CAPTCHA killa app. I think you can give someone the tools to do it (like how do I play an audio file, and know that the webform submitted an answer and if it matches, etc.) But like most security mechanizms, one is not enough. It's ultimately up to the developer to implement and extend the tools to fit their own needs for the project. If you want to prevent 30% of spambots, then your simple solution may be enough. If you're protecting a presidential candidates blog page, you probably need more protection in the 70%. If you're working for the NSA, then a secure login is going to be a first line of defense... Daevid. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail function
Hi, I am working on a program to create a registration feature through a email notificaiton much like this list. For functional use but also for personal training. However, I can't seem to pass the variable into the mail function() ? If I echo the variable it displays it so it must be passing the variable down. If I enter in a fixed and workable email address where $email is then it works as well. So I am a little confused to this problem. I have other programs where I do this but I place the mail function within a new function(). However, when I do that it just barks back at me. Contacted my Hosting company they are investigating. Thanks in advance for your help... Here is the code.. echo $email; echo Thanks for registering! - It does echo it. You will recieve an email shortly containing your validation code, and a link to activate your account!; mail($email, New Registration, www.sitename.com, Thanks for registering on SITE NAME. Here are your login details: Username: .$username. Password: .$password. In order to login and gain full access, you must validate your account. Click here to validate: http://www.sitename.com/login/register.php?action=activateuser=.$username.code=.$activation_code.; Thanks! [Webmaster] ); I got the code from www.avengingsorrow.com to see all the code. Sorry about the HTML email. I am new to the list (first post) and I don't believe you can turn off HTML email in Yahoo. Thanks again in advance Zhimmy - Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice