php-general Digest 13 Jan 2009 14:33:10 -0000 Issue 5899
php-general Digest 13 Jan 2009 14:33:10 - Issue 5899 Topics (messages 286193 through 286208): Re: RewriteRules 286193 by: Jason Pruim 286195 by: Nathan Rixham 286197 by: Jason Pruim 286206 by: tedd 286207 by: Ashley Sheridan ecommerce related question 286194 by: Travis Moore 286203 by: tedd Re: upgrade php 5.2.6 - 5.2.8 mysql problems! 286196 by: Merlin Morgenstern Re: Php and CSS where to put it 286198 by: Al Re: HowTo use Eclipse PDT and existing mounted directory tree? 286199 by: Thodoris 286204 by: Eric Butera iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer 286200 by: Thodoris 286201 by: Ashley Sheridan 286202 by: Thodoris 286205 by: Ashley Sheridan 286208 by: Thodoris Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Jan 12, 2009, at 2:16 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know it's not a php question... But I know alot of you use rewrite rules and regular expressions and so I thought maybe you would be able to help me. The site: HTTP://purl.raoset.com/test112 test112 doesn't exist.. It's driven by the database using this rewrite rule: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /p.php [L] Now, on that site I have a few links... right now the likes are in the format of: HTTP://purl.raoset.com/design.php?purl=test112 What I would like is to have it read: HTTP://purl.raoset.com/test112/design completing the total look of the site :) technically the same code as above should work even if you change you're links.. you see it's just redirecting everything not found to p.php so in p.php simply add in a print_r($_SERVER); exit(); at the top, upload to server then visit /test112/design in you're browser.. check the print_r output and you'll see the request in there, (variables sometimes differ, hence why I'm suggesting you check; you can skip this bit and jump right on to the next paragraph though) you can then simply: $request_page_parts = explode('/', $_SERVER['REQUEST_URI'); print_r($request_page_parts); then use whatever code you want to display the correct page based on the uri requested (as you want) I know this isn't the approach you expected but it basically hands off all page selection and processing to php, rather than a load of rewrite rules and lots of updating of .htaccess if you really want the rewrite rules then I'm sure you've had many other accurate replies with examples :) Nathan, You get any drink you want as long as you come to me! Once I looked at it and read your e-mail it made total sense... I understand PHP programming better than rewrite rules :) ---End Message--- ---BeginMessage--- Jason Pruim wrote: On Jan 12, 2009, at 2:16 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know it's not a php question... But I know alot of you use rewrite rules and regular expressions and so I thought maybe you would be able to help me. The site: HTTP://purl.raoset.com/test112 test112 doesn't exist.. It's driven by the database using this rewrite rule: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /p.php [L] Now, on that site I have a few links... right now the likes are in the format of: HTTP://purl.raoset.com/design.php?purl=test112 What I would like is to have it read: HTTP://purl.raoset.com/test112/design completing the total look of the site :) technically the same code as above should work even if you change you're links.. you see it's just redirecting everything not found to p.php so in p.php simply add in a print_r($_SERVER); exit(); at the top, upload to server then visit /test112/design in you're browser.. check the print_r output and you'll see the request in there, (variables sometimes differ, hence why I'm suggesting you check; you can skip this bit and jump right on to the next paragraph though) you can then simply: $request_page_parts = explode('/', $_SERVER['REQUEST_URI'); print_r($request_page_parts); then use whatever code you want to display the correct page based on the uri requested (as you want) I know this isn't the approach you expected but it basically hands off all page selection and processing to php, rather than a load of rewrite rules and lots of updating of .htaccess if you really want the rewrite rules then I'm sure you've had many other accurate replies with examples :) Nathan, You get any drink you want as long as you come to me! Once I looked at it and read your e-mail it made total sense...
[PHP] Re: RewriteRules
Jason Pruim wrote: On Jan 12, 2009, at 2:16 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know it's not a php question... But I know alot of you use rewrite rules and regular expressions and so I thought maybe you would be able to help me. The site: HTTP://purl.raoset.com/test112 test112 doesn't exist.. It's driven by the database using this rewrite rule: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /p.php [L] Now, on that site I have a few links... right now the likes are in the format of: HTTP://purl.raoset.com/design.php?purl=test112 What I would like is to have it read: HTTP://purl.raoset.com/test112/design completing the total look of the site :) technically the same code as above should work even if you change you're links.. you see it's just redirecting everything not found to p.php so in p.php simply add in a print_r($_SERVER); exit(); at the top, upload to server then visit /test112/design in you're browser.. check the print_r output and you'll see the request in there, (variables sometimes differ, hence why I'm suggesting you check; you can skip this bit and jump right on to the next paragraph though) you can then simply: $request_page_parts = explode('/', $_SERVER['REQUEST_URI'); print_r($request_page_parts); then use whatever code you want to display the correct page based on the uri requested (as you want) I know this isn't the approach you expected but it basically hands off all page selection and processing to php, rather than a load of rewrite rules and lots of updating of .htaccess if you really want the rewrite rules then I'm sure you've had many other accurate replies with examples :) Nathan, You get any drink you want as long as you come to me! Once I looked at it and read your e-mail it made total sense... I understand PHP programming better than rewrite rules :) cool; couple of little notes to help you on you're way.. first thing you'll want to do is explode/split on ? so that you have any get params stripped off and stored seperately for good measure next up it makes sense to check for and seperate file extensions, and likewise trim off trailing /'s also experiment with this, you can do some nifty things; the last time I implemented it I had the following set up on my urls domain.com/.wrapper/section/the_page_name.ext in short, .wrapper was optional, and could be one of .ajax, .default, .print (output template differed dependant on the wrapper specified) section and page name are both self explanatory .ext was again optional, in one implementation I completely ignored it, meaning I could disguise the site as being all .html, or all .asp or .jsp or whatever (just for the novelty and to throw hackers) - in another implementation I used it wth extensions of .json .xml .php and .html (much like twitter) which turned the site into a kind of api. I would recommend trying the above and making a system like this at some point, it's simpler than you think; but the benefits are immense, not becuase of the things you can do.. but because of the way it makes you program, it get's you to seperate the functional code from the presentation and really think about things - you learn lessons that never leave you :) best wishes, nath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upgrade php 5.2.6 - 5.2.8 mysql problems!
Hi there, has somebody an idea how to fix this? I do appreciate any help. Thank you in advance, Merlin Merlin Morgenstern wrote: No. The with-pdo-mysql command secures compatibility with oder databases . That workes fine. The yes in the error msg. seams to be normal in this case. I found loads of such via google. e.g: http://www.rootforum.de/forum/viewtopic.php?f=158t=35941start=0 All point to the fact that there needs to be mysql-dev installed. But why? I am already running 5.2.6. And mysql-dev does not come with suse 11. I doubt that this is the cause. Any other ideas? Thanx, merlin Chris schrieb: Here is the configure command that is pretty much the same as in 5.2.6: So look at the differences ;) './configure' '--enable-fastcgi' '--with-mysql' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-mbstring' '--with-pdo-mysql=/usr/local/mysql/' '--with-mysql-sock=/tmp' '--enable-soap' '--with-zlib' '--with-freetype-dir=/usr/local/lib' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr/lib' '--enable-exif' '--enable-cli' snip configure: error: Cannot find MySQL header files under yes. This gives you the clue - it's not --with-mysql=yes or something (no idea where yes is actually coming from). Try --with-mysql=/usr/local/mysql -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RewriteRules
On Jan 13, 2009, at 5:37 AM, Nathan Rixham wrote: Jason Pruim wrote: On Jan 12, 2009, at 2:16 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know it's not a php question... But I know alot of you use rewrite rules and regular expressions and so I thought maybe you would be able to help me. The site: HTTP://purl.raoset.com/test112 test112 doesn't exist.. It's driven by the database using this rewrite rule: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /p.php [L] Now, on that site I have a few links... right now the likes are in the format of: HTTP://purl.raoset.com/design.php?purl=test112 What I would like is to have it read: HTTP://purl.raoset.com/test112/design completing the total look of the site :) technically the same code as above should work even if you change you're links.. you see it's just redirecting everything not found to p.php so in p.php simply add in a print_r($_SERVER); exit(); at the top, upload to server then visit /test112/design in you're browser.. check the print_r output and you'll see the request in there, (variables sometimes differ, hence why I'm suggesting you check; you can skip this bit and jump right on to the next paragraph though) you can then simply: $request_page_parts = explode('/', $_SERVER['REQUEST_URI'); print_r($request_page_parts); then use whatever code you want to display the correct page based on the uri requested (as you want) I know this isn't the approach you expected but it basically hands off all page selection and processing to php, rather than a load of rewrite rules and lots of updating of .htaccess if you really want the rewrite rules then I'm sure you've had many other accurate replies with examples :) Nathan, You get any drink you want as long as you come to me! Once I looked at it and read your e-mail it made total sense... I understand PHP programming better than rewrite rules :) cool; couple of little notes to help you on you're way.. first thing you'll want to do is explode/split on ? so that you have any get params stripped off and stored seperately for good measure next up it makes sense to check for and seperate file extensions, and likewise trim off trailing /'s also experiment with this, you can do some nifty things; the last time I implemented it I had the following set up on my urls domain.com/.wrapper/section/the_page_name.ext in short, .wrapper was optional, and could be one of .ajax, .default, .print (output template differed dependant on the wrapper specified) section and page name are both self explanatory .ext was again optional, in one implementation I completely ignored it, meaning I could disguise the site as being all .html, or all .asp or .jsp or whatever (just for the novelty and to throw hackers) - in another implementation I used it wth extensions of .json .xml .php and .html (much like twitter) which turned the site into a kind of api. I would recommend trying the above and making a system like this at some point, it's simpler than you think; but the benefits are immense, not becuase of the things you can do.. but because of the way it makes you program, it get's you to seperate the functional code from the presentation and really think about things - you learn lessons that never leave you :) best wishes, nath Hmm... I like the idea of that... I'll play with that when I get home... Unfortunately the boss doesn't pay me to write programs anymore... Even though I've written stuff to make him money! :) so if anyone knows of a junior to mid level programming job that pays $50,000+ in the US let me know! :) -- Jason Pruim japr...@raoset.com 616.399.2355
[PHP] Re: Php and CSS where to put it
Terion Miller wrote: I have this code and the css seems to not work in IE at all, do I need to put it somewhere different on the page maybe? link rel=stylesheet type=text/css href=inc/styles.css ?php include 'inc/dbconnOpen.php' ; ini_set('error_reporting', E_ALL); ini_set('display_errors', true); $sql = SELECT * FROM `textads` WHERE `expos` xCount ORDER BY RAND() LIMIT 3; $result = mysql_query($sql); echo table class=jobfont width=728 height=90 border=0 align=center cellpadding=10 bordercolor=#66 background= 'inc/bg.gif' bgcolor=#CC tr td table width=690 height=50 border=0 align=center cellpadding=5 tr; while ($row = mysql_fetch_array($result)) { echo td class=col align=center width=33%{$row['title']}br{$row['blurb']}br A HREF='{$row['href']}'{$row['href']}/a/td; //Add to exposure count $views = $row['xCount'] + 1; mysql_query(UPDATE `textads` SET `xCount` = '{$views}' WHERE `ID` = '{$row['ID']}'); } echo /tr /table/td/tr/table; ? Terion: Install Firefox and the HTML Validator extension. It is a perfect tool for you. It will clearly identify all the HTML errors and warnings, AND point you to how to fix them. It uses Tidy, which classifies many errors as warnings. However, you should fix them. Your page has 21 serious warnings many of which are errors that will affect rendering. After you've fixed the warnings and errors it finds, run the W3C HTML Validator. Also, install the Firefox extension Validate CSS. Run it on your page. It has 8 bad errors. These tools are great learning aids. Incidentally, I'm not a fan of frames, often causes problems. Al. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HowTo use Eclipse PDT and existing mounted directory tree?
On Mon, Jan 12, 2009 at 8:13 PM, Daevid Vincent dae...@daevid.com wrote: I must be retarded or something because I can't figure out in Eclipse PDT (Linux) how in the heck do I start a new project and have it point to an existing directory tree. I DO NOT want Eclipse to pull in a copy of the files or do anything wacky like that. I simply want it to look at a mount point (sshfs) directory and use the files that exist there already. These are served up via apache on a dedicated development server, so obviously I want to change them and not a 'local copy'. The files are physically in /var/www/vincentd/ on the dev box but are in /home/vincentd/mydev/ on my local Ubuntu as a share. Or in other words... localhost:/home/vincentd/pse02 - development:/var/www/vincentd/ I've Googled around and can't seem to find the right words to get an answer to what would seem an obvious task. D.Vin http://daevid.com There's a checkbox near the project name. Can't remember what it's called, but it lets you use a different workspace location. Try that. Try to set the workspace in the mounted directory. If the project already exists try to import the project (I think this is the proper way) by right clicking in PHP explorer and choosing Import menu. Then you should choose Existing project into Workspace under the General tree. I don't if there is a better way but I usually open the existing projects this way. -- Thodoris
[PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. I have tried to filter the data before writing them into the sheet but this behavior persists. Any ideas in what might be wrong? -- Thodoris
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, 2009-01-13 at 15:51 +0200, Thodoris wrote: Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. I have tried to filter the data before writing them into the sheet but this behavior persists. Any ideas in what might be wrong? Well a multibyte character is something like a character from utf-8 or unicode, where more than one byte is used to represent the character. Does the Excel writer you use support utf or unicode? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, 2009-01-13 at 15:51 +0200, Thodoris wrote: Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. I have tried to filter the data before writing them into the sheet but this behavior persists. Any ideas in what might be wrong? Well a multibyte character is something like a character from utf-8 or unicode, where more than one byte is used to represent the character. Does the Excel writer you use support utf or unicode? Ash www.ashleysheridan.co.uk Actually it does and AFAIK it changes everything into UTF-16LE. The Excel writer is the pecl module Spreadsheet_Excel_Writer. BTW do you have any suggestions for a better open source writer I could use? -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ecommerce related question
At 3:58 PM +1030 1/13/09, Travis Moore wrote: Firstly, not really a php question, but generic web stuff, but I feel it's still better answered here. Recently a friend came to me asking to create an ecommerce website. In the past my php work has been primarily a hobby, and as such haven't really taken much interest or effort into security aspects of it. Given the nature of the project, I realise security is a must. My question is: what recommended reading for security or ecommerce can any of you suggest? -- Thanks, Travis Moore tra...@live.com OR trabus2...@gmail.com Travis: I could write a treaties on ecommerce security problems and not cover everything. My recommendation for a hobbyist php developer is to contact PayPal; establish an account with them; and have them do all the collections. You prepare the site to sell items and do what PayPal says needs to be done. That will work well enough for a successful operation. If you are thinking about collecting credit card information and processing transactions yourself, you had better have the business as a corporation to protect your personal assets (if you are in the USA), because things could get out of hand very quickly. That's a dangerous road to travel. 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] HowTo use Eclipse PDT and existing mounted directory tree?
On Mon, Jan 12, 2009 at 8:51 PM, Eric Butera eric.but...@gmail.com wrote: On Mon, Jan 12, 2009 at 8:13 PM, Daevid Vincent dae...@daevid.com wrote: I must be retarded or something because I can't figure out in Eclipse PDT (Linux) how in the heck do I start a new project and have it point to an existing directory tree. I DO NOT want Eclipse to pull in a copy of the files or do anything wacky like that. I simply want it to look at a mount point (sshfs) directory and use the files that exist there already. These are served up via apache on a dedicated development server, so obviously I want to change them and not a 'local copy'. The files are physically in /var/www/vincentd/ on the dev box but are in /home/vincentd/mydev/ on my local Ubuntu as a share. Or in other words... localhost:/home/vincentd/pse02 - development:/var/www/vincentd/ I've Googled around and can't seem to find the right words to get an answer to what would seem an obvious task. D.Vin http://daevid.com There's a checkbox near the project name. Can't remember what it's called, but it lets you use a different workspace location. Try that. The checkbox is labeled Use Default under the Project Contents group. If all of your sites are in this share and you'll use it each time, I would recommend changing your default workspace location. On my local ubuntu I change it to /home/eric/Sites. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, 2009-01-13 at 16:07 +0200, Thodoris wrote: On Tue, 2009-01-13 at 15:51 +0200, Thodoris wrote: Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. I have tried to filter the data before writing them into the sheet but this behavior persists. Any ideas in what might be wrong? Well a multibyte character is something like a character from utf-8 or unicode, where more than one byte is used to represent the character. Does the Excel writer you use support utf or unicode? Ash www.ashleysheridan.co.uk Actually it does and AFAIK it changes everything into UTF-16LE. The Excel writer is the pecl module Spreadsheet_Excel_Writer. BTW do you have any suggestions for a better open source writer I could use? -- Thodoris Unfortunately I don't know of any other Excel writers, but I never really use that format anymore if I can help it. Would a CSV not work? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RewriteRules
Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. 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] Re: RewriteRules
On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, 2009-01-13 at 16:07 +0200, Thodoris wrote: On Tue, 2009-01-13 at 15:51 +0200, Thodoris wrote: Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. I have tried to filter the data before writing them into the sheet but this behavior persists. Any ideas in what might be wrong? Well a multibyte character is something like a character from utf-8 or unicode, where more than one byte is used to represent the character. Does the Excel writer you use support utf or unicode? Ash www.ashleysheridan.co.uk Actually it does and AFAIK it changes everything into UTF-16LE. The Excel writer is the pecl module Spreadsheet_Excel_Writer. BTW do you have any suggestions for a better open source writer I could use? -- Thodoris Unfortunately I don't know of any other Excel writers, but I never really use that format anymore if I can help it. Would a CSV not work? Ash www.ashleysheridan.co.uk Well it does work but unfortunately both need to be supported. I should say that it actually is the pear module Spreadsheet_Excel_Writer and not pecl. I could probably try to debug the module itself but this is usually a very bad idea. I came to this point because I have stripped all non-printable characters, tabs, CRs and LFs before writing into the speadsheet but nothing seems to work. -- Thodoris
Re: [PHP] Re: RewriteRules
At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. 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] Re: RewriteRules
On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, 2009-01-13 at 16:33 +0200, Thodoris wrote: On Tue, 2009-01-13 at 16:07 +0200, Thodoris wrote: On Tue, 2009-01-13 at 15:51 +0200, Thodoris wrote: Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. I have tried to filter the data before writing them into the sheet but this behavior persists. Any ideas in what might be wrong? Well a multibyte character is something like a character from utf-8 or unicode, where more than one byte is used to represent the character. Does the Excel writer you use support utf or unicode? Ash www.ashleysheridan.co.uk Actually it does and AFAIK it changes everything into UTF-16LE. The Excel writer is the pecl module Spreadsheet_Excel_Writer. BTW do you have any suggestions for a better open source writer I could use? -- Thodoris Unfortunately I don't know of any other Excel writers, but I never really use that format anymore if I can help it. Would a CSV not work? Ash www.ashleysheridan.co.uk Well it does work but unfortunately both need to be supported. I should say that it actually is the pear module Spreadsheet_Excel_Writer and not pecl. I could probably try to debug the module itself but this is usually a very bad idea. I came to this point because I have stripped all non-printable characters, tabs, CRs and LFs before writing into the speadsheet but nothing seems to work. Is there any chance its characters creeping in from being copied from a M$ program? I found that M$ software uses it's own character encodings for multibyte characters which causes no end of problems for web-based systems. A lot of it was where angled quotation marks were added my Word, and not encoded using the UTF encodings, but the M$-style ones instead. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP unlink Permission Error
Hi, I have a snippet of code as follows: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); echo $curDir; chmod($curDir,0777); unlink(testFile.txt); echo unlink(testFile.txt); chmod ($curDir,0755); ? The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got: C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject\file_write.php on line 10 Could anyone give me some tips on how to resolve this error? Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail
Re: [PHP] PHP unlink Permission Error
On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote: Hi, I have a snippet of code as follows: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); echo $curDir; chmod($curDir,0777); unlink(testFile.txt); echo unlink(testFile.txt); chmod ($curDir,0755); ? The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got: C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject\file_write.php on line 10 Could anyone give me some tips on how to resolve this error? Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail You're using chmod to modify the permissions of the directory, but do you actually have permissions to modify the permissions? If not, the chmod will fail without giving an error, and then your unlink will fail with an error. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
Ashley Sheridan schreef: On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefit of one over the other? for($i=0;$i3;$i++){ switch($i){ case 0: header pg1 code break; case 1: header pg2 code break; case 3: header pg3 code break; }; }; or would that be better served using an if...elseif structure? Frank And a switch is a lot neater for dealing with these sorts of things. I tend never to use if...elseif's at all, and use switches. Like Rob said, you can fall into further cases below, and it's very simple to add more at a later date. There is one place where an if...elseif would work and a switch could not, and that is where you were performing lots of different logic tests on different variables. switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. PS - hi, people happy new year (or whatever) ... it's not that I'm dead ... I just can't be arsed atm. Aside from that, I think any speed benefit one would have over the other would be marginal. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP unlink Permission Error
Hi, Ashley: I thought about it and edited my script to check what permission I had, and it appears I do have the permission rights, and it actually changed to 0777. Here is the code: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(testFile.txt); echo unlink(testFile.txt); ? The output: 0777Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php n line 11If this is the case, how come I don't have the permissions to delete the file? Thanks again. Alice Subject: Re: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 14:53:32 + On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote: Hi, I have a snippet of code as follows:?phpini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); echo $curDir; chmod($curDir,0777); unlink(testFile.txt); echo unlink(testFile.txt); chmod ($curDir,0755); ? The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got:C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject\file_write.php on line 10Could anyone give me some tips on how to resolve this error? Thanks in advance.Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail You're using chmod to modify the permissions of the directory, but do you actually have permissions to modify the permissions? If not, the chmod will fail without giving an error, and then your unlink will fail with an error. Ash www.ashleysheridan.co.uk _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview
RE: [PHP] PHP unlink Permission Error
On Tue, 2009-01-13 at 09:50 -0500, Alice Wei wrote: Hi, Ashley: I thought about it and edited my script to check what permission I had, and it appears I do have the permission rights, and it actually changed to 0777. Here is the code: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(testFile.txt); echo unlink(testFile.txt); ? The output: 0777 Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10 Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php n line 11 If this is the case, how come I don't have the permissions to delete the file? Thanks again. Alice Subject: Re: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 14:53:32 + On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote: Hi, I have a snippet of code as follows: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); echo $curDir; chmod($curDir,0777); unlink(testFile.txt); echo unlink(testFile.txt); chmod ($curDir,0755); ? The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got: C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project \file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject \file_write.php on line 10 Could anyone give me some tips on how to resolve this error? Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail You're using chmod to modify the permissions of the directory, but do you actually have permissions to modify the permissions? If not, the chmod will fail without giving an error, and then your unlink will fail with an error. Ash www.ashleysheridan.co.uk __ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! Try it now! Hmm, is the current working directory the same as the one in which the file is in? I know it seems like a silly question, but it's often the silly ones that cause the most trouble! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
On Tue, Jan 13, 2009 at 9:50 AM, Jochem Maas joc...@iamjochem.com wrote: switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. PS - hi, people happy new year (or whatever) You too! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP unlink Permission Error
Hi, Ashley: I tried to find your corrected errors, but I cannot seem to find it. Have you sent me an empty reply message by mistake? Alice Subject: RE: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 15:09:44 + On Tue, 2009-01-13 at 09:50 -0500, Alice Wei wrote: Hi, Ashley:I thought about it and edited my script to check what permission I had, and it appears I do have the permission rights, and it actually changed to 0777. Here is the code:?phpini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(testFile.txt); echo unlink(testFile.txt); ? The output:0777 Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php n line 11If this is the case, how come I don't have the permissions to delete the file? Thanks again. Alice Subject: Re: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 14:53:32 + On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote:Hi, I have a snippet of code as follows:?php ini_set('display_errors', 1); error_reporting(E_ALL);$curDir = getcwd();echo $curDir;chmod($curDir,0777); unlink(testFile.txt);echo unlink(testFile.txt); chmod ($curDir,0755);? The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got:C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project \file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject \file_write.php on line 10Could anyone give me some tips on how to resolve this error? Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail You're using chmod to modify the permissions of the directory, but do you actually have permissions to modify the permissions? If not, the chmod will fail without giving an error, and then your unlink will fail with an error. Ash www.ashleysheridan.co.uk __ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! Try it now! Hmm, is the current working directory the same as the one in which the file is in? I know it seems like a silly question, but it's often the silly ones that cause the most trouble! Ash www.ashleysheridan.co.uk _ Use Messenger to talk to your IM friends, even those on Yahoo! http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe
[PHP] Another beginner question
I have successfully set up the testing server, now I would like to test it out on the remote server, but put does not seem to be working. I saved the php document, click put, nothing seems to happen. I am connected to the remote server, but when I put, nothing happens. The file is in the local root file, the local and remote information has not changed. I do get this error The sites testing and remote servers are different. This scenario is not supported by the Site Wizard, when switching from basic to advanced tabs in site manager. What am I missing? Thank you Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Another beginner question
Ok...for whatever reason, it has now worked, even though I did not change anything Gary gwp...@ptd.net wrote in message news:1a.17.42308.e90bc...@pb1.pair.com... I have successfully set up the testing server, now I would like to test it out on the remote server, but put does not seem to be working. I saved the php document, click put, nothing seems to happen. I am connected to the remote server, but when I put, nothing happens. The file is in the local root file, the local and remote information has not changed. I do get this error The sites testing and remote servers are different. This scenario is not supported by the Site Wizard, when switching from basic to advanced tabs in site manager. What am I missing? Thank you Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another beginner question
On Tue, Jan 13, 2009 at 10:17 AM, Gary gwp...@ptd.net wrote: I have successfully set up the testing server, now I would like to test it out on the remote server, but put does not seem to be working. I saved the php document, click put, nothing seems to happen. I am connected to the remote server, but when I put, nothing happens. The file is in the local root file, the local and remote information has not changed. I do get this error The sites testing and remote servers are different. This scenario is not supported by the Site Wizard, when switching from basic to advanced tabs in site manager. What am I missing? Thank you Gary This sounds like a Dreamweaver question, not a PHP question... If you go to Site - Edit Sites Under Local Info you input the information for the server you develop your application on Under Remote Info you input the information for the server you would like to Put files on Under Testing Info you input the information for the server you would like to use to View your pages. Your Remote and Testing servers should ideally be the same.
Re: [PHP] Another beginner question
Dan Thanks for your reply...however.. Your Remote and Testing servers should ideally be the same. This confuses me greatly. My remote server is godaddy, my testing server is apache... Could you explain that for me? Thanks again Gary Dan Shirah mrsqua...@gmail.com wrote in message news:a16da1ff0901130727v3a51cce9na913c8f12098...@mail.gmail.com... On Tue, Jan 13, 2009 at 10:17 AM, Gary gwp...@ptd.net wrote: I have successfully set up the testing server, now I would like to test it out on the remote server, but put does not seem to be working. I saved the php document, click put, nothing seems to happen. I am connected to the remote server, but when I put, nothing happens. The file is in the local root file, the local and remote information has not changed. I do get this error The sites testing and remote servers are different. This scenario is not supported by the Site Wizard, when switching from basic to advanced tabs in site manager. What am I missing? Thank you Gary This sounds like a Dreamweaver question, not a PHP question... If you go to Site - Edit Sites Under Local Info you input the information for the server you develop your application on Under Remote Info you input the information for the server you would like to Put files on Under Testing Info you input the information for the server you would like to use to View your pages. Your Remote and Testing servers should ideally be the same. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP unlink Permission Error
Not only do you need to check the return value of chmod to see if it worked, but also, I *think*: The file withing the directory can have entirely different permissions, and making the directory world writable won't help that, I don't think... I could be wrong, and a 000 file in a 777 dir might be unlink-able. You can test for yourself in a shell as fast as I can. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
Is there any chance its characters creeping in from being copied from a M$ program? I found that M$ software uses it's own character encodings for multibyte characters which causes no end of problems for web-based systems. A lot of it was where angled quotation marks were added my Word, and not encoded using the UTF encodings, but the M$-style ones instead. Ash www.ashleysheridan.co.uk Well this not the case... This is a client list that is being exported from the mysql table and there is a whole web site that inserts, updates and manipulates in general this table. But all the data are being validated. The only thing that might be causing this is that you may import data massively using a csv file and I manged to resolve the encoding problem by asking the user to define it while importing. The thing that troubles me is that all data are imported correctly and something like a special character or something that Excel doesn't think is right a messing all up. I am really stuck so any help could be very useful... -- Thodoris
Re: [PHP] ecommerce related question
For now, as already said, go with PayPal or similar. Do not store the CC#s in your DB or anywhere at all, for any length of time. Not in the SESSION either. Get it and send it to PayPal and wipe it out with http://php.net/unset all in one single HTTP request. For long-term, to learn more, start reading here: http://phpsec.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP unlink Errors
Hi, I have a snippet below that I would like to delete a file. However, I keep getting kicked out because of permission errors, when my folder permission is 0777. ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(C:/Inetpub\wwwroot/project/testFile.txt); echo unlink(C:/Inetpub/wwwroot/pproject/testFile.txt); ? Is it possible that someone on the list could point out what my possible errors are to allow this code to be functioning? Here is the output: 0777Warning: unlink(C:/Inetpub\wwwroot/project/testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(C:/Inetpub/wwwroot/project/testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10 Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail
Re: [PHP] PHP unlink Errors
Do you have php_safe_mode enabled? If's that's the case, try turning it off and then run your script again. Alice Wei wrote: Hi, I have a snippet below that I would like to delete a file. However, I keep getting kicked out because of permission errors, when my folder permission is 0777. ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(C:/Inetpub\wwwroot/project/testFile.txt); echo unlink(C:/Inetpub/wwwroot/pproject/testFile.txt); ? Is it possible that someone on the list could point out what my possible errors are to allow this code to be functioning? Here is the output: 0777Warning: unlink(C:/Inetpub\wwwroot/project/testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(C:/Inetpub/wwwroot/project/testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10 Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail -- http://bithub.net/ Synchronize, share and backup your files over the web for free http://twitter.com/MarcSteinert My Twitter feed ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP unlink Permission Error
Alice Wei wrote: Hi, Ashley: I thought about it and edited my script to check what permission I had, and it appears I do have the permission rights, and it actually changed to 0777. Here is the code: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(testFile.txt); echo unlink(testFile.txt); ? The output: 0777Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php n line 11If this is the case, how come I don't have the permissions to delete the file? Thanks again. Alice Subject: Re: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 14:53:32 + On Tue, 2009-01-13 at 09:42 -0500, Alice Wei wrote: Hi, I have a snippet of code as follows:?phpini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); echo $curDir; chmod($curDir,0777); unlink(testFile.txt); echo unlink(testFile.txt); chmod ($curDir,0755); ? The problem is that I do not seem to have the correct permissions, even though I seem to have changed the permissions of the folder to 777 already upon the file deletion time. This is the output I got: C:\Inetpub\wwwroot\projectWarning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwrootproject\file_write. php on line 10Could anyone give me some tips on how to resolve this error? Thanks in advance.Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail You're using chmod to modify the permissions of the directory, but do you actually have permissions to modify the permissions? If not, the chmod will fail without giving an error, and then your unlink will fail with an error. Ash www.ashleysheridan.co.uk _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview Just because you have perms to change the dir and have set the dir to 777 doesn't mean you have perms to delete the file? Who is the owner of the file and what are the perms? -- 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] PHP unlink Errors
Hi, Apparently my safe mode is off. I tried fiddling with my code by changing the permission of my intended to delete file as in the following: ?php ini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777); echo substr(sprintf('%o', fileperms($curDir)), -4); $fileToRemove = C:/Inetpub/wwwroot/project/testFile.txt;chmod ($fileToRemove, 0777) or die (permission canonot be set); echo substr(sprintf('%o', fileperms($fileToRemove)), -4); if (@unlink($fileToRemove) == true) { unlink($fileToRemove); } else {echo You don't have the permission;} ? This is the output I get 07770666You don't have the permission I don't get a failure statement in the line: chmod ($fileToRemove, 0777) or die (permission canonot be set);, how come the permission of this file is still 0666? Thanks in advance. Alice Date: Tue, 13 Jan 2009 17:06:37 +0100 From: li...@bithub.net To: aj...@alumni.iu.edu CC: php-general@lists.php.net Subject: Re: [PHP] PHP unlink Errors Do you have php_safe_mode enabled? If's that's the case, try turning it off and then run your script again. Alice Wei wrote: Hi, I have a snippet below that I would like to delete a file. However, I keep getting kicked out because of permission errors, when my folder permission is 0777. ?phpini_set('display_errors', 1); error_reporting(E_ALL); $curDir = getcwd(); chmod($curDir,0777) or die (Failed to change permission); echo substr(sprintf('%o', fileperms($curDir)), -4); unlink(C:/Inetpub\wwwroot/project/testFile.txt); echo unlink(C:/Inetpub/wwwroot/pproject/testFile.txt); ? Is it possible that someone on the list could point out what my possible errors are to allow this code to be functioning? Here is the output: 0777Warning: unlink(C:/Inetpub\wwwroot/project/testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 9Warning: unlink(C:/Inetpub/wwwroot/project/testFile.txt) [function.unlink]: Permission denied in C:\Inetpub\wwwroot\project\file_write.php on line 10Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail -- http://bithub.net/ Synchronize, share and backup your files over the web for free http://twitter.com/MarcSteinert My Twitter feed ** _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview
RE: [PHP] PHP unlink Permission Error
snip/ No, we tend to bottom-post on this list. It's just how we roll... Ash www.ashleysheridan.co.uk
Re: [PHP] PHP unlink Permission Error
On Tue, 2009-01-13 at 15:46 +, c...@l-i-e.com wrote: Not only do you need to check the return value of chmod to see if it worked, but also, I *think*: The file withing the directory can have entirely different permissions, and making the directory world writable won't help that, I don't think... I could be wrong, and a 000 file in a 777 dir might be unlink-able. You can test for yourself in a shell as fast as I can. :-) On *nix systems, I believe you only need write permissions to the directory in order to delete files. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP unlink Permission Error
Hi, Ashley: Sorry. To answer the question from your previous entry, it looks like that my permission could be set and changed for the folder, but when I do it on the file, I only get 0666. I have the latest code on another entry. Thanks a lot for your help. Alice Alice Wei Indiana University, Master of Information Science Application Programmer ProCure Treatment Centers, Inc.420 N. Walnut St.Bloomington, IN 47404812-330-6644 (office)812-219-5708 (mobile)alice@procurecenters.com(email)http://www.procurecenters.com/index.php (web) Subject: RE: [PHP] PHP unlink Permission ErrorFrom: a...@ashleysheridan.co.ukto: aj...@alumni.iu.educc: php-gene...@lists.php.netdate: Tue, 13 Jan 2009 16:36:36 +snip/No, we tend to bottom-post on this list. It's just how we roll... Ashwww.ashleysheridan.co.uk _ Check the weather nationwide with MSN Search: Try it now! http://search.msn.com/results.aspx?q=weatherFORM=WLMTAG
Re: [PHP] PHP unlink Permission Error
touch foo.txt chmod 000 foo.txt rm foo.txt rm: remove write-protected regular empty file `foo.txt'? So the behaviour is at least partially shell/profile dependent... I have no idea how this would affect PHP unlink, if at all. ymmv naiaa ianasg [*] [*] sg: shell guru -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP unlink Permission Error
On Tue, 2009-01-13 at 11:33 -0500, Alice Wei wrote: Hi, Ashley: Sorry. To answer the question from your previous entry, it looks like that my permission could be set and changed for the folder, but when I do it on the file, I only get 0666. I have the latest code on another entry. Thanks a lot for your help. Alice Alice Wei Indiana University, Master of Information Science Application Programmer ProCure Treatment Centers, Inc. 420 N. Walnut St. Bloomington, IN 47404 812-330-6644 (office) 812-219-5708 (mobile) alice@procurecenters.com(email) http://www.procurecenters.com/index.php (web) __ Subject: RE: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 16:36:36 + snip/ No, we tend to bottom-post on this list. It's just how we roll... Ash www.ashleysheridan.co.uk __ Check the weather nationwide with MSN Search Try it now! The user that your web server is running under (I'm guessing apache of wwwrun) , does this have permission to write to the file. If not, it won't be able to set the permissions for it. You may need to exec out a sudo command to do it, but I wouldn't recommend this. If you need PHP to be able to delete the file, what put it there in the first place? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, Jan 13, 2009 at 10:47 AM, Thodoris t...@kinetix.gr wrote: Is there any chance its characters creeping in from being copied from a M$ program? I found that M$ software uses it's own character encodings for multibyte characters which causes no end of problems for web-based systems. A lot of it was where angled quotation marks were added my Word, and not encoded using the UTF encodings, but the M$-style ones instead. Ash www.ashleysheridan.co.uk Well this not the case... This is a client list that is being exported from the mysql table and there is a whole web site that inserts, updates and manipulates in general this table. But all the data are being validated. The only thing that might be causing this is that you may import data massively using a csv file and I manged to resolve the encoding problem by asking the user to define it while importing. The thing that troubles me is that all data are imported correctly and something like a special character or something that Excel doesn't think is right a messing all up. I am really stuck so any help could be very useful... -- Thodoris Could you base64encode() the data? Or try HtmlEntities()? Is it text data that is causing the issue? -- Bastien Cat, the other other white meat
RE: [PHP] PHP unlink Permission Error
Subject: RE: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 16:50:31 + On Tue, 2009-01-13 at 11:33 -0500, Alice Wei wrote: Hi, Ashley:Sorry. To answer the question from your previous entry, it looks like that my permission could be set and changed for the folder, but when I do it on the file, I only get 0666. I have the latest code on another entry. Thanks a lot for your help.Alice Alice Wei Indiana University, Master of Information ScienceApplication Programmer ProCure Treatment Centers, Inc. 420 N. Walnut St. Bloomington, IN 47404812-330-6644 (office) 812-219-5708 (mobile) alice@procurecenters.com(email) http://www.procurecenters.com/index.php (web) __ Subject: RE: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 16:36:36 + snip/No, we tend to bottom-post on this list. It's just how we roll... Ash www.ashleysheridan.co.uk __ Check the weather nationwide with MSN Search Try it now! The user that your web server is running under (I'm guessing apache of wwwrun) , does this have permission to write to the file. If not, it won't be able to set the permissions for it. You may need to exec out a sudo command to do it, but I wouldn't recommend this. If you need PHP to be able to delete the file, what put it there in the first place? Ash www.ashleysheridan.co.uk What I am trying to do here is that a user would be pushing a button so that the data entries would generate an outfile. The only issue is that the lines would be appended in the file, (I have no issues with this part writing to the file, no permission errors, etc). Therefore, before the outfile is generated, I need to have the prexisting outfile removed and recreated to be written to so that it always stays a new file for use. This is why this script as you have seen is as it is so that I can constantly check if the file exists, and generate a new file if there is. In this case, is there something I could do? Thanks in advance. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail
RE: [PHP] PHP unlink Permission Error
On Tue, 2009-01-13 at 11:49 -0500, Alice Wei wrote: Subject: RE: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 16:50:31 + On Tue, 2009-01-13 at 11:33 -0500, Alice Wei wrote: Hi, Ashley: Sorry. To answer the question from your previous entry, it looks like that my permission could be set and changed for the folder, but when I do it on the file, I only get 0666. I have the latest code on another entry. Thanks a lot for your help. Alice Alice Wei Indiana University, Master of Information Science Application Programmer ProCure Treatment Centers, Inc. 420 N. Walnut St. Bloomington, IN 47404 812-330-6644 (office) 812-219-5708 (mobile) alice@procurecenters.com(email) http://www.procurecenters.com/index.php (web) __ Subject: RE: [PHP] PHP unlink Permission Error From: a...@ashleysheridan.co.uk To: aj...@alumni.iu.edu CC: php-general@lists.php.net Date: Tue, 13 Jan 2009 16:36:36 + snip/ No, we tend to bottom-post on this list. It's just how we roll... Ash www.ashleysheridan.co.uk __ Check the weather nationwide with MSN Search Try it now! The user that your web server is running under (I'm guessing apache of wwwrun) , does this have permission to write to the file. If not, it won't be able to set the permissions for it. You may need to exec out a sudo command to do it, but I wouldn't recommend this. If you need PHP to be able to delete the file, what put it there in the first place? Ash www.ashleysheridan.co.uk What I am trying to do here is that a user would be pushing a button so that the data entries would generate an outfile. The only issue is that the lines would be appended in the file, (I have no issues with this part writing to the file, no permission errors, etc). Therefore, before the outfile is generated, I need to have the prexisting outfile removed and recreated to be written to so that it always stays a new file for use. This is why this script as you have seen is as it is so that I can constantly check if the file exists, and generate a new file if there is. In this case, is there something I could do? Thanks in advance. Alice __ All-in-one security and maintenance for your PC. Get a free 90-day trial! Learn more! If your script is writing to the file, and the directory has 777 permissions, then there should be no trouble deleting the file. If that's still a problem, why not each time the file needs to be created anew, open the file with a w flag, which will open it for writing, and will try to create the file if it doesn't already exist, so you wouldn't ever need to delete it at all. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP unlink Permission Error
Alice, I see that you are using windows. For windows only the write permission for the folder and file isn't enough. You need to change the owner ship of the file as well so that u have privilege to delete. Do this , this might work: //Change the owner ship of the file to a non existent user in the system chown($directory./.$file,666); unlink($directory./.$file); Thanks, V
[PHP] Re: Re: Php and CSS where to put it
Am 2009-01-12 21:56:00, schrieb Ashley Sheridan: Here's something for fixing IE with hacks: http://www.ashleysheridan.co.uk/coding_html_comments.php basically it lets you add in extra IE-only stylesheets using comment code only recognised by IE, and you can use !important to stress your IE styles. Best thing though is it validates through the W3C because it is just an HTML comment. Right and you can use it to free IE from ANY Cascading Style Sheets. :-D Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ http://www.can4linux.org/ Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] switch vs elseif
On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote: Ashley Sheridan schreef: On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefit of one over the other? for($i=0;$i3;$i++){ switch($i){ case 0: header pg1 code break; case 1: header pg2 code break; case 3: header pg3 code break; }; }; or would that be better served using an if...elseif structure? Frank And a switch is a lot neater for dealing with these sorts of things. I tend never to use if...elseif's at all, and use switches. Like Rob said, you can fall into further cases below, and it's very simple to add more at a later date. There is one place where an if...elseif would work and a switch could not, and that is where you were performing lots of different logic tests on different variables. switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. What is your intent if both $x === $y and $a != $b? From the above example only the code for $x === y will execute. This is hideous from a readability point of view since the first case and second case are matches, but only the first will get executed. This is better represented using an if/elseif/else structure to indicate the exclusion of later expressions. 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] Re: RewriteRules
On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http:// earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? -- Jason Pruim japr...@raoset.com 616.399.2355
[PHP] Re: downloading xls files corrupts them
Am 2009-01-12 13:13:25, schrieb Chris Ditty: I am using php to download xls files on my server. When I download them, excel is saying they are corrupted. They are not corrupted on the server itself. These are simple xls spreadsheets with no formatting in them. Here is the headers that I am using for the download. This is happening in both IE and Firefox. header(Pragma: public); header(Expires: 0); header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Content-Type: application/force-download); header(Content-Type: application/octet-stream); header(Content-Type: application/download); Why do you do this three times? You need only: header(Content-Type: application/vnd.ms-excel); header(Content-Disposition: attachment; filename=.basename(./bidDocs/.$myFile).;); header(Content-Transfer-Encoding: binary); Remove this line. header(Content-Length: .filesize(./bidDocs/.$myFile)); readfile(./bidDocs/.$myFile); Anyone have any suggestions? Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ http://www.can4linux.org/ Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Re: RewriteRules
On Tue, 2009-01-13 at 13:14 -0500, Jason Pruim wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http:// earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? Wow, that's really low level... I haven't written a form tag in years. :) 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] Re: RewriteRules
On Jan 13, 2009, at 1:26 PM, Robert Cummings wrote: On Tue, 2009-01-13 at 13:14 -0500, Jason Pruim wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? Wow, that's really low level... I haven't written a form tag in years. So then the question is begged... How do you write your forms? :) If there's a better way to do it I'm all ears! Other then using CSS... My HTML knowledge came from the 90's! :P -- Jason Pruim japr...@raoset.com 616.399.2355
Re: [PHP] Re: RewriteRules
On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? -- Jason Pruim japr...@raoset.com 616.399.2355 You know that's asking for xss, right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: RewriteRules
On Tue, Jan 13, 2009 at 10:28 AM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 1:26 PM, Robert Cummings wrote: On Tue, 2009-01-13 at 13:14 -0500, Jason Pruim wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? Wow, that's really low level... I haven't written a form tag in years. So then the question is begged... How do you write your forms? :) If there's a better way to do it I'm all ears! Other then using CSS... My HTML knowledge came from the 90's! :P -- Jason Pruim japr...@raoset.com 616.399.2355 Build yourself a form builder :). Makes writing a page as east as 1 2 3! -- Kyle Terry | www.kyleterry.com
Re: [PHP] Re: RewriteRules
On Jan 13, 2009, at 1:30 PM, Kyle Terry wrote: On Tue, Jan 13, 2009 at 10:28 AM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 1:26 PM, Robert Cummings wrote: On Tue, 2009-01-13 at 13:14 -0500, Jason Pruim wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? Wow, that's really low level... I haven't written a form tag in years. So then the question is begged... How do you write your forms? :) If there's a better way to do it I'm all ears! Other then using CSS... My HTML knowledge came from the 90's! :P -- Jason Pruim japr...@raoset.com 616.399.2355 Build yourself a form builder :). Makes writing a page as east as 1 2 3! I'm getting there... But it works better for me if I understand how it all works before I try and write software to automate it :) -- Jason Pruim japr...@raoset.com 616.399.2355
Re: [PHP] Re: RewriteRules
On Jan 13, 2009, at 1:29 PM, Eric Butera wrote: On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http:// earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http:// earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? -- Jason Pruim japr...@raoset.com 616.399.2355 You know that's asking for xss, right? Not until just now But I'll be looking into that and changing it to something more secure very shortly. -- Jason Pruim japr...@raoset.com 616.399.2355
Re: [PHP] Re: RewriteRules
On Tue, Jan 13, 2009 at 1:32 PM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 1:29 PM, Eric Butera wrote: On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? -- Jason Pruim japr...@raoset.com 616.399.2355 You know that's asking for xss, right? Not until just now But I'll be looking into that and changing it to something more secure very shortly. -- Jason Pruim japr...@raoset.com 616.399.2355 This might help: http://www.thespanner.co.uk/2008/01/14/exploiting-php-self/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
On Tue, 13 Jan 2009 15:51:01 +0200, Thodoris wrote: Hi gang, I am generating a spreadsheet using the contents of a mysql table. I guess that there is something in the data that causes iconv used in the module's script to generate this error: *Notice*: iconv() [function.iconv file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv]: Detected an incomplete multibyte character in input string in */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line *1547* This causes the production of weird characters in a cell in the spreadsheet and after that cell everything is printed out of order. The data in the mysql table are filtered for non-printable character before the data import. What data goes into that cell? Can you provide a hex dump of the data? How do you filter the data? How do you write it to the worksheet? What character encoding did you set? /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Suggestions?
Hello all! I have written some code that will calculate all static and floating holidays. I have also written some code that will act as a business day counter. My application currently determines a set number of business days to count. (2 business days and 7 business days from today) This part works great and gives the results I want. What I need to do is tie in my pre dertermined static and floating holidays and factor those into the busniess day counter. I was thinking of putting the holidays into an array and then doing a check to determine if any date in the array equaled today's date through the ending date. But I'm drawing a blank on how to create the array. // Create an empty array $holidays = array(); But then how do I put each holiday value into the array as it is calculated? Can I assign it that way? Or should I calculate all of the values and then build the array at the end? Or should I not even use an array? Thanks, Dan
Re: [PHP] Re: RewriteRules
On Tue, 2009-01-13 at 13:28 -0500, Jason Pruim wrote: Wow, that's really low level... I haven't written a form tag in years. So then the question is begged... How do you write your forms? :) If there's a better way to do it I'm all ears! Other then using CSS... My HTML knowledge came from the 90's! :P I use my FormJinn engine... here's a login form as an example: ?php function createForm() { $formJinn = $this-getServiceRef( 'formJinn' ); $trans = $this-getServiceRef( 'translation' ); // // // Some pre-handling. // // // // // Set up data for options. // // // // // Setup form criteria. // // $fields = array(); $values = array(); $preProcessors = array(); $validators = array(); $postProcessors = array(); $fields['username'] = 'text'; $fields['password'] = 'password'; $fields['redirect'] = 'hidden'; $fields['continue'] = 'submit'; // // // Preset values. // // $redirect = trim( (string)$this-getHttpGetVar( 'redirect' ) ); if( $redirect ) { $values['redirect'] = $redirect; } // // // Field widget attributes. // // $widgetAtts = array ( 'username' = array ( ), 'password' = array ( 'secure' = true, ), 'continue' = array ( 'label' = $trans-get( 'Login' ), ), ); // // // Widgets for which a breakdown of elements is desired. // // $widgetElements = array(); // // // Field value validators. // // $validators = array ( 'username' = array ( array ( 'type' = 'mandatory', 'errorMessage' = $trans-expand( '[!Required][!:] [!email address]' ), ), ), 'password' = array ( array ( 'type' = 'mandatory', 'errorMessage' = $trans-expand( '[!Required][!:] [!password]' ), ), ), ); // // // Form handlers. // // $processHandler = array ( array ( 'type' = 'custom', 'source' = 'MyProject/modules/auth/controller.php', 'method' = 'processLoginSubmission', ), ); // // // Generate the form using formJinn. // // $criteria = array ( 'formInfo' = array ( 'name' = $this-formName, 'actionUrl' = $this-actionUrl, 'finalize' = $processHandler, 'aggregateFields' = 'redirect', ), 'fieldInfo' = array ( 'fields'= $fields, 'values'= $values, 'clearValues' = true, 'preProcessors' = $preProcessors, 'validators'= $validators, 'postProcessors'= $postProcessors, 'widgetAtts'= $widgetAtts, 'widgetElements'= $widgetElements, ), ); $this-slices
Re: [PHP] Suggestions?
On Tue, Jan 13, 2009 at 2:00 PM, Dan Shirah mrsqua...@gmail.com wrote: Hello all! I have written some code that will calculate all static and floating holidays. I have also written some code that will act as a business day counter. My application currently determines a set number of business days to count. (2 business days and 7 business days from today) This part works great and gives the results I want. What I need to do is tie in my pre dertermined static and floating holidays and factor those into the busniess day counter. I was thinking of putting the holidays into an array and then doing a check to determine if any date in the array equaled today's date through the ending date. But I'm drawing a blank on how to create the array. // Create an empty array $holidays = array(); But then how do I put each holiday value into the array as it is calculated? Can I assign it that way? Or should I calculate all of the values and then build the array at the end? Or should I not even use an array? Thanks, Dan Are you asking how to do $holidays[] = date; array_push($holidays, date); ? If you were generating dates to compare against today tho, you could just return upon a match at that point and not even store them. No point in creating some big array in a loop only to loop through it again when you could have done it the first time around. I'd put this into a function though so that I could return out upon a match. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Suggestions?
Hard to say without knowing the data structures... You can't do a simple count of the holidays and add that, because you might end up with yet another holiday in the result. Start at 12/23 and want to add 6 business days. You find 1 holiday in between, so you add 7 business days and end up on New Year's Day, a non-business day. 12/23 12/24 12/25 X 12/26 12/27 12/28 12/29 12/30 12/31 01/01 X I think MySQL has built-in holiday / work day calculations, come to think of it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Suggestions?
On Tue, Jan 13, 2009 at 2:09 PM, Eric Butera eric.but...@gmail.com wrote: Are you asking how to do $holidays[] = date; array_push($holidays, date); ? If you were generating dates to compare against today tho, you could just return upon a match at that point and not even store them. No point in creating some big array in a loop only to loop through it again when you could have done it the first time around. I'd put this into a function though so that I could return out upon a match. Not to only compare against today. I want to determine if any of the holiday dates are equal to or between dates in a date range. For example: I need to calculate 2 business days from today. Today is Wednesday December 23rd. December 24th and 25th are holidays. December 26th and 27th are the weekend. So 2 business days from December 23rd would be December 29th. So multiple holiday dates could fall into the range I am trying to get so I would think I'd need to loop through all of the holidays to catch all of the holidays that may fall within the range and add an additional day as needed to get the correct business day.
Re: [PHP] Suggestions?
On Tue, 2009-01-13 at 19:14 +, c...@l-i-e.com wrote: Hard to say without knowing the data structures... You can't do a simple count of the holidays and add that, because you might end up with yet another holiday in the result. Start at 12/23 and want to add 6 business days. You find 1 holiday in between, so you add 7 business days and end up on New Year's Day, a non-business day. 12/23 12/24 12/25 X 12/26 12/27 12/28 12/29 12/30 12/31 01/01 X I think MySQL has built-in holiday / work day calculations, come to think of it... I thought the calculation for holidays went as follows: ?php function isHoliday( $timestamp ) { return checkingEmailsDuringDay( $timestamp ) ? false : true; } ? 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
[PHP] Query string question
I have something like this on my site: mysite.com/índex.php?msg=Transa%25E7%25E3o+n%25E3o+autorizada i need to convert Transa%25E7%25E3o+n%25E3o+autorizada to Transação não autorizada. The letters ç ã, and others (é, í, ...). Someone can help me? -Mensagem original- De: Eric Butera [mailto:eric.but...@gmail.com] Enviada em: terça-feira, 13 de janeiro de 2009 17:09 Para: Dan Shirah Cc: PHP-General list Assunto: Re: [PHP] Suggestions? On Tue, Jan 13, 2009 at 2:00 PM, Dan Shirah mrsqua...@gmail.com wrote: Hello all! I have written some code that will calculate all static and floating holidays. I have also written some code that will act as a business day counter. My application currently determines a set number of business days to count. (2 business days and 7 business days from today) This part works great and gives the results I want. What I need to do is tie in my pre dertermined static and floating holidays and factor those into the busniess day counter. I was thinking of putting the holidays into an array and then doing a check to determine if any date in the array equaled today's date through the ending date. But I'm drawing a blank on how to create the array. // Create an empty array $holidays = array(); But then how do I put each holiday value into the array as it is calculated? Can I assign it that way? Or should I calculate all of the values and then build the array at the end? Or should I not even use an array? Thanks, Dan Are you asking how to do $holidays[] = date; array_push($holidays, date); ? If you were generating dates to compare against today tho, you could just return upon a match at that point and not even store them. No point in creating some big array in a loop only to loop through it again when you could have done it the first time around. I'd put this into a function though so that I could return out upon a match. -- 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] Query string question
On Tue, 2009-01-13 at 17:21 -0200, Jônatas Zechim wrote: I have something like this on my site: mysite.com/índex.php?msg=Transa%25E7%25E3o+n%25E3o+autorizada i need to convert Transa%25E7%25E3o+n%25E3o+autorizada to Transação não autorizada. The letters ç ã, and others (é, í, ...). Someone can help me? urldecode() 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] Suggestions?
On Tue, Jan 13, 2009 at 2:14 PM, c...@l-i-e.com wrote: Hard to say without knowing the data structures... You can't do a simple count of the holidays and add that, because you might end up with yet another holiday in the result. Start at 12/23 and want to add 6 business days. You find 1 holiday in between, so you add 7 business days and end up on New Year's Day, a non-business day. 12/23 12/24 12/25 X 12/26 12/27 12/28 12/29 12/30 12/31 01/01 X I think MySQL has built-in holiday / work day calculations, come to think of it... Exactly, ceo! That's why I'm thinking of creating the array and then running a foreach() loop on the array. $day = date(w); $today = date(m-d-Y); if ($day == 4 || $day == 5) { $two_day = mktime(0, 0, 0, date(m), date(d)+4, date(Y)); $two_day = date(m-d-Y, $two_day); } else { $two_day = mktime(0, 0, 0, date(m), date(d)+2, date(Y)); $two_day = date(m-d-Y, $two_day); } foreach ($holiday as $h) { if ($h = $today $h = $two_day) { $two_day = mktime(0, 0, 0, date(m, $two_day), date(d, $two_day)+1, date(Y, $two_day)); $two_day = date(m-d-Y, $two_day); } } That should add a day for each instance of a holiday that falls between the dates, right?
Re: [PHP] switch vs elseif
Jochem Maas wrote: switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. This is a misuse of the switch statement. Switch is meant to compare values to a single variable as stated on the manual page: http://us2.php.net/switch Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php session GC error
I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
I think if they didn't want us to use expressions in the case, then they wouldn't have put support into the language for that. I daresay you are reading more into the text than was intended... I certainly have found switch(true) with complex expressions for case quite handy and very clear code on several occasions. ymmv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- 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] switch vs elseif
Micah Gersten schreef: Jochem Maas wrote: switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. This is a misuse of the switch statement. Switch is meant to compare values to a single variable as stated on the manual page: http://us2.php.net/switch bla bla, I did say it was evil, for a more thorough rebuttal a defer to Richard Lynch. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
Shawn McKenzie nos...@mckenzies.net wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- Thanks! -Shawn http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
Jochem Maas wrote: Micah Gersten schreef: Jochem Maas wrote: switch (true) { should be switch(false) { :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
Frank Stanovcak wrote: Shawn McKenzie nos...@mckenzies.net wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- Thanks! -Shawn http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? try changing it to the correct case then come back and tell us if case matters? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
Robert Cummings schreef: On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote: Ashley Sheridan schreef: On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefit of one over the other? for($i=0;$i3;$i++){ switch($i){ case 0: header pg1 code break; case 1: header pg2 code break; case 3: header pg3 code break; }; }; or would that be better served using an if...elseif structure? Frank And a switch is a lot neater for dealing with these sorts of things. I tend never to use if...elseif's at all, and use switches. Like Rob said, you can fall into further cases below, and it's very simple to add more at a later date. There is one place where an if...elseif would work and a switch could not, and that is where you were performing lots of different logic tests on different variables. switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. What is your intent if both $x === $y and $a != $b? From the above example only the code for $x === y will execute. no shit. that would be the intention too :-) This is hideous from a readability point of view since the first case and second case are matches, but only the first will get executed. This is better represented using an if/elseif/else structure to indicate the exclusion of later expressions. that is just a matter of opinion. it's no different to an if/elseif/elseif/elseif block functionally ... you just don't like the way it looks ... I'd point out though that you had no trouble determining the code's intention correctly, and I'm sure you didn't stare at it too long ... so I'd hazard to say it's not *that* illegible. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
Nathan Rixham schreef: Jochem Maas wrote: Micah Gersten schreef: Jochem Maas wrote: switch (true) { should be switch(false) { :-) it could be either depending on your needs, no? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
Nathan Rixham nrix...@gmail.com wrote in message news:496d03d3.2060...@gmail.com... Frank Stanovcak wrote: Shawn McKenzie nos...@mckenzies.net wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- Thanks! -Shawn http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? try changing it to the correct case then come back and tell us if case matters? :) ok...let me try it like this. how do I explicitly tell PHP in the ini what directory to use for session storage and cleanup. I've been googling for about an hour now, and am just getting more frustrated. :( The server is a single purpose server, and it will remain that way, so I don't want to have to code ini settings into each page. :) Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
Micah Gersten wrote: Jochem Maas wrote: switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. This is a misuse of the switch statement. Switch is meant to compare values to a single variable as stated on the manual page: http://us2.php.net/switch Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Actually, if you read the link you posted, the first paragraph: In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for. Notice the (or expression), which I believe true is one. Also, down the page: The case expression may be any expression that evaluates to a simple type, that is, integer or floating-point numbers and strings. Arrays or objects cannot be used here unless they are dereferenced to a simple type. I believe boolean is also one. I would point out however that the switch does a loose comparison, so this would be different: switch (true) { case (strpos(shawn, s)): //actually returns 0 so is false break; case (strpos(shawn, s) !== false): //returns true break; } -- 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] switch vs elseif
On Tue, 2009-01-13 at 22:12 +0100, Jochem Maas wrote: Robert Cummings schreef: On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote: Ashley Sheridan schreef: On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefit of one over the other? for($i=0;$i3;$i++){ switch($i){ case 0: header pg1 code break; case 1: header pg2 code break; case 3: header pg3 code break; }; }; or would that be better served using an if...elseif structure? Frank And a switch is a lot neater for dealing with these sorts of things. I tend never to use if...elseif's at all, and use switches. Like Rob said, you can fall into further cases below, and it's very simple to add more at a later date. There is one place where an if...elseif would work and a switch could not, and that is where you were performing lots of different logic tests on different variables. switch (true) { case ($x === $y): // something break; case ($a != $b): // something break; case (myFunc()): // something break; case ($my-getChild()-hasEatenBeans()): // something break; } evil ... but it works. What is your intent if both $x === $y and $a != $b? From the above example only the code for $x === y will execute. no shit. that would be the intention too :-) This is hideous from a readability point of view since the first case and second case are matches, but only the first will get executed. This is better represented using an if/elseif/else structure to indicate the exclusion of later expressions. that is just a matter of opinion. it's no different to an if/elseif/elseif/elseif block functionally ... you just don't like the way it looks No, it's not just a matter of functionality in this case. It malforms the semantic meaning of the named expressions so that they no longer provide clearly readable meaning. ... I'd point out though that you had no trouble determining the code's intention correctly, and I'm sure you didn't stare at it too long I'm special though ;) ... so I'd hazard to say it's not *that* illegible. Yes, that's right, it's a hazard alright. A hazard to avoid by any self-respecting developer who's not competing in a code obfuscation contest :) 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
[PHP] Re: php session GC error
Frank Stanovcak wrote: Nathan Rixham nrix...@gmail.com wrote in message news:496d03d3.2060...@gmail.com... Frank Stanovcak wrote: Shawn McKenzie nos...@mckenzies.net wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- Thanks! -Shawn http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? try changing it to the correct case then come back and tell us if case matters? :) ok...let me try it like this. how do I explicitly tell PHP in the ini what directory to use for session storage and cleanup. I've been googling for about an hour now, and am just getting more frustrated. :( The server is a single purpose server, and it will remain that way, so I don't want to have to code ini settings into each page. :) Frank Should be session.save_path, but check phpinfo() to see what it's using. Should be the path in the error. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
Shawn McKenzie nos...@mckenzies.net wrote in message news:e3.00.25553.8560d...@pb1.pair.com... Frank Stanovcak wrote: Nathan Rixham nrix...@gmail.com wrote in message news:496d03d3.2060...@gmail.com... Frank Stanovcak wrote: Shawn McKenzie nos...@mckenzies.net wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- Thanks! -Shawn http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? try changing it to the correct case then come back and tell us if case matters? :) ok...let me try it like this. how do I explicitly tell PHP in the ini what directory to use for session storage and cleanup. I've been googling for about an hour now, and am just getting more frustrated. :( The server is a single purpose server, and it will remain that way, so I don't want to have to code ini settings into each page. :) Frank Should be session.save_path, but check phpinfo() to see what it's using. Should be the path in the error. -- Thanks! -Shawn http://www.spidean.com So if my ini looks like the following I should be able to get rid of any session data after a preset timelimit? session.save_path = C:\temp ; Whether to use cookies. session.use_cookies = 1 ;session.cookie_secure = ; This option enables administrators to make their users invulnerable to ; attacks which involve passing session ids in URLs; defaults to 0. ; session.use_only_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID ; Initialize session on request startup. session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 ; The path for which the cookie is valid. session.cookie_path = / ; The domain for which the cookie is valid. session.cookie_domain = ; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. session.cookie_httponly = ; Handler used to serialize data. php is the standard serializer of PHP. session.serialize_handler = php ; Define the probability that the 'garbage collection' process is started ; on every session initialization. ; The probability is calculated by using gc_probability/gc_divisor, ; e.g. 1/100 means there is a 1% chance that the GC process starts ; on each request. session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] installing php 5 with pdflib
Hi there, I am still facing trouble with pdflib and php 5. After hours of research I found that I do have to install the pecl package. So I decided to compile it into php staticly like described here: http://www.php-resource.de/handbuch/install.pecl.static.htm The configure command stops with the error: configure: error: pdflib.h not found! Check the path passed to --with-pdflib=PATH. PATH should be the install prefix directory. actually the file is and always was there. Does it have to be a new version? I am using pdflib 4.x which workes fine in the running php 4.x installation. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] installing php 5 with pdflib
On Tue, Jan 13, 2009 at 4:38 PM, Merlin Morgenstern merli...@fastmail.fmwrote: Hi there, I am still facing trouble with pdflib and php 5. After hours of research I found that I do have to install the pecl package. So I decided to compile it into php staticly like described here: http://www.php-resource.de/handbuch/install.pecl.static.htm The configure command stops with the error: configure: error: pdflib.h not found! Check the path passed to --with-pdflib=PATH. PATH should be the install prefix directory. actually the file is and always was there. Does it have to be a new version? I am using pdflib 4.x which workes fine in the running php 4.x installation. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php try dompdf from www.digitaljunkies.ca...its a class for pdf that I found pretty simple to implement -- Bastien Cat, the other other white meat
[PHP] Re: php session GC error
So from everything I've read there is no real way to assure a session timeout with out timestamping it myself and dealing with it in code by doing a time compare. bummer. Frank Stanovcak blindspot...@comcast.net wrote in message news:57.31.25553.de80d...@pb1.pair.com... Shawn McKenzie nos...@mckenzies.net wrote in message news:e3.00.25553.8560d...@pb1.pair.com... Frank Stanovcak wrote: Nathan Rixham nrix...@gmail.com wrote in message news:496d03d3.2060...@gmail.com... Frank Stanovcak wrote: Shawn McKenzie nos...@mckenzies.net wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... Frank Stanovcak wrote: I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank Does C:\WINDOWS\TEMP\ exist? -- Thanks! -Shawn http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? try changing it to the correct case then come back and tell us if case matters? :) ok...let me try it like this. how do I explicitly tell PHP in the ini what directory to use for session storage and cleanup. I've been googling for about an hour now, and am just getting more frustrated. :( The server is a single purpose server, and it will remain that way, so I don't want to have to code ini settings into each page. :) Frank Should be session.save_path, but check phpinfo() to see what it's using. Should be the path in the error. -- Thanks! -Shawn http://www.spidean.com So if my ini looks like the following I should be able to get rid of any session data after a preset timelimit? session.save_path = C:\temp ; Whether to use cookies. session.use_cookies = 1 ;session.cookie_secure = ; This option enables administrators to make their users invulnerable to ; attacks which involve passing session ids in URLs; defaults to 0. ; session.use_only_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID ; Initialize session on request startup. session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 ; The path for which the cookie is valid. session.cookie_path = / ; The domain for which the cookie is valid. session.cookie_domain = ; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. session.cookie_httponly = ; Handler used to serialize data. php is the standard serializer of PHP. session.serialize_handler = php ; Define the probability that the 'garbage collection' process is started ; on every session initialization. ; The probability is calculated by using gc_probability/gc_divisor, ; e.g. 1/100 means there is a 1% chance that the GC process starts ; on each request. session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
I regret that I don't recall who made the brilliant observation that programmers spend the majority of their time *reading* code (their own or others) as opposed to *writing* code. So, I make it a point to try to make my code easily scannable. I only and always use the switch construct when evaluating the value of a single variable. The switch then tells me that at a glance when I'm reading code, and I don't have to plow through a bunch of elseif clauses to get the big picture of what the code is doing. The bottom line for me on this issue is the bottom line - productivity. Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Php and CSS where to put it
On Tue, 2009-01-13 at 18:41 +0100, Michelle Konzack wrote: Am 2009-01-12 21:56:00, schrieb Ashley Sheridan: Here's something for fixing IE with hacks: http://www.ashleysheridan.co.uk/coding_html_comments.php basically it lets you add in extra IE-only stylesheets using comment code only recognised by IE, and you can use !important to stress your IE styles. Best thing though is it validates through the W3C because it is just an HTML comment. Right and you can use it to free IE from ANY Cascading Style Sheets. :-D Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant Yeah. Now my development goes like this: 1. Design for Firefox 2. Fix for Opera, Safari et al 3. Fix for IE But generally speaking, if it works in Firefox, it'll most likely behave itself in everything except IE ;) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
Frank Stanovcak wrote: So from everything I've read there is no real way to assure a session timeout with out timestamping it myself and dealing with it in code by doing a time compare. bummer. you're probably storing the session in a session cookie (which is default) so session.cookie_lifetime will come in to play; you've got it set to 0 so no session will timeout until the browser controlling the session is closed and restarted.. try changing it to 30 as well then you should find all sessions time out after 30 seconds of in activity -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Php and CSS where to put it
On Tue, Jan 13, 2009 at 5:14 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Yeah. Now my development goes like this: 1. Design for Firefox 2. Fix for Opera, Safari et al 3. Fix for IE But generally speaking, if it works in Firefox, it'll most likely behave itself in everything except IE ;) Ash www.ashleysheridan.co.uk In my experience, it's usually IE that is doing the misbehaving. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php session GC error
On Tue, Jan 13, 2009 at 5:08 PM, Nathan Rixham nrix...@gmail.com wrote: Frank Stanovcak wrote: So from everything I've read there is no real way to assure a session timeout with out timestamping it myself and dealing with it in code by doing a time compare. bummer. you're probably storing the session in a session cookie (which is default) so session.cookie_lifetime will come in to play; you've got it set to 0 so no session will timeout until the browser controlling the session is closed and restarted.. try changing it to 30 as well then you should find all sessions time out after 30 seconds of in activity I was under the impression that setting session.cookie_lifetime to something greater than 0 had a few repercussions: 1) The session cookie is written to disk rather than being stored only in memory. 2) Because the cookie now has a lifetime, it is still valid even if the browser closes and reopens within the cookie_lifetime. Neither of these are something I want. Because of that (and the occasional need to persist sessions on clustered web servers) I usually write my own session save handler. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: RewriteRules
On Tue, 2009-01-13 at 13:29 -0500, Eric Butera wrote: On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim japr...@raoset.com wrote: On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:33 -0500, tedd wrote: At 2:33 PM + 1/13/09, Ashley Sheridan wrote: On Tue, 2009-01-13 at 09:20 -0500, tedd wrote: Jason: In addition to what everyone else has said, try this: $self = basename($_SERVER['SCRIPT_NAME']) I use it for forms -- you might find it useful. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com No need to use it on forms, as leaving the action attribute empty means the form sends to itself anyway. Ash Ash: That's what I've said for years, but (I think it was on this list, but too lazy to look) there was a concern that some browsers may not follow that default behavior. However, using what I provided will work regardless. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I've not yet seen a browser that doesn't do this, and it's pretty old HTML really, so I don't see a reason why any new browsers wouldn't incorporate it. I prefer to be specific in my programming :) What I typically do with self submitting forms is: ?PHP $self = $_SERVER['PHP_SELF']; echo HTML form method=post action={$self} ... /form HTML; ? But to each his (Or her) own right? -- Jason Pruim japr...@raoset.com 616.399.2355 You know that's asking for xss, right? How would you go about XSS on this? As I see it, you'd need register_globals on for that to work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] installing php 5 with pdflib
On Tue, 2009-01-13 at 16:58 -0500, Bastien Koert wrote: On Tue, Jan 13, 2009 at 4:38 PM, Merlin Morgenstern merli...@fastmail.fmwrote: Hi there, I am still facing trouble with pdflib and php 5. After hours of research I found that I do have to install the pecl package. So I decided to compile it into php staticly like described here: http://www.php-resource.de/handbuch/install.pecl.static.htm The configure command stops with the error: configure: error: pdflib.h not found! Check the path passed to --with-pdflib=PATH. PATH should be the install prefix directory. actually the file is and always was there. Does it have to be a new version? I am using pdflib 4.x which workes fine in the running php 4.x installation. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php try dompdf from www.digitaljunkies.ca...its a class for pdf that I found pretty simple to implement I use FPDF and it works like a dream! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Holy crap
On Mon, Jan 12, 2009 at 14:30, Robert Cummings rob...@interjinn.com wrote: 2.0 is the new beta... what did you think Web 2.0 was all about? In Q3 2009, Microsoft is improving on that with Web 2.11 for Workgroups. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Holy crap
On Tue, Jan 13, 2009 at 5:22 PM, Daniel Brown danbr...@php.net wrote: On Mon, Jan 12, 2009 at 14:30, Robert Cummings rob...@interjinn.com wrote: 2.0 is the new beta... what did you think Web 2.0 was all about? In Q3 2009, Microsoft is improving on that with Web 2.11 for Workgroups. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php www.idonttrustmicrosoftwithmywebsite.com/ps/i/hate/them/ -- Kyle Terry | www.kyleterry.com
Re: [PHP] Holy crap
On Tue, Jan 13, 2009 at 20:34, Kyle Terry k...@kyleterry.com wrote: www.idonttrustmicrosoftwithmywebsite.com/ps/i/hate/them/ Couldn't reach the site. Try restarting IIS. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upgrade php 5.2.6 - 5.2.8 mysql problems!
Hi, Tuesday, January 13, 2009, 9:25:57 AM, you wrote: MM Hello everybody, MM I am trying to update php 5.2.6 to 5.2.8 on a test system. Somehow it MM can not find the working mysql installation. With 5.2.6 I everything is MM fine. MM Here is the configure command that is pretty much the same as in 5.2.6: MM './configure' '--enable-fastcgi' '--with-mysql' MM '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' MM '--enable-mbstring' '--with-pdo-mysql=/usr/local/mysql/' MM '--with-mysql-sock=/tmp' '--enable-soap' '--with-zlib' MM '--with-freetype-dir=/usr/local/lib' '--with-gd' '--with-jpeg-dir=/usr' MM '--with-png-dir=/usr/lib' '--enable-exif' '--enable-cli' MM PHP returns: MM checking for MySQL UNIX socket location... /tmp MM configure: error: Cannot find MySQL header files under yes. MM Note that the MySQL client library is not bundled anymore! MM According to a google search mysql-dev is not installed. So I tried to MM get it with yast on the suse 11.0 server. No luck. So I got it via a MM rpm. That returns: MM rpm -i mysql-devel.rpm MM error: Failed dependencies: MM mysql-client is needed by mysql-devel-5.0.26-21.x86_64 MM mysql-shared = 5.0.26 is needed by mysql-devel-5.0.26-21.x86_64 MM libc.so.6()(64bit) is needed by mysql-devel-5.0.26-21.x86_64 MM libc.so.6(GLIBC_2.2.5)(64bit) is needed by MM mysql-devel-5.0.26-21.x86_64 MM libc.so.6(GLIBC_2.3.4)(64bit) is needed by MM mysql-devel-5.0.26-21.x86_64 MM libcrypt.so.1()(64bit) is needed by mysql-devel-5.0.26-21.x86_64 MM libm.so.6()(64bit) is needed by mysql-devel-5.0.26-21.x86_64 MM libnsl.so.1()(64bit) is needed by mysql-devel-5.0.26-21.x86_64 MM libpthread.so.0()(64bit) is needed by mysql-devel-5.0.26-21.x86_64 MM libpthread.so.0(GLIBC_2.2.5)(64bit) is needed by MM mysql-devel-5.0.26-21.x86_64 MM libpthread.so.0(GLIBC_2.3.2)(64bit) is needed by MM mysql-devel-5.0.26-21.x86_64 MM Something must be wrong. I can't believe that there is so much change MM necessary for such a minur upgrade. MM Any ideas? Thank you for any help, MM Merlin try getting rid of the trailing slash ('--with-pdo-mysql=/usr/local/mysql/') -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Holy crap
On Tue, Jan 13, 2009 at 5:49 PM, Daniel Brown danbr...@php.net wrote: On Tue, Jan 13, 2009 at 20:34, Kyle Terry k...@kyleterry.com wrote: www.idonttrustmicrosoftwithmywebsite.com/ps/i/hate/them/ Couldn't reach the site. Try restarting IIS. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! Every time I try I get this error: * HTTP Error 500.22 - Internal Server Error* An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. Please install .NET 5000 wrapped in SilverLight 15 wrapping paper. -- Kyle Terry | www.kyleterry.com
Re: [PHP] Holy crap
On Tue, Jan 13, 2009 at 20:54, Kyle Terry k...@kyleterry.com wrote: Every time I try I get this error: HTTP Error 500.22 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. Please install .NET 5000 wrapped in SilverLight 15 wrapping paper. Following through the online troubleshooter, the official technical support recommendation is to turn it off and on and jiggle the cord. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Holy crap
On Tue, Jan 13, 2009 at 6:03 PM, Daniel Brown danbr...@php.net wrote: On Tue, Jan 13, 2009 at 20:54, Kyle Terry k...@kyleterry.com wrote: Every time I try I get this error: HTTP Error 500.22 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. Please install .NET 5000 wrapped in SilverLight 15 wrapping paper. Following through the online troubleshooter, the official technical support recommendation is to turn it off and on and jiggle the cord. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! That just voided out my license. I called support and they said I have to buy a new serial, they can't get mine off the hidden information on the Windows Server 2008 disk. Guess the site will never be back online. Or I might just have to switch to Linux 0.o -- Kyle Terry | www.kyleterry.com
[PHP] PHP, Smarty, and Text
Hello, I've been using PHP and Smarty for several years now and I am happy with this division of data from presentation. With this philosophy in mind, i am a bit perplexed as to how to handle the text on my sites. That is, the text is data, so i am motivated to store the text in a database, files, or the like, but then text is loaded with little markup nuances (random italics/weight/colors, etc...) that make template design rather ugly. This motivates me to put markup (maybe even my own brand of markup) around the text, and to store this markup-text combination in a database. But I don't like this either, because a lot of the people writing the content/text know word/writer not markup. So i am motivated to have them save their text as .html, and I parse this file and modify accordingly. However, i don't like this either as not all word/writer styles are 1-to-1 with CSS. Without any options I am back to thinking hard code the text with markup in included templates, but it hurts just thinking of updating/modifying. I have looked (briefly) at Web Content Management Systems, but this seems like overkill really, maybe i'm ignorant. What would the community suggest? The text can take on many forms, introduction text, about text, product information, articles, blurbs, (some changes daily, some doesn't) etc...where does all this text live in 'properly' designed site. Thanks in advance, dK
Re: [PHP] Suggestions?
I have a fiscal calendar table that I use for the same thing, storing the date, day of the week and a column indicating whether the day is a weekday, a weekend or a holiday. This allows me flexibility to also use the table to set business shutdowns as a holiday. A simple date query can return the number of holidays/weekends to do the business day calculation. Bastien Sent from my iPod On Jan 13, 2009, at 2:28 PM, Dan Shirah mrsqua...@gmail.com wrote: On Tue, Jan 13, 2009 at 2:14 PM, c...@l-i-e.com wrote: Hard to say without knowing the data structures... You can't do a simple count of the holidays and add that, because you might end up with yet another holiday in the result. Start at 12/23 and want to add 6 business days. You find 1 holiday in between, so you add 7 business days and end up on New Year's Day, a non-business day. 12/23 12/24 12/25 X 12/26 12/27 12/28 12/29 12/30 12/31 01/01 X I think MySQL has built-in holiday / work day calculations, come to think of it... Exactly, ceo! That's why I'm thinking of creating the array and then running a foreach() loop on the array. $day = date(w); $today = date(m-d-Y); if ($day == 4 || $day == 5) { $two_day = mktime(0, 0, 0, date(m), date(d)+4, date(Y)); $two_day = date(m-d-Y, $two_day); } else { $two_day = mktime(0, 0, 0, date(m), date(d)+2, date(Y)); $two_day = date(m-d-Y, $two_day); } foreach ($holiday as $h) { if ($h = $today $h = $two_day) { $two_day = mktime(0, 0, 0, date(m, $two_day), date(d, $two_day)+1, date(Y, $two_day)); $two_day = date(m-d-Y, $two_day); } } That should add a day for each instance of a holiday that falls between the dates, right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php