[PHP] 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
Hello, Banging my head against this one... Briefly: - I have two forms on the same page - both forms are: action=?php print $_SERVER['PHP_SELF']; ? method=post - both forms gave unique ids - both forms have a hidden file of the type input type=hidden name=_add_new_module_details value=1 / which is checked directly below the form with an if(array_key_exists('_add_new_module_details', $_POST)) { ...} method - first form is a file upload - 2nd form is a details submit - submit button on 2nd form is only 'turned on' (via AJAX) once the user has uploaded file file - 2nd form validated fields contents, via an onsubmit - after 2nd form successuly submitted, head off back to another page In Internet Destroyer, the page works just fine (i.e., both forms fire as expected) In the non-IE browsers I have tried (Firefox, Chrome, Opera), the first form uploads the file properly, the 2nd form's submit is 'turned on' by AJAX - BUT the submit button on the 2nd form doesn't seem to do anything - i.e., the onsubmit is not being triggered, etc, etc help! smile Thanks in advance: GREG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP to create an ERD (sic) on the fly on a web page based on current DB records?
Hello, Seeking some advice on how to create an ERD (sic) graphically on the page on the fly when the page is 'called'... That is, I have a backend PostgreSQL database that I am getting data from and putting data into via web page/s and PHP... I would like to be able to show graphically to the web site admins the relationships between the pimary key contents of one table to all its foreign keys in the daughter table in a form of a simple entity relationship diagram. That is, a graphic showing (say) all of the PKs listed in the mother table, all of the more voluminous (sic) FKs listed in another table - and connecting lines. This is to aid the admin users that are used to conceptualiazing this sort of thing... Obscure question I know... But any thoughts? Regards TIA: GREG... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DEV] How expensive are function_exists() calls?
On Thu, Mar 12, 2009 at 10:35 PM, Robert Cummings rob...@interjinn.com wrote: The only thing that should defeat the usefulness of a bytecode cache is the use of eval since the cache has no reference point upon which to determine if the eval'd code has been previously compiled and has changed since. I guess I considered something like call_user_func($some variables) was somewhat equivalent of an eval... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
scubak1w1 wrote: Hello, Banging my head against this one... Briefly: - I have two forms on the same page - both forms are: action=?php print $_SERVER['PHP_SELF']; ? method=post - both forms gave unique ids - both forms have a hidden file of the type input type=hidden name=_add_new_module_details value=1 / which is checked directly below the form with an if(array_key_exists('_add_new_module_details', $_POST)) { ...} method - first form is a file upload - 2nd form is a details submit - submit button on 2nd form is only 'turned on' (via AJAX) once the user has uploaded file file - 2nd form validated fields contents, via an onsubmit - after 2nd form successuly submitted, head off back to another page In Internet Destroyer, the page works just fine (i.e., both forms fire as expected) In the non-IE browsers I have tried (Firefox, Chrome, Opera), the first form uploads the file properly, the 2nd form's submit is 'turned on' by AJAX - BUT the submit button on the 2nd form doesn't seem to do anything - i.e., the onsubmit is not being triggered, etc, etc help! smile Thanks in advance: GREG Have you checked the Javascript error console in Firefox? -- Micah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP to create an ERD (sic) on the fly on a web page based on current DB records?
On Thu, 12 Mar 2009 18:47:40 -0600, scubak1w1 wrote: Seeking some advice on how to create an ERD (sic) graphically on the page on the fly when the page is 'called'... [...] Maybe GraphViz? http://graphviz.org/ -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
On Thu, 12 Mar 2009 18:39:38 -0600, scubak1w1 wrote: [...] In the non-IE browsers I have tried (Firefox, Chrome, Opera), the first form uploads the file properly, the 2nd form's submit is 'turned on' by AJAX - BUT the submit button on the 2nd form doesn't seem to do anything - i.e., the onsubmit is not being triggered, etc, etc How do you turn on your submit button? (for that matter, how do you turn it off?) Have you checked Firefox's log to see if you have JavaScript errors? -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
On Fri, 2009-03-13 at 02:06 -0500, Micah Gersten wrote: scubak1w1 wrote: Hello, Banging my head against this one... Briefly: - I have two forms on the same page - both forms are: action=?php print $_SERVER['PHP_SELF']; ? method=post - both forms gave unique ids - both forms have a hidden file of the type input type=hidden name=_add_new_module_details value=1 / which is checked directly below the form with an if(array_key_exists('_add_new_module_details', $_POST)) { ...} method - first form is a file upload - 2nd form is a details submit - submit button on 2nd form is only 'turned on' (via AJAX) once the user has uploaded file file - 2nd form validated fields contents, via an onsubmit - after 2nd form successuly submitted, head off back to another page In Internet Destroyer, the page works just fine (i.e., both forms fire as expected) In the non-IE browsers I have tried (Firefox, Chrome, Opera), the first form uploads the file properly, the 2nd form's submit is 'turned on' by AJAX - BUT the submit button on the 2nd form doesn't seem to do anything - i.e., the onsubmit is not being triggered, etc, etc help! smile Thanks in advance: GREG Have you checked the Javascript error console in Firefox? -- Micah It sounds like a script error rather than a PHP error. Use Firebug which will show you the HTML as it is updated by Javascript, so you can see where the problem is. I'm willing to bet that the Javascript code you are using is IE only. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
It sounds like a script error rather than a PHP error. Use Firebug which will show you the HTML as it is updated by Javascript, so you can see where the problem is. I'm willing to bet that the Javascript code you are using is IE only. Yeah, php is never browser specific. It is rendered to HTML before browser can see it. So all browsers will react the same with PHP. But will differ on the client sides like JavaScript.
[PHP] php 5.2.8 to 5.2.9 concerns
In 5.2.9 I was seeing /usr/local/lib/php/includes/XBT/class/pstgrs_DB.php(70) : Warning - pg_query(): supplied argument is not a valid PostgreSQL link resource /usr/local/lib/php/includes/XBT/class/pstgrs_DB.php(70) : Warning - pg_query() [a href='function.pg-query'function.pg-query/a]: Query failed: ERROR: insert or update on table quot;tour_timesquot; violates foreign key constraint quot;ttm_rac_fkquot; /usr/local/lib/php/includes/XBT/class/pstgrs_DB.php(70) : Warning - pg_query() [a href='function.pg-query'function.pg-query/a]: Query failed: ERROR: insert or update on table quot;tour_timesquot; violates foreign key constraint quot;ttm_rac_fkquot; /usr/local/lib/php/includes/XBT/class/pstgrs_DB.php(72) : Fatal error - Call to undefined function pg_affected_rows() for Postgres 8.1 latest . This is not the case in 5.2.8 What is going on? I used ./configure \ --with-apxs2 \ --enable-embed=shared \ --enable-fastcgi \ --enable-force-cgi-redirect \ --enable-debug \ --with-openssl=/usr \ --with-zlib=/usr \ --with-bz2=/usr \ --enable-calendar \ --enable-ftp \ --with-openssl-dir=/usr \ --with-zlib-dir=/usr \ --with-pdo-pgsql=/usr/local/pgsql/bin \ --with-pgsql=/usr/local/pgsql \ --enable-shared --disable-static to build both libphp5.so modules . -- Member - Liberal International This is doc...@nl2k.ab.ca Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising! Never Satan President Republic! Point to http://tv.cityonahillproductions.com/ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Knowledge Base software - looking for opinions
From: haliphax On Thu, Mar 12, 2009 at 3:44 PM, Paul M Foster pa...@quillandmouse.com wrote: On Thu, Mar 12, 2009 at 12:55:54PM -0700, mike wrote: http://puresw.com/products/lore/ - paid http://www.knowledgebase-script.com/ - paid http://68kb.com/ - free Free is good. Just needs to be basic, nothing crazy. A Wiki -almost- meets the needs but a) I hate wikis and b) they don't match up 100% Out of curiosity, why do you dislike wikis? It may be the lack of access permissions in a lot of the wiki systems out there right now... though some of them have an access control layer (such as TWiki). Dokuwiki http://wiki.splitbrain.org/wiki:dokuwiki has an optional ACL layer for access control. There are also several options for authentication back ends. We used it in a grass roots project for over a year before management decide it was a good idea and bought a site license for Confluence as the official company wide knowledge base. I was trying to get the LDAP interface working with Active Directory when they informed me it was going to be phased out. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP to create an ERD (sic) on the fly on a web page based on current DB records?
On Thu, Mar 12, 2009 at 7:47 PM, scubak1w1 sk...@spamcop.net wrote: Hello, Seeking some advice on how to create an ERD (sic) graphically on the page on the fly when the page is 'called'... That is, I have a backend PostgreSQL database that I am getting data from and putting data into via web page/s and PHP... I would like to be able to show graphically to the web site admins the relationships between the pimary key contents of one table to all its foreign keys in the daughter table in a form of a simple entity relationship diagram. That is, a graphic showing (say) all of the PKs listed in the mother table, all of the more voluminous (sic) FKs listed in another table - and connecting lines. This is to aid the admin users that are used to conceptualiazing this sort of thing... PHPMyAdmin does exactly this sort of thing, as do a lot of SQL workbench programs. I'm sure there is one out there that will handle PostgreSQL. My advice to you is not to reinvent the wheel. If they're admin users, do you really need to wrap it up in a self-contained webpage for them, or could you just show them using an administrative tool that can handle ERD? -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
On Fri, Mar 13, 2009 at 3:18 AM, 9el le...@phpxperts.net wrote: It sounds like a script error rather than a PHP error. Use Firebug which will show you the HTML as it is updated by Javascript, so you can see where the problem is. I'm willing to bet that the Javascript code you are using is IE only. Yeah, php is never browser specific. It is rendered to HTML before browser can see it. So all browsers will react the same with PHP. But will differ on the client sides like JavaScript. Also--INCLUDE YOUR CODE. Listing everything you do in pseudocode will do you absolutely no good for a problem like this, as it is no doubt a syntax error or a browser-javascript-compatibility issue. If we can't see the code, we can't point out the problem. Anyway, yeah--if it works in IE and not in FF, then it has nothing to do with PHP (directly). Change your JS. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Export/Write rows from DBF to CSV
Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Export/Write rows from DBF to CSV
On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari sleepwal...@rahulsjohari.com wrote: Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You are overwriting the variable ($csv_data) that holds the row, add a period (concatenator) operator to build the up the data #WRITE ROWS TO VARIABLE $_csv_data .= trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! -- Bastien Cat, the other other white meat
Re: [PHP] PHP to create an ERD (sic) on the fly on a web page based on current DB records?
On Fri, Mar 13, 2009 at 9:37 AM, haliphax halip...@gmail.com wrote: On Thu, Mar 12, 2009 at 7:47 PM, scubak1w1 sk...@spamcop.net wrote: Hello, Seeking some advice on how to create an ERD (sic) graphically on the page on the fly when the page is 'called'... That is, I have a backend PostgreSQL database that I am getting data from and putting data into via web page/s and PHP... I would like to be able to show graphically to the web site admins the relationships between the pimary key contents of one table to all its foreign keys in the daughter table in a form of a simple entity relationship diagram. That is, a graphic showing (say) all of the PKs listed in the mother table, all of the more voluminous (sic) FKs listed in another table - and connecting lines. This is to aid the admin users that are used to conceptualiazing this sort of thing... PHPMyAdmin does exactly this sort of thing, as do a lot of SQL workbench programs. I'm sure there is one out there that will handle PostgreSQL. My advice to you is not to reinvent the wheel. If they're admin users, do you really need to wrap it up in a self-contained webpage for them, or could you just show them using an administrative tool that can handle ERD? -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php there is a version of phpmyadmin for postgre. phppgadmin is available from sourceforge.net -- Bastien Cat, the other other white meat
[PHP] bad interpreter error from CLI
Hi gang, I am trying to run a script from cli which goes like this: #!/usr/bin/php ?php passthru(printenv); ? The error I get is this: /usr/bin/php^M: bad interpreter: Permission denied the php binary is indeed in this location and when I run the same script like this: php -f test.php it works properly. I will have to mention that the executable flag is set in the file's permissions. Any ideas why is this happening? php -v gives me: PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bad interpreter error from CLI
On Fri, Mar 13, 2009 at 10:10, Thodoris t...@kinetix.gr wrote: Hi gang, I am trying to run a script from cli which goes like this: #!/usr/bin/php ?php passthru(printenv); ? The error I get is this: /usr/bin/php^M: bad interpreter: Permission denied Note the ^M --- then use dos2unix from the command line on the Linux box to fix the line endings on that file. The ^M character is a sure-fire sign of a Windows-saved file. the php binary is indeed in this location and when I run the same script like this: php -f test.php it works properly. I will have to mention that the executable flag is set in the file's permissions. Any ideas why is this happening? php -v gives me: PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies The above should no doubt fix it, but in the event that it does not, check the output from the following command line commands on your Linux box: which php whereis php The first will tell you which PHP CLI binary is preferred by the current $PATH settings, while the second will tell you where in $PATH 'php' is located. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Export/Write rows from DBF to CSV
On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote: On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari sleepwal...@rahulsjohari.com wrote: Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You are overwriting the variable ($csv_data) that holds the row, add a period (concatenator) operator to build the up the data #WRITE ROWS TO VARIABLE $_csv_data .= trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! -- Bastien Cat, the other other white meat AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!! Much Thanks :) --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bad interpreter error from CLI
Note the ^M --- then use dos2unix from the command line on the Linux box to fix the line endings on that file. The ^M character is a sure-fire sign of a Windows-saved file. Already tried that but I still get the same error (without the ^M of course) so I think it's not the line termination. the php binary is indeed in this location and when I run the same script like this: php -f test.php it works properly. I will have to mention that the executable flag is set in the file's permissions. Any ideas why is this happening? php -v gives me: PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies The above should no doubt fix it, but in the event that it does not, check the output from the following command line commands on your Linux box: which php whereis php The first will tell you which PHP CLI binary is preferred by the current $PATH settings, while the second will tell you where in $PATH 'php' is located. Both commands return the same path. -- Thodoris
Re: [PHP] php 5.2.8 to 5.2.9 concerns
On Fri, Mar 13, 2009 at 05:01, The Doctor doc...@doctor.nl2k.ab.ca wrote: [snip!] What is going on? [snip!] The warnings could've indicated simply that the error reporting configuration was different between your builds, but the failure - when both were built the same way for PostgreSQL. Are both on the same system? Were there any build warnings or errors related to pgsql? -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bad interpreter error from CLI
On Fri, Mar 13, 2009 at 10:23, Thodoris t...@kinetix.gr wrote: [snip!] Both commands return the same path. and that path, I'll presume, is the same you have set in the script, right? Please offer as much information as you can with each email to speed up the troubleshooting process. ;-P What's the output you get from the following (copied exactly)? ls -l /usr/bin/php ls -l `which php` -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 5.2.8 to 5.2.9 concerns
On Fri, Mar 13, 2009 at 10:30:47AM -0400, Daniel Brown wrote: On Fri, Mar 13, 2009 at 05:01, The Doctor doc...@doctor.nl2k.ab.ca wrote: [snip!] What is going on? [snip!] The warnings could've indicated simply that the error reporting configuration was different between your builds, but the failure - when both were built the same way for PostgreSQL. Are both on the same system? Were there any build warnings or errors related to pgsql? The answer is yes to both. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- Member - Liberal International This is doc...@nl2k.ab.ca Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising! Never Satan President Republic! Point to http://tv.cityonahillproductions.com/ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 5.2.8 to 5.2.9 concerns
On Fri, Mar 13, 2009 at 10:30:47AM -0400, Daniel Brown wrote: On Fri, Mar 13, 2009 at 05:01, The Doctor doc...@doctor.nl2k.ab.ca wrote: [snip!] What is going on? [snip!] The warnings could've indicated simply that the error reporting configuration was different between your builds, but the failure - when both were built the same way for PostgreSQL. Are both on the same system? Were there any build warnings or errors related to pgsql? Whoops!! Yes to the former and no to the latter. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- Member - Liberal International This is doc...@nl2k.ab.ca Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising! Never Satan President Republic! Point to http://tv.cityonahillproductions.com/ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bad interpreter error from CLI
Thodoris wrote: Hi gang, I am trying to run a script from cli which goes like this: #!/usr/bin/php ?php passthru(printenv); ? The error I get is this: /usr/bin/php^M: bad interpreter: Permission denied the php binary is indeed in this location and when I run the same script like this: php -f test.php it works properly. I will have to mention that the executable flag is set in the file's permissions. Any ideas why is this happening? php -v gives me: PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies Does the filesystem the scripts are on by any chance has 'noexec' set? $ mount (rw,noexec,nosuid,nodev) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bad interpreter error from CLI
On Fri, Mar 13, 2009 at 10:23, Thodoris t...@kinetix.gr wrote: [snip!] Both commands return the same path. and that path, I'll presume, is the same you have set in the script, right? Please offer as much information as you can with each email to speed up the troubleshooting process. ;-P What's the output you get from the following (copied exactly)? ls -l /usr/bin/php ls -l `which php` [r...@foo tmp]# ls -l /usr/bin/php -rwxr-xr-x 1 root root 2702972 Nov 12 16:24 /usr/bin/php [r...@foo tmp]# ls -l `which php` -rwxr-xr-x 1 root root 2702972 Nov 12 16:24 /usr/bin/php I did mention that it works using php -f didn't I? So it actually finds the binary because it is in the path :-) . -- Thodoris
Re: [PHP] bad interpreter error from CLI
Thodoris wrote: Hi gang, I am trying to run a script from cli which goes like this: #!/usr/bin/php ?php passthru(printenv); ? The error I get is this: /usr/bin/php^M: bad interpreter: Permission denied the php binary is indeed in this location and when I run the same script like this: php -f test.php it works properly. I will have to mention that the executable flag is set in the file's permissions. Any ideas why is this happening? php -v gives me: PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies Does the filesystem the scripts are on by any chance has 'noexec' set? $ mount (rw,noexec,nosuid,nodev) Yes this is the problem !! How did I miss that? Thanks for the help. -- Thodoris
Re: [PHP] Export/Write rows from DBF to CSV
Rahul S. Johari wrote: On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote: On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari sleepwal...@rahulsjohari.com wrote: Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php @fwrite( $_fp, $_csv_data ); You are overwriting the variable ($csv_data) that holds the row, add a period (concatenator) operator to build the up the data #WRITE ROWS TO VARIABLE $_csv_data .= trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! -- Bastien Cat, the other other white meat AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!! Much Thanks :) Or even simpler and won't build a huge string if you have millions of rows, just move your fwrite() up into the loop to write each record to the csv: #WRITE ROWS TO VARIABLE AND WRITE LINE TO CSV $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; @fwrite( $_fp, $_csv_data ); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header - Redirect Command Not Working
2009/3/11 Daniel Brown danbr...@php.net: On Wed, Mar 11, 2009 at 12:38, Jan G.B. ro0ot.w...@googlemail.com wrote: wrong: Location: file.txt and this is correct Location: http://www.x.x/file.txt; Not all clients behave like yours and accept the wrong header. The *protocol* does not, but the HTTP/1.1 specification does. However, it should be noted that *all* modern browsers accept relative URI's vs. the requirement of absolute URI's. Thus, the header is non-standard, but is not wrong. Your point is accurate, though: it should include the full resource. erm META should be in a html document inside the HEAD, not *anywhere*. That's the recommended order, but it's not required. Not even in 1982 when the spec was written. In fact, the placement in HEAD is so that, with the original specifications, a server would be permitted (though again, not required) to read the META tags within HEAD to form and send its own headers via HTTP in conjunction with the plain-text data from the document. Very, very, very bad idea. You just opened a cross site scripting bug. Imagine someone opens this URL host/yourfile?id=scriptalert(document.cookie)/script You must always escape any input you take. see http://php.net/security This is always true of any user-side input being sent to a script (though the example may seem a little humorous because, if a person is that desperate to see their cookie data, their browser truly sucks). Once again, for anyone who hasn't been paying attention or who doesn't yet have the acquired knowledge from their own painful experiences, *never* copy and paste code from this list or any other medium. Always evaluate it yourself first. This list is meant for assistance and those on it provide pseudocode, not production-worthy code. The rest is, as has always been, at your own risk. Where's your point? Proving that you know the well known clients and their behaviour? Just stick to the standards. easy. no or less errors occur. Also, it's quite clear to any thinking person, that alerting the cookie is an example that shows how easy an attacker can catch the session id. it's a well known common example. it's more humorous that your choice is to ignore or fight RFCs, open standards and that you don't even know the most common XSS example - but that is just my opninion. :-) have a nice day. /Daniel P. Brown 50% Off All Shared Hosting Plans at PilotPig: Use Coupon x stop spamming me, thanks. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone fancy getting paid to improve my PHP in London?
Do any experienced PHP programmers in London fancy helping me improve my PHP? I'd like to know where my code could be improved and to be shown how an experienced programmer would approach a new site. I'd rather pay the right person a high amount than find someone cheap! Thanks, Tom PS - May as well take this opportunity to thank to everyone on the list that's helped me out so far!
Re: [PHP] Anyone fancy getting paid to improve my PHP in London?
On Fri, 2009-03-13 at 17:16 +, Tom Chubb wrote: Do any experienced PHP programmers in London fancy helping me improve my PHP? I'd like to know where my code could be improved and to be shown how an experienced programmer would approach a new site. I'd rather pay the right person a high amount than find someone cheap! Thanks, Send me a blank cheque-- if it clears then I'll get back to you... from someplace warm... by a beach while drinking martinis... and getting a massage... from more than one lady... Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htmlentities is incomplete: does not cover rsquo etc
2009/3/13 Heddon's Gate Hotel ho...@heddonsgate.co.uk: The string function htmlentities seems to have very incomplete coverage of the HTML entities listed in the HTML 4 spec. For example, it does not know about rsquo, lsquo, rdquo, ldquo, etc. This is confirmed by looking at the output of get_html_translation_table, which does not list these entities. My impression is that it covers those HTML entities that are in ISO-8859-1, but not the others. Is this deliberate? If so, the Manual is misleading because it suggests that all HTML entities are covered. Otherwise, is this a bug? Well, If you specify the input charset you'll have no problem at all. ;) ?= htmlentities('string with UTF-8: ±ªÐº×Nµ»n“¢µ€jæ', ENT_QUOTES, 'UTF-8'); ? Latin1 AKA ISO-8859-1 doesn't have ldquo nor bdquo nor ndash and alike. Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sanitizing Numbers
I'm trying to sanitize some numeric data that's coming to us from another system which I have no control over where all fields are character fields with no formatting from the end user so data is a mishmash of clean and mixed types of dirty. I know I can use intval and floatval to sanitize if the numeric data is at the front of the string but what about when it's not? For example, Jersey Number = #45 or Dues = $1,234.56 I see in the comments at php.net for floatval a lot of very complex solutions... am I missing something about the following that wouldn't cover me? ?php $output = floatval(ereg_replace([^-0-9\.],,$input)); ? I'm willing to assuming only US formatted numbers... and knowing that if they put in 45/46 for jersey it would come out 4546 (but I might put in additional code for that specific case on that specific field...). I'm also looking for something that I can generically apply to any numeric field. Thanks for your collective guidance. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Export/Write rows from DBF to CSV
On Mar 13, 2009, at 11:44 AM, Shawn McKenzie wrote: Rahul S. Johari wrote: On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote: On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari sleepwal...@rahulsjohari.com wrote: Ave, I'm trying to retrieve data from a DBF database and write it to a CSV file in a comma delimited format. I'm able to get the data and write it to CSV, but it only writes the last row/record ... not all the records. I know I don't have the correct code and I'm hoping someone can help me... _ #CREATE CSV $date = date('mdy'); $_file = 'CSV/TransferData_'.$date.'.csv'; $_fp = @fopen( $_file, 'w' ); #SELECT DBF TO OPEN - READ ONLY $db = dbase_open(mydata.dbf, 0); #PULL UP RECORD if ($db) { $record_numbers = dbase_numrecords($db); for ($i = 1; $i = $record_numbers; $i++) { $row = dbase_get_record_with_names($db, $i); #WRITE ROWS TO VARIABLE $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! } } #WRITE TO CSV @fwrite( $_fp, $_csv_data ); @fclose( $_fp ); _ Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php @fwrite( $_fp, $_csv_data ); You are overwriting the variable ($csv_data) that holds the row, add a period (concatenator) operator to build the up the data #WRITE ROWS TO VARIABLE $_csv_data .= trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is where my problem is! This only writes the last row!! -- Bastien Cat, the other other white meat AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!! Much Thanks :) Or even simpler and won't build a huge string if you have millions of rows, just move your fwrite() up into the loop to write each record to the csv: #WRITE ROWS TO VARIABLE AND WRITE LINE TO CSV $_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n; @fwrite( $_fp, $_csv_data ); -- Thanks! -Shawn http://www.spidean.com Very, Very Interesting Snippet - works perfectly fine and I agree, more efficient! Thanks!! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header - Redirect Command Not Working
On Fri, Mar 13, 2009 at 13:15, Jan G.B. ro0ot.w...@googlemail.com wrote: Where's your point? Proving that you know the well known clients and their behaviour? Just stick to the standards. easy. no or less errors occur. Okay, I'm not going to get into a flame war with you, because it's obvious that your native language isn't English, and you may not understand that what I'm saying is not in contradiction to you, but rather explaining points you've made. Also, it's quite clear to any thinking person, that alerting the cookie is an example that shows how easy an attacker can catch the session id. it's a well known common example. it's more humorous that your choice is to ignore or fight RFCs, open standards and that you don't even know the most common XSS example - but that is just my opninion. :-) What's humorous to me is that you came out of nowhere and have no understanding or respect for plain logic in mailing list communication. I never chose to ignore or fight RFCs, Jan --- I'm the one who alluded to them in the first place (the spec) comments. After you've had a few more years at the command of your keyboard and develop a more thorough understanding of communication and technical documents instead of the hacker mindset - a term I use very loosely here - then I'd welcome discussion on your points. Because while some are valid, the presentation plainly needs work. Oh, and what you presented as your opninion wasn't even close to being accurate. You should instead have said it's what you assumed, for many obvious reasons. Take that as poignantly as I am inferring it. have a nice day. /Daniel P. Brown 50% Off All Shared Hosting Plans at PilotPig: Use Coupon x stop spamming me, thanks. :-) Learn the definition of spamming before you join a mailing list, thanks. ;-P -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
Jim Lucas wrote: PJ wrote: am resending as this was erroneously ccd to mysql. sorry! Ashley Sheridan wrote: On Thu, 2009-02-26 at 11:27 -0500, PJ wrote: Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Thanks, Jerry, You hit the nail on the head.:) To refine my problem (and reduce my ignorance),here's what is happening on the form page: There is a series of INSERTs. The first inserts all the columns of book table except for the id, which I do not specify as it if auto-insert. In subsequent tables I have to reference the book.id (for transitional tables like book_author(refers authors to book) etc. If I understand it correctly, I must retrieve (SELECT LAST_INSERT_ID()) after the first INSERT and before the following insert; and save the id as a string ($id)...e.g. $sql = SELECT LAST_INSERT_ID() AS $id I need clarification on the AS $id - should this be simply id(does this have to be turned into a value into $id or does $id contain the value? And how do I retrieve it to use the returned value for the next $sql = INSERT ... - in other words, is the id or $id available for the next directive or do I have to do something like $id = id? I'm trying to figure this out with some trials but my insert does not work from a php file - but it works from command-line... that's another post. Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result = mysql_query($query); No need to call another query to retrieve the last inserted id, as it is tied to the last query executed within this session. Ash www.ashleysheridan.co.uk For some reason or other $autoId = mysql_insert_id($result); just does not work for me... Yet some of the data is inserted correctly... I did find that it does not work on tables that are empty... so you can't start with an empty table. I entered data it still did not work. I tried on another duplicate database... doesn't work. I have checked double checked the database, I have added checks to see what is returned and the returns are 0 or null - as I get different responses for slightly different functions. sessions is on mysql is 5.1.28 php5 here's what is parsed: else { $sql1 = INSERT INTO book ( title, sub_title, descr, comment, bk_cover, copyright, ISBN, language, sellers ) VALUES ('$titleIN', '$sub_titleIN', '$descrIN', '$commentIN', '$bk_coverIN', '$copyrightIN', '$ISBNIN', '$languageIN', '$sellersIN'); $result1 = mysql_query($sql1, $db); $autoid = mysql_insert_id($result1); $sql2 = INSERT INTO author (first_name, last_name) VALUES ('$first_nameIN', '$last_nameIN'); $result2 = mysql_query($sql2, $db); $authorID = mysql_insert_id($result2); $sql2a = INSERT INTO book_author (authID, bookID, ordinal) VALUES ( '$authorID', '$autoid', '1'); $result2a = mysql_query($sql2a, $db); $sql2b = INSERT INTO author (first_name, last_name) VALUES ('$first_name2IN', '$last_name2IN'); $result2b = mysql_query($sql2b, $db); $author2ID = mysql_insert_id($result2b); $sql2c = INSERT INTO book_author (authID, bookID, ordinal) VALUES ( '$author2ID', '$autoid', '2'); $result2c = mysql_query($sql2c, $db); $sql3 = INSERT INTO publishers (publisher) VALUES ('$publisherIN'); $result3 = mysql_query($sql3, $db); $publisherID = mysql_insert_id($result3); $sql3a = INSERT INTO book_publisher (bookID, publishers_id) VALUES ( '$autoid', '$publisherID' ); $result3a = mysql_query($sql3a, $db); foreach($_POST['categoriesIN'] as $category){ $sql4 = INSERT INTO book_categories (book_id, categories_id) VALUES ($autoid, $category); $result4 = mysql_query($sql4,$db); } echo $autoid; // shows: blank
Re: [PHP] Sanitizing Numbers
On Fri, Mar 13, 2009 at 12:34 PM, Matt Neimeyer m...@neimeyer.org wrote: I'm trying to sanitize some numeric data that's coming to us from another system which I have no control over where all fields are character fields with no formatting from the end user so data is a mishmash of clean and mixed types of dirty. I know I can use intval and floatval to sanitize if the numeric data is at the front of the string but what about when it's not? For example, Jersey Number = #45 or Dues = $1,234.56 I see in the comments at php.net for floatval a lot of very complex solutions... am I missing something about the following that wouldn't cover me? ?php $output = floatval(ereg_replace([^-0-9\.],,$input)); ? I'm willing to assuming only US formatted numbers... and knowing that if they put in 45/46 for jersey it would come out 4546 (but I might put in additional code for that specific case on that specific field...). I'm also looking for something that I can generically apply to any numeric field. Man... I went completely apeshit on this with regex and made this long, complicated string to match numeric values and strip out possible false positives like IP addresses, etc... if you really want it, I'll post it. Anyway, the point I'm going to make instead is that you need to do more than just strip out everything but numbers and periods unless all of your values are going to be in the format Some name = [possible junk]some value[possible junk]. If all of your values are guaranteed to be in this format, and there will be no values that would act as false positives (like IP addresses), then stripping everything but numbers and periods should be fine. However, values like 1 and 5 will turn into 15, 3 sizes. 30 day trial. will return 3.30, etc... just something to keep in mind (if cases like these can arise in your data). -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
On Fri, Mar 13, 2009 at 1:24 PM, PJ af.gour...@videotron.ca wrote: Jim Lucas wrote: PJ wrote: am resending as this was erroneously ccd to mysql. sorry! Ashley Sheridan wrote: On Thu, 2009-02-26 at 11:27 -0500, PJ wrote: Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Thanks, Jerry, You hit the nail on the head.:) To refine my problem (and reduce my ignorance),here's what is happening on the form page: There is a series of INSERTs. The first inserts all the columns of book table except for the id, which I do not specify as it if auto-insert. In subsequent tables I have to reference the book.id (for transitional tables like book_author(refers authors to book) etc. If I understand it correctly, I must retrieve (SELECT LAST_INSERT_ID()) after the first INSERT and before the following insert; and save the id as a string ($id)...e.g. $sql = SELECT LAST_INSERT_ID() AS $id I need clarification on the AS $id - should this be simply id(does this have to be turned into a value into $id or does $id contain the value? And how do I retrieve it to use the returned value for the next $sql = INSERT ... - in other words, is the id or $id available for the next directive or do I have to do something like $id = id? I'm trying to figure this out with some trials but my insert does not work from a php file - but it works from command-line... that's another post. Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result = mysql_query($query); No need to call another query to retrieve the last inserted id, as it is tied to the last query executed within this session. Ash www.ashleysheridan.co.uk For some reason or other $autoId = mysql_insert_id($result); just does not work for me... Yet some of the data is inserted correctly... I did find that it does not work on tables that are empty... so you can't start with an empty table. I entered data it still did not work. I tried on another duplicate database... doesn't work. I have checked double checked the database, I have added checks to see what is returned and the returns are 0 or null - as I get different responses for slightly different functions. sessions is on mysql is 5.1.28 php5 here's what is parsed: else { $sql1 = INSERT INTO book ( title, sub_title, descr, comment, bk_cover, copyright, ISBN, language, sellers ) VALUES ('$titleIN', '$sub_titleIN', '$descrIN', '$commentIN', '$bk_coverIN', '$copyrightIN', '$ISBNIN', '$languageIN', '$sellersIN'); $result1 = mysql_query($sql1, $db); $autoid = mysql_insert_id($result1); $sql2 = INSERT INTO author (first_name, last_name) VALUES ('$first_nameIN', '$last_nameIN'); $result2 = mysql_query($sql2, $db); $authorID = mysql_insert_id($result2); $sql2a = INSERT INTO book_author (authID, bookID, ordinal) VALUES ( '$authorID', '$autoid', '1'); $result2a = mysql_query($sql2a, $db); $sql2b = INSERT INTO author (first_name, last_name) VALUES ('$first_name2IN', '$last_name2IN'); $result2b = mysql_query($sql2b, $db); $author2ID = mysql_insert_id($result2b); $sql2c = INSERT INTO book_author (authID, bookID, ordinal) VALUES ( '$author2ID', '$autoid', '2'); $result2c = mysql_query($sql2c, $db); $sql3 = INSERT INTO publishers (publisher) VALUES ('$publisherIN'); $result3 = mysql_query($sql3, $db); $publisherID = mysql_insert_id($result3); $sql3a = INSERT INTO book_publisher (bookID, publishers_id) VALUES ( '$autoid', '$publisherID' ); $result3a = mysql_query($sql3a, $db); foreach($_POST['categoriesIN'] as $category){ $sql4 = INSERT INTO book_categories (book_id, categories_id) VALUES ($autoid, $category); $result4 =
Re: [PHP] Sanitizing Numbers
ereg [Gasps and runs off shouting PCRE] ... -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated February 28th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sanitizing Numbers
On Fri, Mar 13, 2009 at 2:09 PM, Richard Heyes rich...@php.net wrote: ereg [Gasps and runs off shouting PCRE] ... -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated February 28th) You can bet your shirt my tests were using preg_replace... :) -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone fancy getting paid to improve my PHP in London?
Robert Cummings schreef: On Fri, 2009-03-13 at 17:16 +, Tom Chubb wrote: Do any experienced PHP programmers in London fancy helping me improve my PHP? I'd like to know where my code could be improved and to be shown how an experienced programmer would approach a new site. I'd rather pay the right person a high amount than find someone cheap! Thanks, Send me a blank cheque-- if it clears then I'll get back to you... from someplace warm... by a beach while drinking martinis... and getting a massage... from more than one lady... should we forward this to your wife now, or after the check clears? Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sanitizing Numbers
On Fri, 2009-03-13 at 19:09 +, Richard Heyes wrote: ereg [Gasps and runs off shouting PCRE] ... You know... Until somewhat recently I preferred POSIX over PCRE... rationale being it's POSIX that's a standard!!! But recently I came across some legacy code in a site I maintain that was using ereg(). It just so happened I was tracking down another bug and so I was doing some timestamp squeezing to find the problem when I discovered a horrible horrible thing... a few preg() calls with capturing were resposible for 50% of the page load time. I changed them to preg_match() and I cut the page time in half since the preg_match() time was negligible. I now much prefer to use preg_xxx() functions since I have concrete evidence of their superiority. Cheers, Rob. Ps. The docs always said that ereg() was a bit slower... they didn't say it was severely debilitating. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone fancy getting paid to improve my PHP in London?
On Fri, 2009-03-13 at 20:17 +0100, Jochem Maas wrote: Robert Cummings schreef: On Fri, 2009-03-13 at 17:16 +, Tom Chubb wrote: Do any experienced PHP programmers in London fancy helping me improve my PHP? I'd like to know where my code could be improved and to be shown how an experienced programmer would approach a new site. I'd rather pay the right person a high amount than find someone cheap! Thanks, Send me a blank cheque-- if it clears then I'll get back to you... from someplace warm... by a beach while drinking martinis... and getting a massage... from more than one lady... should we forward this to your wife now, or after the check clears? She's one of the ladies... she's in on it!!! Cheers, Rob. Ps. don't forward this one off to her :) -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sanitizing Numbers
On Fri, 2009-03-13 at 15:45 -0400, Robert Cummings wrote: On Fri, 2009-03-13 at 19:09 +, Richard Heyes wrote: ereg [Gasps and runs off shouting PCRE] ... You know... Until somewhat recently I preferred POSIX over PCRE... rationale being it's POSIX that's a standard!!! But recently I came across some legacy code in a site I maintain that was using ereg(). It just so happened I was tracking down another bug and so I was doing some timestamp squeezing to find the problem when I discovered a horrible horrible thing... a few preg() calls Should have said... a few ereg() calls. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone fancy getting paid to improve my PHP in London?
Robert Cummings wrote: Send me a blank cheque-- if it clears then I'll get back to you... from someplace warm... by a beach while drinking martinis... and getting a massage... from more than one lady... should we forward this to your wife now, or after the check clears? She's one of the ladies... she's in on it!!! Warning: constant ladies defined incorrectly in 1236973618.10169.75.ca...@localhost line 7 /troll :-D Kevin Kinsey -- Even if you do learn to speak correct English, whom are you going to speak it to? -- Clarence Darrow -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() is duplicating
I have several forms on my site that use the same sequence of events: The first script displays and validates the form data, the second reformats and asks for confirmation or editing, and the third script sends the data in an email to the relevent people. Two of these forms work exactly as they're supposed to but the third sends duplicate emails to everyone. I have looked and looked and I've run diff and I can see no reason why this should be happening. Could someone suggest what I might have wrong? -- The notion that a radical is one who hates his country is naive and usually idiotic. He is, more likely, one who likes his country more than the rest of us, and is thus more disturbed than the rest of us when he sees it debauched. He is not a bad citizen turning to crime; he is a good citizen driven to despair. --- H. L. Mencken Rick Pasottor...@niof.nethttp://www.niof.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
haliphax wrote: On Fri, Mar 13, 2009 at 1:24 PM, PJ af.gour...@videotron.ca wrote: Jim Lucas wrote: PJ wrote: am resending as this was erroneously ccd to mysql. sorry! Ashley Sheridan wrote: On Thu, 2009-02-26 at 11:27 -0500, PJ wrote: Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Thanks, Jerry, You hit the nail on the head.:) To refine my problem (and reduce my ignorance),here's what is happening on the form page: There is a series of INSERTs. The first inserts all the columns of book table except for the id, which I do not specify as it if auto-insert. In subsequent tables I have to reference the book.id (for transitional tables like book_author(refers authors to book) etc. If I understand it correctly, I must retrieve (SELECT LAST_INSERT_ID()) after the first INSERT and before the following insert; and save the id as a string ($id)...e.g. $sql = SELECT LAST_INSERT_ID() AS $id I need clarification on the AS $id - should this be simply id(does this have to be turned into a value into $id or does $id contain the value? And how do I retrieve it to use the returned value for the next $sql = INSERT ... - in other words, is the id or $id available for the next directive or do I have to do something like $id = id? I'm trying to figure this out with some trials but my insert does not work from a php file - but it works from command-line... that's another post. Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result = mysql_query($query); No need to call another query to retrieve the last inserted id, as it is tied to the last query executed within this session. Ash www.ashleysheridan.co.uk For some reason or other $autoId = mysql_insert_id($result); just does not work for me... Yet some of the data is inserted correctly... I did find that it does not work on tables that are empty... so you can't start with an empty table. I entered data it still did not work. I tried on another duplicate database... doesn't work. I have checked double checked the database, I have added checks to see what is returned and the returns are 0 or null - as I get different responses for slightly different functions. sessions is on mysql is 5.1.28 php5 here's what is parsed: else { $sql1 = INSERT INTO book           ( title, sub_title, descr, comment, bk_cover, copyright, ISBN, language, sellers )         VALUES           ('$titleIN', '$sub_titleIN', '$descrIN',           '$commentIN', '$bk_coverIN', '$copyrightIN', '$ISBNIN', '$languageIN', '$sellersIN');     $result1 = mysql_query($sql1, $db);   $autoid = mysql_insert_id($result1);     $sql2 = INSERT INTO author (first_name, last_name) VALUES ('$first_nameIN', '$last_nameIN');       $result2 = mysql_query($sql2, $db);   $authorID = mysql_insert_id($result2);     $sql2a = INSERT INTO book_author (authID, bookID, ordinal) VALUES ( '$authorID', '$autoid', '1');       $result2a = mysql_query($sql2a, $db);     $sql2b = INSERT INTO author (first_name, last_name) VALUES ('$first_name2IN', '$last_name2IN');       $result2b = mysql_query($sql2b, $db);   $author2ID = mysql_insert_id($result2b);     $sql2c = INSERT INTO book_author (authID, bookID, ordinal) VALUES ( '$author2ID', '$autoid', '2');       $result2c = mysql_query($sql2c, $db);     $sql3 = INSERT INTO publishers (publisher) VALUES ('$publisherIN');       $result3 = mysql_query($sql3, $db);   $publisherID = mysql_insert_id($result3);     $sql3a = INSERT INTO book_publisher (bookID, publishers_id) VALUES ( '$autoid', '$publisherID' );       $result3a = mysql_query($sql3a, $db);     foreach($_POST['categoriesIN'] as $category){      Â
Re: [PHP] Anyone fancy getting paid to improve my PHP in London?
2009/3/13 Robert Cummings rob...@interjinn.com On Fri, 2009-03-13 at 17:16 +, Tom Chubb wrote: Do any experienced PHP programmers in London fancy helping me improve my PHP? I'd like to know where my code could be improved and to be shown how an experienced programmer would approach a new site. I'd rather pay the right person a high amount than find someone cheap! Thanks, Send me a blank cheque-- if it clears then I'll get back to you... from someplace warm... by a beach while drinking martinis... and getting a massage... from more than one lady... Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Rob, if ($blank_cheque == cleared) { $set_temp = warm; $drinks_order = martini; $service = massage; $num_ladies = $tasty .. $robs_wife; } else { $blank_cheque = 0; } Think you should be looking at the latter ;) -- Tom Chubb t...@tomchubb.com | tomch...@gmail.com 07912 202846
[PHP] Summary Report With Details - Newbie Question
Hi Folks, I would like to make a summary report with details for a products inventory list - so it could list: A - the product a few summaries like total count on 1 line B - --- below that: the details of a multi line sub list with inventory data like: A - PRODUCT #1 - count = 25 B -- id 56 - condition = good id 98 - condition = new A - PRODUCT #2 - count = 18 B -- id 205 - condition = new id 381 - condition = poor and repeat for all inventory products - The way I'm doing it now is : main query #1 SELECT name,model, count(prid) as thecount FROM inventory group by model then do a repeat region table to display 1 of each - then - on each row - do sub query#2 : SELECT name,model, condition (etc) FROM inventory where model = quety#1.model - then display these details in a sub table Q: This seems to work fine. I was just wondering if there is a better way to construct queries to get the same result? Thanks in advance for your help... -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone fancy getting paid to improve my PHP in London?
Tom Chubb wrote: 2009/3/13 Robert Cummings rob...@interjinn.com On Fri, 2009-03-13 at 17:16 +, Tom Chubb wrote: Do any experienced PHP programmers in London fancy helping me improve my PHP? I'd like to know where my code could be improved and to be shown how an experienced programmer would approach a new site. I'd rather pay the right person a high amount than find someone cheap! Thanks, Send me a blank cheque-- if it clears then I'll get back to you... from someplace warm... by a beach while drinking martinis... and getting a massage... from more than one lady... Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Rob, if ($blank_cheque == cleared) { $set_temp = warm; $drinks_order = martini; $service = massage; $num_ladies = $tasty .. $robs_wife; } else { $blank_cheque = 0; } Think you should be looking at the latter ;) Notice: Undefined variable: tasty on line 7 Notice: Undefined variable: robs_wife on line 7 -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] English Website That Can Display Some Chinese Text
I have an English website done using PHP mySQL. In addition I would like to be able to store in mySQL and display/edit (php) some extra fields that have some basic Chinese text. I imagine I would have to update the main site to use English Chinese somehow... Q: Is something like this possible? If so how is this done...? Is there something special that needs to be done with PHP mySQL? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htmlentities is incomplete: does not cover rsquo etc
Thanks Jan, it's much clearer now. My knowledge about character encodings has multiplied 100-fold in the last 24 hours' research. Would it be a good idea for the PHP Manual to address some of these issues, by explaining good practice in encoding arbitrary user input in forms (for example), for the benefit of those, like me, for whom character sets are a bit of a black art? Also I still cannot persuade get_html_translation_table to list those non-Latin1 entities. This is not an important issue, since it appears to be only an information function, but it would be nice if it were consistent with htmlentities and html_entity_decode. Eddie From Jan G.B. 13/03/2009 17:27: 2009/3/13 Heddon's Gate Hotel ho...@heddonsgate.co.uk: The string function htmlentities seems to have very incomplete coverage of the HTML entities listed in the HTML 4 spec. For example, it does not know about rsquo, lsquo, rdquo, ldquo, etc. This is confirmed by looking at the output of get_html_translation_table, which does not list these entities. My impression is that it covers those HTML entities that are in ISO-8859-1, but not the others. Is this deliberate? If so, the Manual is misleading because it suggests that all HTML entities are covered. Otherwise, is this a bug? Well, If you specify the input charset you'll have no problem at all. ;) ?= htmlentities('string with UTF-8: ±ªÐº×Nµ»n“¢µ€jæ', ENT_QUOTES, 'UTF-8'); ? Latin1 AKA ISO-8859-1 doesn't have ldquo nor bdquo nor ndash and alike. Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail() is duplicating
Hello, on 03/13/2009 05:37 PM Rick Pasotto said the following: I have several forms on my site that use the same sequence of events: The first script displays and validates the form data, the second reformats and asks for confirmation or editing, and the third script sends the data in an email to the relevent people. Two of these forms work exactly as they're supposed to but the third sends duplicate emails to everyone. I have looked and looked and I've run diff and I can see no reason why this should be happening. Could someone suggest what I might have wrong? Usually this happens when you have a To: header in the headers parameters. -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The PHP filter class I'm working on (securiity)
I would appreciate feedback. First php class I've written myself (the little tiny ones that are just over-glorified functions don't count.) Probably has bugs. I have not thoroughly tested it - but I finally have a nice test sandbox to play with. http://www.clfsrpm.net/xss/dom_script_test.php That page has link to class source on it too. The class is suppose to server side implement the Content Security Policy recommendation that can be found here: http://people.mozilla.org/~bsterne/content-security-policy/ In theory (assuming no bugs) the class should flat out remove any content that would violate the specified policy server side so that users who do not have browsers that benefit from CSP also benefit. Clearly it can not cover every scenario, IE a script from a white listed domain could modify the DOM introducing stuff that will still trigger browser side CSP filtering. In addition to enforcing the specified policy, it also removes some stuff that ain't where it belongs, like meta tags outside the head etc. One place where I deviate from the Mozilla CSP intentionally is in event attributes. The way I read the CSP recommendation, event attributes just aren't allowed. For the life of me, though, I can't figure out how to do effective client side form validation w/o at least onchange and onsubmit. So my class does allow white listing of event attributes, though they can not have any arguments (IE onchange=alert('hello'); gets filtered to onchange=altert(); We'll have to see what the final standard is on that. The test page lets you set the policy rules that are to be enforced (except no event handler whitelist, I'll have to add that) and has almost no input filtering (just enough to make the input load nicely into the DOM - clean html input should go through unmutilated) I'll try to put together a pretty index page along with examples of usage, it should fit in nicely with most templating systems, for example, because they tend to construct the page and then send it. But I can't do that until after the weekend as I'm going out of town. Anyway, I'd really appreciate feedback on it, so it can be improved. Just a note - it's not intended as a substitute for input filtering, CSP is intended as a second line of defense, and hopefully will be implemented in browsers soon. This class just gives the benefit of a sound CSP to users w/o a CSP enabled browser (which right now is all of them, though firefox has a partially implemented plugin). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP filter class I'm working on (securiity)
Michael A. Peters wrote: I would appreciate feedback. First php class I've written myself (the little tiny ones that are just over-glorified functions don't count.) Probably has bugs. iframes and objects aren't working even for white listed where they should - I know why on the latter, I need to look at the former. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] English Website That Can Display Some Chinese Text
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sat, Mar 14, 2009 at 5:01 AM, revDAVE c...@hosting4days.com wrote: I have an English website done using PHP mySQL. In addition I would like to be able to store in mySQL and display/edit (php) some extra fields that have some basic Chinese text. I imagine I would have to update the main site to use English Chinese somehow... Q: Is something like this possible? If so how is this done...? Is there something special that needs to be done with PHP mySQL? Did you try UTF-8 for both HTML mode and MySQL -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php