php-general Digest 14 Aug 2011 13:23:25 -0000 Issue 7443
php-general Digest 14 Aug 2011 13:23:25 - Issue 7443 Topics (messages 314517 through 314520): New version : EasyPHP 5.3.7 RC5 with PHP 5.3.7 RC5 314517 by: EasyPHP trying this again 314518 by: Tamara Temple 314519 by: Michelle Konzack Re: Login with Remember me Feature 314520 by: Alekto Antarctica 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--- Hi PHP 5.3.7 RC5 is now included in the Wamp package EasyPHP 5.3.7 RC5. Enjoy! Website : www.easyphp.org Screenshots : www.easyphp.org/screenshots.php Facebook page : www.facebook.com/easywamp Twitter : www.twitter.com/easyphp ---End Message--- ---BeginMessage--- I didn't know the server would reject this, but I'd really like to know if anyone else has encountered this Begin forwarded message: From: Mail Delivery Subsystem mailer-dae...@googlemail.com Date: August 13, 2011 7:23:02 PM CDT To: tamouse.li...@gmail.com Subject: Delivery Status Notification (Failure) Delivery to the following recipient failed permanently: php-gene...@lists.php.net Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 Apparent off-topic email rejected. (state 18). - Original message - Received: by 10.236.175.40 with SMTP id y28mr7959372yhl. 93.1313281379046; Sat, 13 Aug 2011 17:22:59 -0700 (PDT) Return-Path: tamouse.li...@gmail.com Received: from [192.168.1.136] (c-71-63-211-0.hsd1.mn.comcast.net [71.63.211.0]) by mx.google.com with ESMTPS id c63sm4184829yhe. 4.2011.08.13.17.22.57 (version=SSLv3 cipher=OTHER); Sat, 13 Aug 2011 17:22:57 -0700 (PDT) Subject: OT: failures installing Zend PDT in Eclipse From: Tamara Temple tamouse.li...@gmail.com To: php-gene...@lists.php.net Content-Type: text/plain; charset=UTF-8 Date: Sat, 13 Aug 2011 19:22:47 -0500 Message-ID: 1313281367.9066.3.camel@caesar Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit While not really a PHP issue, per se, I thought someone here might have some light to shed on this. I have a new install of Ubuntu 11.04 and fresh Eclipse 3.5 (Gallileo) installation from Ubuntu Software Center. I'm trying to install the Zend PDT package in Eclipse using the info they give on their web site as best I can (it's for a previous version of Eclipse, unfortunately). When I run the install, I get the following errors: !ENTRY org.eclipse.equinox.p2.engine 4 4 2011-08-13 11:35:35.484 !MESSAGE An error occurred while collecting items to be installed !SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2011-08-13 11:35:35.485 !MESSAGE session context was:(profile=PlatformProfile, phase =org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=, action=). !SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2011-08-13 11:35:35.485 !MESSAGE No repository found containing: osgi.bundle,org.zend.php.debug.debugger,5.3.18.v20110322 !SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2011-08-13 11:35:35.485 !MESSAGE No repository found containing: osgi.bundle,org.zend.php.debug.debugger.linux.x86,5.3.18.v20110322 !SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2011-08-13 11:35:35.485 !MESSAGE No repository found containing: org.eclipse.update.feature,org.zend.php.debug_feature,5.3.18.v20110322 Anyone have any clues about what I should be doing to get PDT installed in this version of Eclipse? ---End Message--- ---BeginMessage--- Hello Tamara, I had this too and from an Admin (ome years ago) I know if there is an [OT] or OT: in the subject, the list reject the mail. Thanks, Greetings and nice Day/Evening Michelle Konzack -- # Debian GNU/Linux Consultant ## Development of Intranet and Embedded Systems with Debian GNU/Linux itsystems@tdnet Franceitsystems@tdnet Owner Michelle KonzackOwner Michelle Konzack Apt. 917 (homeoffice) Gewerbe Straße 3 50, rue de Soultz 77694 Kehl/Germany 67100 Strasbourg/France Tel: +49-177-9351947 mobil Tel: +33-6-61925193 mobil Tel: +49-176-86004575 office http://www.itsystems.tamay-dogan.net/ http://www.flexray4linux.org/ http://www.debian.tamay-dogan.net/ http://www.can4linux.org/ Jabber linux4miche...@jabber.ccc.de ICQ#328449886 Linux-User #280138 with the Linux Counter, http://counter.li.org/ signature.pgp Description: Digital signature ---End Message---
[PHP] New version : EasyPHP 5.3.7 RC5 with PHP 5.3.7 RC5
Hi PHP 5.3.7 RC5 is now included in the Wamp package EasyPHP 5.3.7 RC5. Enjoy! Website : www.easyphp.org Screenshots : www.easyphp.org/screenshots.php Facebook page : www.facebook.com/easywamp Twitter : www.twitter.com/easyphp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trying this again....
I didn't know the server would reject this, but I'd really like to know if anyone else has encountered this Begin forwarded message: From: Mail Delivery Subsystem mailer-dae...@googlemail.com Date: August 13, 2011 7:23:02 PM CDT To: tamouse.li...@gmail.com Subject: Delivery Status Notification (Failure) Delivery to the following recipient failed permanently: php-general@lists.php.net Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 Apparent off-topic email rejected. (state 18). - Original message - Received: by 10.236.175.40 with SMTP id y28mr7959372yhl. 93.1313281379046; Sat, 13 Aug 2011 17:22:59 -0700 (PDT) Return-Path: tamouse.li...@gmail.com Received: from [192.168.1.136] (c-71-63-211-0.hsd1.mn.comcast.net [71.63.211.0]) by mx.google.com with ESMTPS id c63sm4184829yhe. 4.2011.08.13.17.22.57 (version=SSLv3 cipher=OTHER); Sat, 13 Aug 2011 17:22:57 -0700 (PDT) Subject: OT: failures installing Zend PDT in Eclipse From: Tamara Temple tamouse.li...@gmail.com To: php-general@lists.php.net Content-Type: text/plain; charset=UTF-8 Date: Sat, 13 Aug 2011 19:22:47 -0500 Message-ID: 1313281367.9066.3.camel@caesar Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit While not really a PHP issue, per se, I thought someone here might have some light to shed on this. I have a new install of Ubuntu 11.04 and fresh Eclipse 3.5 (Gallileo) installation from Ubuntu Software Center. I'm trying to install the Zend PDT package in Eclipse using the info they give on their web site as best I can (it's for a previous version of Eclipse, unfortunately). When I run the install, I get the following errors: !ENTRY org.eclipse.equinox.p2.engine 4 4 2011-08-13 11:35:35.484 !MESSAGE An error occurred while collecting items to be installed !SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2011-08-13 11:35:35.485 !MESSAGE session context was:(profile=PlatformProfile, phase =org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=, action=). !SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2011-08-13 11:35:35.485 !MESSAGE No repository found containing: osgi.bundle,org.zend.php.debug.debugger,5.3.18.v20110322 !SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2011-08-13 11:35:35.485 !MESSAGE No repository found containing: osgi.bundle,org.zend.php.debug.debugger.linux.x86,5.3.18.v20110322 !SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2011-08-13 11:35:35.485 !MESSAGE No repository found containing: org.eclipse.update.feature,org.zend.php.debug_feature,5.3.18.v20110322 Anyone have any clues about what I should be doing to get PDT installed in this version of Eclipse? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: trying this again....
Hello Tamara, I had this too and from an Admin (ome years ago) I know if there is an [OT] or OT: in the subject, the list reject the mail. Thanks, Greetings and nice Day/Evening Michelle Konzack -- # Debian GNU/Linux Consultant ## Development of Intranet and Embedded Systems with Debian GNU/Linux itsystems@tdnet Franceitsystems@tdnet Owner Michelle KonzackOwner Michelle Konzack Apt. 917 (homeoffice) Gewerbe Straße 3 50, rue de Soultz 77694 Kehl/Germany 67100 Strasbourg/France Tel: +49-177-9351947 mobil Tel: +33-6-61925193 mobil Tel: +49-176-86004575 office http://www.itsystems.tamay-dogan.net/ http://www.flexray4linux.org/ http://www.debian.tamay-dogan.net/ http://www.can4linux.org/ Jabber linux4miche...@jabber.ccc.de ICQ#328449886 Linux-User #280138 with the Linux Counter, http://counter.li.org/ signature.pgp Description: Digital signature
Re: [PHP] Login with Remember me Feature
Hi guys! I have now tried to take some of your hints into consideration, by encrypting the password with md5 adding a salt. As some of you pointed out, this code is the work of a newbie, that is totally correct, so please bear with me ;) I have tried to implement a cookie to remember the login for 48 hours, but it still logs the user out after the default 24min for a session like this: * //We compare the submited password and the real one, and we check if the user exists* *if($dn['password']==$password and mysql_num_rows($req)0)* *{* ** *//If the password is ok, we set the $loginok var to true* *$loginok = true;* *//If the password is good, we dont show the form* *$form = false;* ** *}* * if ($loginok = true)* * {* * if ($remember==on) * *setcookie(username, $username, time()+7200*24);* * elseif ($remember==) * * //We save the user name in the session username and the user Id in the session userid* * $_SESSION('username')=$username; * * $_SESSION['userid'] = $dn['id'];* * $_SESSION['usr_level'] = $dn['usr_level'];* * * *.* *.* *.* *.* *.* *.* *}* Another problem I am now facing, is to check whether to user is logged in, and if it is the user should be redirected from the index-page(with the login-form) to its user area based on the user level(newbie, advanced or admin). For now I have written a function, in the config.php. *function loggedin()* *{* * if (isset($_SESSIONS['username']) || isset($_COOKIE['username']))* * {* * $loggedin = true;* * return $loggedin;* * }* *}* I have both tried to include the config.php into the index-page(login-form) and into the connexions.php script (where cookie is implemented). Along with this code: *?php* * * *if (loggedin==true)* *{* * if($usr_level == admin)* *{* * ?* *div class=messageYou have successfuly been logged in. You can now access the admin area.br /* *?php header(Location: index_admin.php); ?/div* *?php* *}* * if($usr_level == newbie)* *{* *?* *div class=messageYou have successfuly been logged in. You can now access to the newbie area.br /* *?php header(Location: index_newbe.php); ?/div* *?php* *}* * if($usr_level == advanced)* *{* *?* *div class=messageYou have successfuly been logged in. You can now access the advanced area.br /* *?php header(Location: index_advanced.php); ?/div* *?php* *}* * * *}* * * *? * * * This does not redirect an alredy logged in user to its user area... I know this is messy, but if some of you can spot some improvements that hopfully can fix my cookie and redirect problem, please let me know. Tanks a lot!
Re: [PHP] chained select with ajax
I was able to figure it out. Discovered the very useful tool firebug! Thanks, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login with Remember me Feature
On Aug 14, 2011, at 8:23 AM, Alekto Antarctica wrote: Hi guys! I have now tried to take some of your hints into consideration, by encrypting the password with md5 adding a salt. As some of you pointed out, this code is the work of a newbie, that is totally correct, so please bear with me ;) I have tried to implement a cookie to remember the login for 48 hours, but it still logs the user out after the default 24min for a session like this: * //We compare the submited password and the real one, and we check if the user exists* *if($dn['password']==$password and mysql_num_rows($req)0)* *{* ** *//If the password is ok, we set the $loginok var to true* *$loginok = true;* *//If the password is good, we dont show the form* *$form = false;* ** *}* * if ($loginok = true)* * {* * if ($remember==on) * *setcookie(username, $username, time()+7200*24);* * elseif ($remember==) * * //We save the user name in the session username and the user Id in the session userid* * $_SESSION('username')= $username; * * $_SESSION['userid'] = $dn['id'];* * $_SESSION['usr_level'] = $dn['usr_level'];* * * *.* *.* *.* *.* *.* *.* *}* Another problem I am now facing, is to check whether to user is logged in, and if it is the user should be redirected from the index-page(with the login-form) to its user area based on the user level(newbie, advanced or admin). For now I have written a function, in the config.php. *function loggedin()* *{* * if (isset($_SESSIONS['username']) || isset($_COOKIE['username']))* * {* * $loggedin = true;* * return $loggedin;* * }* *}* I have both tried to include the config.php into the index- page(login-form) and into the connexions.php script (where cookie is implemented). Along with this code: *?php* * * *if (loggedin==true)* *{* * if($usr_level == admin)* *{* * ?* *div class=messageYou have successfuly been logged in. You can now access the admin area.br /* *?php header(Location: index_admin.php); ?/div* *?php* *}* * if($usr_level == newbie)* *{* *?* *div class=messageYou have successfuly been logged in. You can now access to the newbie area.br /* *?php header(Location: index_newbe.php); ?/div* *?php* *}* * if($usr_level == advanced)* *{* *?* *div class=messageYou have successfuly been logged in. You can now access the advanced area.br /* *?php header(Location: index_advanced.php); ?/div* *?php* *}* * * *}* * * *? * * * This does not redirect an alredy logged in user to its user area... I know this is messy, but if some of you can spot some improvements that hopfully can fix my cookie and redirect problem, please let me know. Tanks a lot! You can't issue headers after you've sent output to the client. headers must be sent before any other output. If you have messages to be output based on the current script, you have to pass them to the redirected script for them to be output to the client. You can do this by passing them on the query string or in a session variable; there are likely other ways of doing this as well. Note that you don't have to pass the actual text of the message if you use message codes instead, which would also aid in being able to translate the output if so desired. In the code above, since the message seems tied to the particular area the user has access to and that is tied to a particular script, you could just put the message with each particular script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Login with Remember me Feature
On 14 Aug 2011 at 14:23, Alekto Antarctica alekto.antarct...@gmail.com wrote: *function loggedin()* *{* * if (isset($_SESSIONS['username']) || isset($_COOKIE['username']))* * {* * $loggedin = true;* * return $loggedin;* * }* *}* Why not justreturn true; And what happens if your if doesn't evaluate to true? What do you return then? *?php* * * *if (loggedin==true)* *{* Should this be: if ($loggedin==true) ... -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Login with Remember me Feature
Tim Streater t...@clothears.org.uk writes: On 14 Aug 2011 at 14:23, Alekto Antarctica alekto.antarct...@gmail.com wrote: *function loggedin()* *{* * if (isset($_SESSIONS['username']) || isset($_COOKIE['username']))* * {* * $loggedin = true;* * return $loggedin;* * }* *}* Why not justreturn true; And what happens if your if doesn't evaluate to true? What do you return then? *?php* * * *if (loggedin==true)* *{* Should this be: if ($loggedin==true) ... -- Cheers -- Tim Are you aware that your posts have some very strange and unique line endings? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login with Remember me Feature
On Sun, 14 Aug 2011, Alekto Antarctica wrote: I have tried to implement a cookie to remember the login for 48 hours, but it still logs the user out after the default 24min for a session like this: * //We compare the submited password and the real one, and we check if the user exists* *if($dn['password']==$password and mysql_num_rows($req)0)* You don't show us anything before this, so we have to assume it's all good up to here. *{* ** *//If the password is ok, we set the $loginok var to true* *$loginok = true;* *//If the password is good, we dont show the form* *$form = false;* ** *}* Maybe I'm just like this, but I always comment my closing braces. I've been in situations where I'm missing one or I need to review code I wrote months ago and understand its logic, and I find this practice useful. Yes, in this case the opening is a few lines up, but you could have a code block that runs for hundreds of lines, and it's good to remember what started it. * if ($loginok = true)* * {* First, off, as someone else mentioned, this should presumably be: if ($loginok == true) This one mistake will mean that $loginok will always be true. Second, since if statements are always looking for true conditions, you can simply type: if ($loginok) Finally, since $loginok is assigned the true value in the previous block, then, unless it is also possibly assigned elsewhere, you can just put the below code in the same code block as the above code, rather than closing and starting a new one with this if statement. * if ($remember==on) * *setcookie(username, $username, time()+7200*24);* This is not very intuitive. You're saying to add 2 hours times 24, which is a bit strange if you're trying to understand the code. I'dve found 3600*48 much more intuitive. A comment mightn't go astray here either. * elseif ($remember==) Are these the only two values that $remember can have? May as well just use else here without testing for another condition (either the user is remembering or they're not). * * //We save the user name in the session username and the user Id in the session userid* I think we might have an left brace missing here, unless it's gotten lost in translation. Also, I notice you're storing username and userid here, but above only stored username in the cookie. * $_SESSION('username')=$username; * This line should read: $_SESSION['username']=$username; I see the next line has it right. I'm surprised that your code didn't generate an error for this one, and since it didn't, this may indicate that this code is never reached (possibly due to the elseif test above). * $_SESSION['userid'] = $dn['id'];* * $_SESSION['usr_level'] = $dn['usr_level'];* I see a mixing of styles here. While it's all perfectly good syntax, you may want to find a style you like and stick to it. I personally find $foo = $bar; much more readable than $foo=$bar; or $foo = $bar; but each to their own. Another problem I am now facing, is to check whether to user is logged in, and if it is the user should be redirected from the index-page(with the login-form) to its user area based on the user level(newbie, advanced or admin). For now I have written a function, in the config.php. *function loggedin()* *{* * if (isset($_SESSIONS['username']) || isset($_COOKIE['username']))* * {* * $loggedin = true;* * return $loggedin;* * }* *}* As someone else pointed out, you could simply return true instead of assigning to a variable. They also pointed out that you don't return false if the person is not logged in. You could rewrite the above function like so: function loggedin() { if (isset($_SESSIONS['username']) || isset($_COOKIE['username'])) return true; else return false; } However, this doesn't actually check the values of these items, it simply checks to see if they have been set. I have both tried to include the config.php into the index-page(login-form) and into the connexions.php script (where cookie is implemented). Along with this code: *?php* * * *if (loggedin==true)* You need to call a function with parentheses, even if it takes no arguments, like so: if (loggedin() == true) or simply if (loggedin()) *{* * if($usr_level == admin)* *{* * ?* *div class=messageYou have successfuly been logged in. You can now access the
RE: [PHP] form validation
-Original Message- From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel P. Brown Sent: 12 August 2011 16:53 On Fri, Aug 12, 2011 at 11:42, Chris Stinemetz chrisstinem...@gmail.com wrote: I have a select menu created by a foreach loop. I am trying to validate that there was a selection made before it is submitted to the database. But I am not doing something correctly. Try using a combination of isset, empty, and is_null() instead: ?php if (!isset($_POST['market']) || empty($_POST['market']) || is_null($_POST['market'])) { // Wasn't set } ? The last part of that test is redundant, since if $_POST['market'] is NULL isset($_POST['market'] will be FALSE. Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Portland PD507, City Campus, Leeds Metropolitan University, Portland Way, LEEDS, LS1 3HE, United Kingdom E: m.f...@leedsmet.ac.uk T: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form validation
On Sun, Aug 14, 2011 at 18:19, Ford, Mike m.f...@leedsmet.ac.uk wrote: The last part of that test is redundant, since if $_POST['market'] is NULL isset($_POST['market'] will be FALSE. Good catch. Didn't even notice I typed that. Not that it would've done any damage, but a good reminder why code here is not meant to be blindly copied-and-pasted. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php