php-general Digest 17 Aug 2006 14:02:44 -0000 Issue 4298
php-general Digest 17 Aug 2006 14:02:44 - Issue 4298 Topics (messages 240792 through 240801): Re: PHPSESSID used sporatically 240792 by: Chris 240793 by: Chris 240794 by: Michael B Allen 240798 by: Michael B Allen pear constants 240795 by: JRuiz 240796 by: Chris Re: simple scrip to stop email injection 240797 by: Ivo F.A.C. Fokkema active directory and PHP 240799 by: Alain Roger 240800 by: Chris select colum in array. 240801 by: João Cândido de Souza Neto Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Michael B Allen wrote: Searching through the logs and browsing my site (see sig) I sometimes see PHPSESSID is used as opposed to cookies. I know it's not simply that the client doesn't support cookies because I can see the same IP transition to and from using PHPSESSID. Can someone explain why this is happening? Is session.use_trans_sid switched on? (Check a phpinfo page). -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- Michael B Allen wrote: On Thu, 17 Aug 2006 12:06:08 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: Searching through the logs and browsing my site (see sig) I sometimes see PHPSESSID is used as opposed to cookies. I know it's not simply that the client doesn't support cookies because I can see the same IP transition to and from using PHPSESSID. Can someone explain why this is happening? Is session.use_trans_sid switched on? Yes. It is. After reading about it I can't quite see what benifit it provides. Should I just turn it off? It depends on your site. If you do something like this for a search: ?php ... if (!isset($_SESSION['SearchResults']) || empty($_SESSION['SearchResults'])) { .. $result = $db-query($search_query); $search_results = array(); while($row = $db-fetch($result)) { $search_results[] = $row; } $_SESSION['SearchResults'] = $search_results; } foreach($_SESSION['SearchResults'] as $k = $details) { } I could send someone a url with the sessionid on the end of it, and it won't have to do the bit in the middle, it will be able to jump right to the end (the foreach loop). If you don't do something like that, then you probably don't need the trans_sid on. so it depends on your site and your code. -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- On Thu, 17 Aug 2006 14:26:17 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: On Thu, 17 Aug 2006 12:06:08 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: Searching through the logs and browsing my site (see sig) I sometimes see PHPSESSID is used as opposed to cookies. I know it's not simply that the client doesn't support cookies because I can see the same IP transition to and from using PHPSESSID. Can someone explain why this is happening? Is session.use_trans_sid switched on? Yes. It is. After reading about it I can't quite see what benifit it provides. Should I just turn it off? It depends on your site. If you do something like this for a search: snip I could send someone a url with the sessionid on the end of it, and it won't have to do the bit in the middle, it will be able to jump right to the end (the foreach loop). I'm not doing anything like that. Sessions are only used to prevent duplicate form invokations. But my boilerplate code calls session_start for all .php pages. I suppose I should be more selective to make things a little more efficient. But I'm still confuse. Why aren't cookies alone sufficient to satisfy the session code? Is PHPSESSID used because of some kind of transition from a PHP page that calls session_start to a page that does not? Does session.use_trans_sid simply enable the PHPSESSID in URLs or does it have a deeper semantic? The URLs for the tabs my site are not dynamically generated and yet they're being rewritten. Is that PHP or Apache doing that? Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ ---End Message--- ---BeginMessage--- On Thu, 17 Aug 2006 12:06:08 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: Searching through the logs and browsing my site (see sig) I sometimes see PHPSESSID is used as opposed to cookies. I know it's not simply that the client doesn't support cookies because I can see the same IP transition to and from using PHPSESSID. Can someone explain why this is happening? Is session.use_trans_sid switched on? Yes. It is. After reading about it I can't quite see what benifit it provides. Should I just turn it off? Mike -- Michael B Allen PHP Active Directory SSO
Re: [PHP] PHPSESSID used sporatically
On Thu, 17 Aug 2006 14:26:17 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: On Thu, 17 Aug 2006 12:06:08 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: Searching through the logs and browsing my site (see sig) I sometimes see PHPSESSID is used as opposed to cookies. I know it's not simply that the client doesn't support cookies because I can see the same IP transition to and from using PHPSESSID. Can someone explain why this is happening? Is session.use_trans_sid switched on? Yes. It is. After reading about it I can't quite see what benifit it provides. Should I just turn it off? It depends on your site. If you do something like this for a search: snip I could send someone a url with the sessionid on the end of it, and it won't have to do the bit in the middle, it will be able to jump right to the end (the foreach loop). I'm not doing anything like that. Sessions are only used to prevent duplicate form invokations. But my boilerplate code calls session_start for all .php pages. I suppose I should be more selective to make things a little more efficient. But I'm still confuse. Why aren't cookies alone sufficient to satisfy the session code? Is PHPSESSID used because of some kind of transition from a PHP page that calls session_start to a page that does not? Does session.use_trans_sid simply enable the PHPSESSID in URLs or does it have a deeper semantic? The URLs for the tabs my site are not dynamically generated and yet they're being rewritten. Is that PHP or Apache doing that? Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pear constants
Hi All, I have a problem with some pear constants. I made a new installation of php + pear + propel (http://propel.phpdb.org) and now in my scripts the constant PEAR_INSTALL_DIR is not defined when in my previous installation it used to be... Other constants like the error ones (PEAR_ERROR_DIE, PEAR_ERROR_RETURN ...) are defined correctly Am I missing anything in the new installation? Thanks a lot! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pear constants
JRuiz wrote: Hi All, I have a problem with some pear constants. The pear lists live here: http://pear.php.net/support/lists.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple scrip to stop email injection
On Wed, 16 Aug 2006 15:54:32 -0500, Richard Lynch wrote: On Wed, August 16, 2006 4:53 am, Ross wrote: Been having loads of problems with this and have solved it using the phpmailer. The only problem is I cannot get the class working on the remote host I am working on. I am back to using mail() but need to drop in script that checks my fields $fname, $sname, $email, $subject, $message. Checking for a NEWLINE in all but $message will stop MOST of the email injection. if (preg_match(/\r\n/, array($fname, $sname, $email, $subject))){ die(Spammer!); } I think preg_match allows array for 2nd arg... Details. Hi, Shouldn't this be preg_match(/[\r\n]/, ... considering this is OS specific and on Unix/Linux just a newline would do, too? Most likely, on a Mac server, just \r would do as a header separator. The MTA on the system will interpret the OS specific line endings, and construct proper \r\n header separators before sending it out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPSESSID used sporatically
On Thu, 17 Aug 2006 12:06:08 +1000 Chris [EMAIL PROTECTED] wrote: Michael B Allen wrote: Searching through the logs and browsing my site (see sig) I sometimes see PHPSESSID is used as opposed to cookies. I know it's not simply that the client doesn't support cookies because I can see the same IP transition to and from using PHPSESSID. Can someone explain why this is happening? Is session.use_trans_sid switched on? Yes. It is. After reading about it I can't quite see what benifit it provides. Should I just turn it off? Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] active directory and PHP
Hi, I'm new to PHP, so sorry if my question looks like stupid. I have a web application which use authorization and authentication process to log-in. I would like to know if it exists a way to synchronize the authentication with our Active Directory domain ? Something like a single side-on. In fact, i want from my web application users to make them remember only their login/pwd from Active directory to use my application. thanks a lot, Alain
Re: [PHP] active directory and PHP
On 8/17/06, Alain Roger [EMAIL PROTECTED] wrote: Hi, I'm new to PHP, so sorry if my question looks like stupid. I have a web application which use authorization and authentication process to log-in. I would like to know if it exists a way to synchronize the authentication with our Active Directory domain ? You sure can. Check out http://www.php.net/ldap Even though they are ldap functions they can connect/talk to active directory servers. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select colum in array.
Hi everyone, I´m not sure if it´s the right place to get such answer, but if someone know, please, help me. In a select id,name,picture1,picture2,picture3 from product where id=10 i get an array with each colum in each element like this $result (id = 10, name = name of product, picture1 = pic1.gif, picture2 = pic2.gif, picture3 = pic3.gif). Is there any way in select to get something like this: $result (id = 10, name = name of product, pictures = array( pic1 = pic1.gif, pic2 = pic2.gif, pic3 = pic3.gif) ). -- João Cândido de Souza Neto Curitiba Online [EMAIL PROTECTED] (41) 3324-2294 (41) 9985-6894 http://www.curitibaonline.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Variables Maxing Out Using IE6
On Wed, August 16, 2006 9:00 am, [EMAIL PROTECTED] wrote: Does IE6 limit somehow/somewhere the number of cookie variables I can create and store? Richard Lynch responded: Yes. Read the Cookie spec. There's no need for any site to ever send more than ONE Cookie anyway. Just use session_start() and you can store all the stuff in $_SESSION and it's all tied to the one Cookie. Users like me who set the browser to prompt for Cookies will often LEAVE a site that is being stupid and sending too many cookies, unless we really really really need your content, which is unlikely. So you're calling my app stupid, Richard?? lol To clarify, the app is for a small group of known users on an intranet, and yes, they really really need the content. There are 24 check boxes, and each selection triggers a graphical display of radiation levels in a specific area over the last hour. Since the active areas - 12 to 15 usually - don't change all that much over time, I thought it would make sense to have the app remember which boxes had been checked at last launch. I didn't like the idea of using cookies, so I actually have a database solution in place. But I've not dealt much with cookies, and I had some time and tried to use them to solve the problem. That's when I ran into the 20 cookie limit with IE (Having just read the spec, I'm surprised that Microsoft has actually followed it). Unless there's something basic about $_SESSION variables I've missed, I don't believe they would work here. I need to track and remember which boxes are checked between sessions, not within a single session. Someone please correct me if I'm mistaken. Thanks again to Adam Zey for suggesting I serialize the cookie data. That solved the problem. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select colum in array.
On Thu, 2006-08-17 at 11:02 -0300, João Cândido de Souza Neto wrote: Hi everyone, Im not sure if its the right place to get such answer, but if someone know, please, help me. In a select id,name,picture1,picture2,picture3 from product where id=10 i get an array with each colum in each element like this $result (id = 10, name = name of product, picture1 = pic1.gif, picture2 = pic2.gif, picture3 = pic3.gif). Is there any way in select to get something like this: $result (id = 10, name = name of product, pictures = array( pic1 = pic1.gif, pic2 = pic2.gif, pic3 = pic3.gif) ). Not via the select. But it's like 2 lines of code to stuff it into a sub array when handling the result set. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating User Friendly URLS
PHP List, My goal is to create user and search engine friendly URLs like: mysite.com/my_web_page_title Instead of: mysite.com/index.php?pageID=1 I asked about this before: http://marc.theaimsgroup.com/?l=php-generalm=113597988027012w=2 And there is this helpful tutorial: http://agachi.name/weblog/archives/2005/01/30/rewriting-dynamic-urls-into-friendly-urls.htm Both of which refer to a variable called $_SERVER['PATH_INFO']. But, in the php.net manual, in the predefined variables page, 'PATH_INFO' is only obliquely referenced in the $_SERVER variable description, under the 'PATH_TRANSLATED' element. When I've tried echoing out the contents of $_SERVER['PATH_INFO'], I get nothing. I'm trying to set it so that pages are named according to their title in my MySQL database. So my script will pull my_web_page_title out of the URL, match that against the database, and then display the appropriate contents. I thought I could do this by simply making my link into: a href=index.php/my_web_page_titleMy Web Page Title/a And then stripping out the index.php, and using the remainder for both the URL and the database lookup. But, while I'm sure there are more steps than that, I'm halted initially because I'm not sure where in the $_SERVER array my URL is being stored. Any advice on how to proceed here would be greatly appreciated. Thank you. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: select colum in array.
I found another solution myself. Thanks four your answer Robert. João Cândido de Souza Neto [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Hi everyone, I´m not sure if it´s the right place to get such answer, but if someone know, please, help me. In a select id,name,picture1,picture2,picture3 from product where id=10 i get an array with each colum in each element like this $result (id = 10, name = name of product, picture1 = pic1.gif, picture2 = pic2.gif, picture3 = pic3.gif). Is there any way in select to get something like this: $result (id = 10, name = name of product, pictures = array( pic1 = pic1.gif, pic2 = pic2.gif, pic3 = pic3.gif) ). -- João Cândido de Souza Neto Curitiba Online [EMAIL PROTECTED] (41) 3324-2294 (41) 9985-6894 http://www.curitibaonline.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating User Friendly URLS
On Thursday 17 August 2006 09:43, Dave M G wrote: PHP List, My goal is to create user and search engine friendly URLs like: mysite.com/my_web_page_title Instead of: mysite.com/index.php?pageID=1 I asked about this before: http://marc.theaimsgroup.com/?l=php-generalm=113597988027012w=2 And there is this helpful tutorial: http://agachi.name/weblog/archives/2005/01/30/rewriting-dynamic-urls-into-f riendly-urls.htm Both of which refer to a variable called $_SERVER['PATH_INFO']. But, in the php.net manual, in the predefined variables page, 'PATH_INFO' is only obliquely referenced in the $_SERVER variable description, under the 'PATH_TRANSLATED' element. When I've tried echoing out the contents of $_SERVER['PATH_INFO'], I get nothing. I'm trying to set it so that pages are named according to their title in my MySQL database. So my script will pull my_web_page_title out of the URL, match that against the database, and then display the appropriate contents. I thought I could do this by simply making my link into: a href=index.php/my_web_page_titleMy Web Page Title/a And then stripping out the index.php, and using the remainder for both the URL and the database lookup. But, while I'm sure there are more steps than that, I'm halted initially because I'm not sure where in the $_SERVER array my URL is being stored. Any advice on how to proceed here would be greatly appreciated. Thank you. -- Dave M G Richard has a good article related to this. Mostly it's about how to force a download with a correct filename, but the last part of the article should get you pointed in the right direction if you don't want to use mod_rewrite with apache. http://richardlynch.blogspot.com/ -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating User Friendly URLS
At 11:43 PM +0900 8/17/06, Dave M G wrote: PHP List, My goal is to create user and search engine friendly URLs like: mysite.com/my_web_page_title Instead of: mysite.com/index.php?pageID=1 The ? doesn't cut it for SE's. I thought I could do this by simply making my link into: a href=index.php/my_web_page_titleMy Web Page Title/a And then stripping out the index.php, and using the remainder for both the URL and the database lookup. Why not just place all your pages inside folders with the names you want and then link to the folders? For example: a href=mysite.com/my_web_page_titleMy Web Page Title/a Where my_web_page_title is the name of a folder that contain an index.php that produces the page. tedd ps: This isn't a php thing, but rather basic html -- unless I'm not understanding what you want. -- --- 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] Cookie Variables Maxing Out Using IE6
[EMAIL PROTECTED] wrote: There are 24 check boxes, and each selection triggers a graphical display of radiation levels in a specific area over the last hour. David So, if the user deletes the cookie, they grow a third eye? At last, a viable method of preventing privacy nazis from deleting my cookies! Sorry, I couldn't resist ;) Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating User Friendly URLS
1. assign a 'page' a 'friendly url' - this is probably done in your CMS 2. write a routine that will generate a 'friendly url' for a given 'page' in your cms; this allows you to stick the 'friendly urls' in a menu for instance. 3. write a routine for taking any given url and trying to match it against a 'page' in your CMS (let it return the page data and/or id if successful) 4. setup your webserver to redirect non-existent urls to a handler script that will use the routine from 3 to try and find the correct page. sticking to apache this can be done in at least 2 ways: a, use mod_rewrite - to which I can only say RTFM ;-) b, use the ErrorDocument directive, which would look something like: ErrorDocument 404 /myhandler.php 5. write a 'handler script' as mentioned in 4. if your are using ErrorDocument you will need to output a 'Status: 200' header if your handler finds a page matching the requested url. 6. do var_dump($_REQUEST, $_SERVER) in your 'handler script' to find out exactly what info you have to play with - you should be able to find everything you need. Dave M G wrote: PHP List, My goal is to create user and search engine friendly URLs like: mysite.com/my_web_page_title Instead of: mysite.com/index.php?pageID=1 I asked about this before: http://marc.theaimsgroup.com/?l=php-generalm=113597988027012w=2 And there is this helpful tutorial: http://agachi.name/weblog/archives/2005/01/30/rewriting-dynamic-urls-into-friendly-urls.htm Both of which refer to a variable called $_SERVER['PATH_INFO']. But, in the php.net manual, in the predefined variables page, 'PATH_INFO' is only obliquely referenced in the $_SERVER variable description, under the 'PATH_TRANSLATED' element. When I've tried echoing out the contents of $_SERVER['PATH_INFO'], I get nothing. I'm trying to set it so that pages are named according to their title in my MySQL database. So my script will pull my_web_page_title out of the URL, match that against the database, and then display the appropriate contents. I thought I could do this by simply making my link into: a href=index.php/my_web_page_titleMy Web Page Title/a And then stripping out the index.php, and using the remainder for both the URL and the database lookup. But, while I'm sure there are more steps than that, I'm halted initially because I'm not sure where in the $_SERVER array my URL is being stored. Any advice on how to proceed here would be greatly appreciated. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating User Friendly URLS
tedd mailto:[EMAIL PROTECTED] on Thursday, August 17, 2006 8:29 AM said: And then stripping out the index.php, and using the remainder for both the URL and the database lookup. Why not just place all your pages inside folders with the names you want and then link to the folders? Because he said database lookup and that means there are no files to be put into any folders. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] active directory and PHP
On Thursday 17 August 2006 11:35, Michael B Allen wrote: Hi Alain, PlexSSO is by far the best and easiest solution available for PHP SSO with Active Directory. We provide: o Windows Integerated Authentication (WIA) o Script level access to user info like username, home drive, etc. o Script level access control using windows group names Someone else mentioned LDAP but I don't know why because it doesn't provide authentication [1]. For authorization LDAP doesn't automatically perform proper group expansion and is redundant to start with since the Kerberos ticket has the fully expanded groups in it already. Our authorization code very easy to use. An access check looks like: ?php if (plexsso_is_memberof(FOONET\\Managers)) { echo You're a manager.; } ? None of the mod_authz_* Apache modules can do this. These checks are also very fast. Once the SIDs for the groups used in your scripts are cached they're instantaneous. Check us out. It's very affordable (free for 25 users and 25 groups), we're adding major features in our next release, and we bring serious SSO experience to the table. http://www.ioplex.com/ Mike [1] You could proxy the user's username and password to ldap_sasl_bind but aside from being a hack it's not SSO and doesn't scale because it requires communication with the DC whereas Kerberos does not. And it's insecure because you have to cache the users credentials in the user's session. -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ On Thu, 17 Aug 2006 12:14:18 +0200 Alain Roger [EMAIL PROTECTED] wrote: Hi, I'm new to PHP, so sorry if my question looks like stupid. I have a web application which use authorization and authentication process to log-in. I would like to know if it exists a way to synchronize the authentication with our Active Directory domain ? Something like a single side-on. In fact, i want from my web application users to make them remember only their login/pwd from Active directory to use my application. LDAP can authenticate with Active Directory just fine: http://www.google.com/search?hl=enq=php+exchange+ldap+authenticationbtnG=Google+Search or http://www.google.com/search?hl=enlr=q=php+active+directory+ldap+authenticationbtnG=Search The question is how secure is it. You can set up LDAP to use SSL, so that would make it more secure. Kerberos is more secure than LDAP, and you _could_ set it up so that the browser forwards the ticket on to mod_kerb for authentication, thus not needing a sign-on other than to the domain. From my experiences that isn't exactly easy to set up though. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] active directory and PHP
Hi Alain, PlexSSO is by far the best and easiest solution available for PHP SSO with Active Directory. We provide: o Windows Integerated Authentication (WIA) o Script level access to user info like username, home drive, etc. o Script level access control using windows group names Someone else mentioned LDAP but I don't know why because it doesn't provide authentication [1]. For authorization LDAP doesn't automatically perform proper group expansion and is redundant to start with since the Kerberos ticket has the fully expanded groups in it already. Our authorization code very easy to use. An access check looks like: ?php if (plexsso_is_memberof(FOONET\\Managers)) { echo You're a manager.; } ? None of the mod_authz_* Apache modules can do this. These checks are also very fast. Once the SIDs for the groups used in your scripts are cached they're instantaneous. Check us out. It's very affordable (free for 25 users and 25 groups), we're adding major features in our next release, and we bring serious SSO experience to the table. http://www.ioplex.com/ Mike [1] You could proxy the user's username and password to ldap_sasl_bind but aside from being a hack it's not SSO and doesn't scale because it requires communication with the DC whereas Kerberos does not. And it's insecure because you have to cache the users credentials in the user's session. -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ On Thu, 17 Aug 2006 12:14:18 +0200 Alain Roger [EMAIL PROTECTED] wrote: Hi, I'm new to PHP, so sorry if my question looks like stupid. I have a web application which use authorization and authentication process to log-in. I would like to know if it exists a way to synchronize the authentication with our Active Directory domain ? Something like a single side-on. In fact, i want from my web application users to make them remember only their login/pwd from Active directory to use my application. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.4.4 and 5.1.5 Released!
Hello, PHP development team would like to announce the immediate availability of PHP 5.1.5 and PHP 4.4.4. The two releases address a series of security problems discovered since PHP 5.1.4 and 4.4.3, respectively. These include the following: - Added missing safe_mode/open_basedir checks inside the error_log(), file_exists(), imap_open() and imap_reopen() functions. - Fixed overflows inside str_repeat() and wordwrap() functions on 64bit systems. - Fixed possible open_basedir/safe_mode bypass in cURL extension and on PHP 5.1.5 with realpath cache. - Fixed overflow in GD extension on invalid GIF images. - Fixed a buffer overflow inside sscanf() function. - Fixed an out of bounds read inside stripos() function. - Fixed memory_limit restriction on 64 bit system. In addition to the security fixes, both releases include a small number of non-security related bug fixes. The outlined issues can only be exploited locally, however, we still recommend that all users upgrade to either one of the new releases as soon as possible. Ilia Alshanetsky and Derick Rethans -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] active directory and PHP
On Thu, 17 Aug 2006 11:54:53 -0500 Ray Hauge [EMAIL PROTECTED] wrote: [1] You could proxy the user's username and password to ldap_sasl_bind but aside from being a hack it's not SSO and doesn't scale because it requires communication with the DC whereas Kerberos does not. And it's insecure because you have to cache the users credentials in the user's session. LDAP can authenticate with Active Directory just fine: The question is how secure is it. You can set up LDAP to use SSL, so that would make it more secure. Kerberos is more secure than LDAP, and you _could_ set it up so that the browser forwards the ticket on to mod_kerb for authentication, thus not needing a sign-on other than to the domain. From my experiences that isn't exactly easy to set up though. I didn't say it wouldn't work but people should understand there are numerous problems with using LDAP bind functions as some kind of make-shift authentication serivce. 1) It's insecure. To make it remotely fast enough you would need to store something in the user's session to prevent excessive communication with AD in which case if someone were able to get the user's PHPSESSID, a cookie, or sniff the session id they could gain access to the site (possibly with the user's credentials if those are stored in the session). And whatever you do don't use ldap_bind because those credentials are passed in clear text so a sniffer could collect passwords. At least use ldap_sasl_bind or do a TLS connection. 2) It's slow. Kerberos does not require communication between the web server and AD. With LDAP you would need to communicate with AD at least once for every new session. Otherwise, yeah it would work. Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session issues
Hi all, I am currently writing a web application that has a 3-stage form process as part of its functionality. The values passed in are placed in the session array after validation and once the user has completed and supplied all required values the relevant session values are inserted into the database. I have tested it on three different machines in FF, IE and Opera and all expected values were entered ok. However, a remote user has started testing and all values are blank, suggesting the session is not being populated. I noticed it at their office last week when data values were not showing up when the user went back one page (ie fields are pre-populated with existing session values). Anyone had this problem before? -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
[PHP] Re: Session issues
Dave Goodchild wrote: Dave Goodchild wrote: Hi all, I am currently writing a web application that has a 3-stage form process as part of its functionality. The values passed in are placed in the session array after validation and once the user has completed and supplied all required values the relevant session values are inserted into the database. I have tested it on three different machines in FF, IE and Opera and all expected values were entered ok. However, a remote user has started testing and all values are blank, suggesting the session is not being populated. I noticed it at their office last week when data values were not showing up when the user went back one page (ie fields are pre-populated with existing session values). Anyone had this problem before? Hi all, I am currently writing a web application that has a 3-stage form process as part of its functionality. The values passed in are placed in the session array after validation and once the user has completed and supplied all required values the relevant session values are inserted into the database. I have tested it on three different machines in FF, IE and Opera and all expected values were entered ok. However, a remote user has started testing and all values are blank, suggesting the session is not being populated. I noticed it at their office last week when data values were not showing up when the user went back one page (ie fields are pre-populated with existing session values). Anyone had this problem before? How does the user go back one page? If it by using the browser's back-button, the php script has no way of knowing it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session issues
How does the user go back one page? If it by using the browser's back-button, the php script has no way of knowing it. Yes, but the session variables have already been set, and are configured to display in the form fields. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
Re: [PHP] Re: Session issues
On 17/08/06, John Nichel [EMAIL PROTECTED] wrote: Dave Goodchild wrote: How does the user go back one page? If it by using the browser's back-button, the php script has no way of knowing it. Yes, but the session variables have already been set, and are configured to display in the form fields. All the session variables in the world aren't going to help when the browser loads a cached page when the back button is pressed. Granted, but that doesn't explain why the whole thing fails ie no session variables at all are entered into the database at the end.
Re: [PHP] Re: Session issues
Dave Goodchild wrote: How does the user go back one page? If it by using the browser's back-button, the php script has no way of knowing it. Yes, but the session variables have already been set, and are configured to display in the form fields. All the session variables in the world aren't going to help when the browser loads a cached page when the back button is pressed. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session issues
Dave Goodchild wrote: On 17/08/06, John Nichel [EMAIL PROTECTED] wrote: Dave Goodchild wrote: How does the user go back one page? If it by using the browser's back-button, the php script has no way of knowing it. Yes, but the session variables have already been set, and are configured to display in the form fields. All the session variables in the world aren't going to help when the browser loads a cached page when the back button is pressed. Granted, but that doesn't explain why the whole thing fails ie no session variables at all are entered into the database at the end. Explaining the problem is kind of difficult without seeing any code. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can a PHP 5 Object Be Persisted Past Script End?
Hi In order to improve performance for a socket-based PHP 5 object, I would like to persist an object beyond the end of a script. Is there any way to make this work? Will PHP 5 automatically destroy the object sometime after the script ends? Thanks in Advance, Bruce _ On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session issues
Trust me, there is far too much code to include. The problem is simple. The app contains a 3-page form cycle that reloads itself, progressing from stage 1-3 and populating the session array as values are validated and cleaned. When the process is complete, the values held in the session array are inserted into the database. In FF, IE and Opera in my test installation, I can navigate back and forth through the pages and previously entered values persist and at the end are entered. The user testing elsewhere on IE does not see these persistent values and the data entered at the end is all default or blank. I just wanted to know if anyone could spot the issue from experience, otherwise I need a rethink! On 17/08/06, John Nichel [EMAIL PROTECTED] wrote: Dave Goodchild wrote: On 17/08/06, John Nichel [EMAIL PROTECTED] wrote: Dave Goodchild wrote: How does the user go back one page? If it by using the browser's back-button, the php script has no way of knowing it. Yes, but the session variables have already been set, and are configured to display in the form fields. All the session variables in the world aren't going to help when the browser loads a cached page when the back button is pressed. Granted, but that doesn't explain why the whole thing fails ie no session variables at all are entered into the database at the end. Explaining the problem is kind of difficult without seeing any code. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
Re: [PHP] Re: Session issues
On Thu, 2006-08-17 at 19:19 +0100, Dave Goodchild wrote: Trust me, there is far too much code to include. The problem is simple. The app contains a 3-page form cycle that reloads itself, progressing from stage 1-3 and populating the session array as values are validated and cleaned. When the process is complete, the values held in the session array are inserted into the database. In FF, IE and Opera in my test installation, I can navigate back and forth through the pages and previously entered values persist and at the end are entered. The user testing elsewhere on IE does not see these persistent values and the data entered at the end is all default or blank. I just wanted to know if anyone could spot the issue from experience, otherwise I need a rethink! Usually a browser cache issue. If they set the cache to 0 then I do believe it gets wiped. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I need an array of state abbrev to names...
B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); ÐÆ5ÏÐ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I need an array of state abbrev to names...
B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); I have one somewhere, but I'm too lazy to go find it for you. ;) Sorry. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I need an array of state abbrev to names...
Assuming you are talking about states in the US (it's a big world out there), you might try. http://www.usps.com/ncsc/lookups/usps_abbreviations.html Good luck, Warren Vail Vail Systems Technology http://www.vailtech.net [EMAIL PROTECTED] -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 12:58 PM To: php-general@lists.php.net Subject: [PHP] I need an array of state abbrev to names... B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); ÐÆ5ÏÐ -- 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] I need an array of state abbrev to names...
Daevid Vincent mailto:[EMAIL PROTECTED] on Thursday, August 17, 2006 12:58 PM said: B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); HERE LAZY! $GLOBALS['usps_states_list'] = array( 0 = array('name'='Alaska','code'='AK','contiguous'=true), 1 = array('name'='Alabama','code'='AL','contiguous'=true), 2 = array('name'='American Samoa','code'='AS','contiguous'=false), 3 = array('name'='Arizona','code'='AZ','contiguous'=true), 4 = array('name'='Arkansas','code'='AR','contiguous'=true), 5 = array('name'='California','code'='CA','contiguous'=true), 6 = array('name'='Colorado','code'='CO','contiguous'=true), 7 = array('name'='Connecticut','code'='CT','contiguous'=true), 8 = array('name'='Delaware','code'='DE','contiguous'=true), 9 = array('name'='District of Columbia','code'='DC','contiguous'=true), 10 = array('name'='Federated States of Micronesia','code'='FM','contiguous'=false), 11 = array('name'='Florida','code'='FL','contiguous'=true), 12 = array('name'='Georgia','code'='GA','contiguous'=true), 13 = array('name'='Guam','code'='GU','contiguous'=false), 14 = array('name'='Hawaii','code'='HI','contiguous'=false), 15 = array('name'='Idaho','code'='ID','contiguous'=true), 16 = array('name'='Illinois','code'='IL','contiguous'=true), 17 = array('name'='Indiana','code'='IN','contiguous'=true), 18 = array('name'='Iowa','code'='IA','contiguous'=true), 19 = array('name'='Kansas','code'='KS','contiguous'=true), 10 = array('name'='Kentucky','code'='KY','contiguous'=true), 21 = array('name'='Louisiana','code'='LA','contiguous'=true), 22 = array('name'='Maine','code'='ME','contiguous'=true), 23 = array('name'='Marshall Islands','code'='MH','contiguous'=false), 24 = array('name'='Maryland','code'='MD','contiguous'=true), 25 = array('name'='Massachusetts','code'='MA','contiguous'=true), 26 = array('name'='Michigan','code'='MI','contiguous'=true), 27 = array('name'='Minnesota','code'='MN','contiguous'=true), 28 = array('name'='Mississippi','code'='MS','contiguous'=true), 29 = array('name'='Missouri','code'='MO','contiguous'=true), 30 = array('name'='Montana','code'='MT','contiguous'=true), 31 = array('name'='Nebraska','code'='NE','contiguous'=true), 32 = array('name'='Nevada','code'='NV','contiguous'=true), 33 = array('name'='New Hampshire','code'='NH','contiguous'=true), 34 = array('name'='New Jersey','code'='NJ','contiguous'=true), 35 = array('name'='New Mexico','code'='NM','contiguous'=true), 36 = array('name'='New York','code'='NY','contiguous'=true), 37 = array('name'='North Carolina','code'='NC','contiguous'=true), 38 = array('name'='North Dakota','code'='ND','contiguous'=true), 39 = array('name'='Northern Mariana Islands','code'='MP','contiguous'=false), 40 = array('name'='Ohio','code'='OH','contiguous'=true), 41 = array('name'='Oklahoma','code'='OK','contiguous'=true), 42 = array('name'='Oregon','code'='OR','contiguous'=true), 43 = array('name'='Palau','code'='PW','contiguous'=false), 44 = array('name'='Pennsylvania','code'='PA','contiguous'=true), 45 = array('name'='Puerto Rico','code'='PR','contiguous'=false), 46 = array('name'='Rhode Island','code'='RI','contiguous'=true), 47 = array('name'='South Carolina','code'='SC','contiguous'=true), 48 = array('name'='South Dakota','code'='SD','contiguous'=true), 49 = array('name'='Tennessee','code'='TN','contiguous'=true), 50 = array('name'='Texas','code'='TX','contiguous'=true), 51 = array('name'='Utah','code'='UT','contiguous'=true), 52 = array('name'='Vermont','code'='VT','contiguous'=true), 53 = array('name'='Virgin Islands','code'='VI','contiguous'=false), 54 = array('name'='Virginia','code'='VA','contiguous'=true), 55 = array('name'='Washington','code'='WA','contiguous'=true), 56 = array('name'='West Virginia','code'='WV','contiguous'=true), 57 = array('name'='Wisconsin','code'='WI','contiguous'=true), 58 = array('name'='Wyoming','code'='WY','contiguous'=true), 59 = array('name'='Armed Forces Africa','code'='AE','contiguous'=false), 60 = array('name'='Armed Forces Americas (except Canada)','code'='AA','contiguous'=false), 61 = array('name'='Armed Forces Canada','code'='AE','contiguous'=false), 62 = array('name'='Armed Forces Europe','code'='AE','contiguous'=false), 63 = array('name'='Armed Forces Middle East','code'='AE','contiguous'=false), 64 = array('name'='Armed Forces Pacific','code'='AP','contiguous'=false)); Please send me a check $250. Thanks! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can a PHP 5 Object Be Persisted Past Script End?
Bruce Bailey wrote: Hi In order to improve performance for a socket-based PHP 5 object, I would like to persist an object beyond the end of a script. Is there any way to make this work? Will PHP 5 automatically destroy the object sometime after the script ends? Thanks in Advance, Bruce _ On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement Yes (it will destroy them), but you can look into persistent sockets, and serializing objects. Info is in the manual. Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I need an array of state abbrev to names...
On Thu, 2006-08-17 at 13:26 -0700, Chris W. Parker wrote: Daevid Vincent mailto:[EMAIL PROTECTED] on Thursday, August 17, 2006 12:58 PM said: B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); HERE LAZY! $GLOBALS['usps_states_list'] = array( 0 = array('name'='Alaska','code'='AK','contiguous'=true), 1 = array('name'='Alabama','code'='AL','contiguous'=true), 2 = array('name'='American Samoa','code'='AS','contiguous'=false), 3 = array('name'='Arizona','code'='AZ','contiguous'=true), 4 = array('name'='Arkansas','code'='AR','contiguous'=true), 5 = array('name'='California','code'='CA','contiguous'=true), 6 = array('name'='Colorado','code'='CO','contiguous'=true), 7 = array('name'='Connecticut','code'='CT','contiguous'=true), 8 = array('name'='Delaware','code'='DE','contiguous'=true), 9 = array('name'='District of Columbia','code'='DC','contiguous'=true), 10 = array('name'='Federated States of Micronesia','code'='FM','contiguous'=false), 11 = array('name'='Florida','code'='FL','contiguous'=true), 12 = array('name'='Georgia','code'='GA','contiguous'=true), 13 = array('name'='Guam','code'='GU','contiguous'=false), 14 = array('name'='Hawaii','code'='HI','contiguous'=false), 15 = array('name'='Idaho','code'='ID','contiguous'=true), 16 = array('name'='Illinois','code'='IL','contiguous'=true), 17 = array('name'='Indiana','code'='IN','contiguous'=true), 18 = array('name'='Iowa','code'='IA','contiguous'=true), 19 = array('name'='Kansas','code'='KS','contiguous'=true), 10 = array('name'='Kentucky','code'='KY','contiguous'=true), 21 = array('name'='Louisiana','code'='LA','contiguous'=true), 22 = array('name'='Maine','code'='ME','contiguous'=true), 23 = array('name'='Marshall Islands','code'='MH','contiguous'=false), 24 = array('name'='Maryland','code'='MD','contiguous'=true), 25 = array('name'='Massachusetts','code'='MA','contiguous'=true), 26 = array('name'='Michigan','code'='MI','contiguous'=true), 27 = array('name'='Minnesota','code'='MN','contiguous'=true), 28 = array('name'='Mississippi','code'='MS','contiguous'=true), 29 = array('name'='Missouri','code'='MO','contiguous'=true), 30 = array('name'='Montana','code'='MT','contiguous'=true), 31 = array('name'='Nebraska','code'='NE','contiguous'=true), 32 = array('name'='Nevada','code'='NV','contiguous'=true), 33 = array('name'='New Hampshire','code'='NH','contiguous'=true), 34 = array('name'='New Jersey','code'='NJ','contiguous'=true), 35 = array('name'='New Mexico','code'='NM','contiguous'=true), 36 = array('name'='New York','code'='NY','contiguous'=true), 37 = array('name'='North Carolina','code'='NC','contiguous'=true), 38 = array('name'='North Dakota','code'='ND','contiguous'=true), 39 = array('name'='Northern Mariana Islands','code'='MP','contiguous'=false), 40 = array('name'='Ohio','code'='OH','contiguous'=true), 41 = array('name'='Oklahoma','code'='OK','contiguous'=true), 42 = array('name'='Oregon','code'='OR','contiguous'=true), 43 = array('name'='Palau','code'='PW','contiguous'=false), 44 = array('name'='Pennsylvania','code'='PA','contiguous'=true), 45 = array('name'='Puerto Rico','code'='PR','contiguous'=false), 46 = array('name'='Rhode Island','code'='RI','contiguous'=true), 47 = array('name'='South Carolina','code'='SC','contiguous'=true), 48 = array('name'='South Dakota','code'='SD','contiguous'=true), 49 = array('name'='Tennessee','code'='TN','contiguous'=true), 50 = array('name'='Texas','code'='TX','contiguous'=true), 51 = array('name'='Utah','code'='UT','contiguous'=true), 52 = array('name'='Vermont','code'='VT','contiguous'=true), 53 = array('name'='Virgin Islands','code'='VI','contiguous'=false), 54 = array('name'='Virginia','code'='VA','contiguous'=true), 55 = array('name'='Washington','code'='WA','contiguous'=true), 56 = array('name'='West Virginia','code'='WV','contiguous'=true), 57 = array('name'='Wisconsin','code'='WI','contiguous'=true), 58 = array('name'='Wyoming','code'='WY','contiguous'=true), 59 = array('name'='Armed Forces Africa','code'='AE','contiguous'=false), 60 = array('name'='Armed Forces Americas (except Canada)','code'='AA','contiguous'=false), 61 = array('name'='Armed Forces Canada','code'='AE','contiguous'=false), 62 = array('name'='Armed Forces Europe','code'='AE','contiguous'=false), 63 = array('name'='Armed Forces Middle East','code'='AE','contiguous'=false), 64 = array('name'='Armed Forces Pacific','code'='AP','contiguous'=false)); Please send me a check $250. Thanks! You forgot to sneak in Santa's Little Village with code SLV. And maybe Easter Bunny's Lair EBL. I'm sure the list can come up with the rest of the forgotten entries. Cheers, Rob. -- .. | InterJinn Application Framework -
[PHP] xmlrpc_decode vs. xmlrpc_decode_request
Hi, I have a question that's been bugging me for a while. What's the difference between xmlrpc_decode and xmlrpc_decode_request? _request takes an extra parameter, $method, but I can't figure out what kind of effect it has. I can pass a totally bogus parameter to it. What's the difference between these two functions, and what does the $method parameter do? TIA, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need an array of state abbrev to names...
At 12:58 PM -0700 8/17/06, Daevid Vincent wrote: B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); Daevid: Everything you want should be found here. http://xn--ovg.com/a_states If you have any problems with it, please let me know. Thanks for the exercise. hth's 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: Can a PHP 5 Object Be Persisted Past Script End?
Adam Thanks for the information, I'll explore that option. Bruce From: Adam Zey [EMAIL PROTECTED] To: Bruce Bailey [EMAIL PROTECTED] CC: php-general@lists.php.net Subject: [PHP] Re: Can a PHP 5 Object Be Persisted Past Script End? Date: Thu, 17 Aug 2006 17:05:41 -0400 Bruce Bailey wrote: Hi In order to improve performance for a socket-based PHP 5 object, I would like to persist an object beyond the end of a script. Is there any way to make this work? Will PHP 5 automatically destroy the object sometime after the script ends? Thanks in Advance, Bruce _ On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement Yes (it will destroy them), but you can look into persistent sockets, and serializing objects. Info is in the manual. Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I need an array of state abbrev to names...
At 5:27 PM -0400 8/17/06, Robert Cummings wrote: 63 = array('name'='Armed Forces Middle East','code'='AE','contiguous'=false), 64 = array('name'='Armed Forces Pacific','code'='AP','contiguous'=false)); Please send me a check $250. Thanks! You forgot to sneak in Santa's Little Village with code SLV. And maybe Easter Bunny's Lair EBL. I'm sure the list can come up with the rest of the forgotten entries. Cheers, Rob. Yeah, but contiguous == NULL tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for caveats to the following code
Hello, While experimenting with some object stuff I stumbled upon something new (although not object related). Normally I would do this: ?php function do_something($input) { if($input == 'hello') { return $input; } else { return false; } } $result = do_something('hello'); if($result !== false) { // do something with $result } else { // do some other stuff } ? Using the same function above I discovered I can do this: ?php if($result = do_something('hello')) { // do something with $result } else { // do some other stuff } ? The issue is whether or not this is a safe test. My initial thought is that it is safe since I'm simply checking for true/false-ness. I either check for '!== false' explicitly or (in the case of the latter example) check that something other than 'false' is returned. It's slightly less readable but it seems more efficient (if nothing more than to save on the number of lines typed). Thoughts? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Looking for caveats to the following code
Chris W. Parker wrote: Hello, While experimenting with some object stuff I stumbled upon something new (although not object related). Normally I would do this: ?php function do_something($input) { if($input == 'hello') { return $input; } else { return false; } } $result = do_something('hello'); if($result !== false) { // do something with $result } else { // do some other stuff } ? Using the same function above I discovered I can do this: ?php if($result = do_something('hello')) { // do something with $result } else { // do some other stuff } ? The issue is whether or not this is a safe test. My initial thought is that it is safe since I'm simply checking for true/false-ness. I either check for '!== false' explicitly or (in the case of the latter example) check that something other than 'false' is returned. It's slightly less readable but it seems more efficient (if nothing more than to save on the number of lines typed). Thoughts? Chris. Better to do this: if ( ($result = do_something('hello')) !== false ) { // do something with $result } else { // do some other stuff } The result of an assignment like $result = do_something('hello') is itself the result you assigned, so you can still compare on that. The reason I put it in more brackets was just for readability. I don't think you actually need the extra set, but I'm not sure. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for caveats to the following code
At 3:19 PM -0700 8/17/06, Chris W. Parker wrote: ?php if($result = do_something('hello')) { // do something with $result } else { // do some other stuff } ? The issue is whether or not this is a safe test. My initial thought is that it is safe since I'm simply checking for true/false-ness. I either check for '!== false' explicitly or (in the case of the latter example) check that something other than 'false' is returned. It's slightly less readable but it seems more efficient (if nothing more than to save on the number of lines typed). Thoughts? Chris: You can shorten it even further by: if(do_something('hello')) { // do something with $result } else { // do some other stuff } I don't think it's any different than calling any other function that returns whatever or false. I tried it out at -- http://xn--ovg.com/a14.php -- with both pass and fail. All worked the same in all three ways. hth's 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] Looking for caveats to the following code
On Thu, 2006-08-17 at 18:58 -0400, tedd wrote: At 3:19 PM -0700 8/17/06, Chris W. Parker wrote: ?php if($result = do_something('hello')) { // do something with $result } else { // do some other stuff } ? The issue is whether or not this is a safe test. My initial thought is that it is safe since I'm simply checking for true/false-ness. I either check for '!== false' explicitly or (in the case of the latter example) check that something other than 'false' is returned. It's slightly less readable but it seems more efficient (if nothing more than to save on the number of lines typed). Thoughts? Chris: You can shorten it even further by: if(do_something('hello')) { // do something with $result I'm guessing you missed the content of the comment Tedd... he actually needs the $result :D Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for caveats to the following code
Tedd, Actually, he seems to be needing the return value of the function inside the if block. So, he would need to do: if ($result = do_something('hello')) or, as Adam stated: if ( ($result = do_something('hello')) !== false ) Regards. -- Anas Mughal On 8/17/06, tedd [EMAIL PROTECTED] wrote: At 3:19 PM -0700 8/17/06, Chris W. Parker wrote: ?php if($result = do_something('hello')) { // do something with $result } else { // do some other stuff } ? The issue is whether or not this is a safe test. My initial thought is that it is safe since I'm simply checking for true/false-ness. I either check for '!== false' explicitly or (in the case of the latter example) check that something other than 'false' is returned. It's slightly less readable but it seems more efficient (if nothing more than to save on the number of lines typed). Thoughts? Chris: You can shorten it even further by: if(do_something('hello')) { // do something with $result } else { // do some other stuff } I don't think it's any different than calling any other function that returns whatever or false. I tried it out at -- http://xn--ovg.com/a14.php -- with both pass and fail. All worked the same in all three ways. hth's 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 -- Anas Mughal
RE: [PHP] Looking for caveats to the following code
At 4:16 PM -0700 8/17/06, Chris W. Parker wrote: tedd mailto:[EMAIL PROTECTED] on Thursday, August 17, 2006 3:58 PM said: You can shorten it even further by: if(do_something('hello')) { // do something with $result } else { // do some other stuff } This actually won't work because $result is not being assigned anywhere. Ahhh yes , I didn't catch that. Sorry to all. http://xn--ovg.com/a14.php Your page should show the source, otherwise it's impossible to tell what's happening. I didn't think that necessary considering that I posted what I was doing. But, I posted it again in my example -- please review: http://xn--ovg.com/a14.php I see now why I got the same result as you -- $result was never cleared. Yeah, I guess as long as I'm just testing for true or false it'll be ok. The example isn't checking for true/false but rather not-null/false 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] I need an array of state abbrev to names...
-Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 2:54 PM To: Daevid Vincent; php-general@lists.php.net Subject: Re: [PHP] I need an array of state abbrev to names... At 12:58 PM -0700 8/17/06, Daevid Vincent wrote: B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); Daevid: Everything you want should be found here. http://xn--ovg.com/a_states If you have any problems with it, please let me know. Thanks for the exercise. hth's tedd Excellent Thanks! I'd add this to it: echo(pre); foreach ($abrev as $abbreviation = $statename) { echo '.$abbreviation.' = '.ucwords(strtolower($statename)).',\n; } echo(/pre); Oh, and also that you have to be careful and use the 'save as' feature on windows machines so as not to get funky \r\n instead of \n and then the parser won't work. :) DÆVID -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I need an array of state abbrev to names... [solved]
-Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Thursday, August 17, 2006 1:26 PM To: Daevid Vincent; php-general@lists.php.net Subject: RE: [PHP] I need an array of state abbrev to names... Daevid Vincent mailto:[EMAIL PROTECTED] on Thursday, August 17, 2006 12:58 PM said: B/c I'm too busy (and lazy) to hand type it all in, wondering if someone has an array of state abbreviations to names like so... $states = array( ... 'NY' = 'New York', 'WA' = 'Washington', ... ); HERE LAZY! $GLOBALS['usps_states_list'] = array( 0 = array('name'='Alaska','code'='AK','contiguous'=true), ... Please send me a check $250. Thanks! Chris. Thanks, for the help, here is the list formatted as I needed it for anyone else that may need this in the future. $states = array( 'AL' = 'Alabama', 'AK' = 'Alaska', 'AS' = 'American Samoa', 'AZ' = 'Arizona', 'AR' = 'Arkansas', 'CA' = 'California', 'CO' = 'Colorado', 'CT' = 'Connecticut', 'DE' = 'Delaware', 'DC' = 'District Of Columbia', 'FM' = 'Federated States Of Micronesia', 'FL' = 'Florida', 'GA' = 'Georgia', 'GU' = 'Guam', 'HI' = 'Hawaii', 'ID' = 'Idaho', 'IL' = 'Illinois', 'IN' = 'Indiana', 'IA' = 'Iowa', 'KS' = 'Kansas', 'KY' = 'Kentucky', 'LA' = 'Louisiana', 'ME' = 'Maine', 'MH' = 'Marshall Islands', 'MD' = 'Maryland', 'MA' = 'Massachusetts', 'MI' = 'Michigan', 'MN' = 'Minnesota', 'MS' = 'Mississippi', 'MO' = 'Missouri', 'MT' = 'Montana', 'NE' = 'Nebraska', 'NV' = 'Nevada', 'NH' = 'New Hampshire', 'NJ' = 'New Jersey', 'NM' = 'New Mexico', 'NY' = 'New York', 'NC' = 'North Carolina', 'ND' = 'North Dakota', 'MP' = 'Northern Mariana Islands', 'OH' = 'Ohio', 'OK' = 'Oklahoma', 'OR' = 'Oregon', 'PW' = 'Palau', 'PA' = 'Pennsylvania', 'PR' = 'Puerto Rico', 'RI' = 'Rhode Island', 'SC' = 'South Carolina', 'SD' = 'South Dakota', 'TN' = 'Tennessee', 'TX' = 'Texas', 'UT' = 'Utah', 'VT' = 'Vermont', 'VI' = 'Virgin Islands', 'VA' = 'Virginia', 'WA' = 'Washington', 'WV' = 'West Virginia', 'WI' = 'Wisconsin', 'WY' = 'Wyoming' ); DÆVID -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php