[PHP] Re: Need shopping cart for online updating
Lisa A wrote: > I currently use Pay Pal shopping cart, but I need to find a good, cheap > shopping cart that my clients can update themselves. Does anyone know of > something I can install so they can work on it easily. They need to do this > online. > thanks, > Lisa A Hello, I don't know what you are looking for. Have a look here http://www.hotscripts.com/PHP/Scripts_and_Programs/E-Commerce/index.html Regards, Nadim Attari Alienworkers.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with SSI, Apache & PHP!
Alberto Ferrer wrote: i get segmentation fault with apache 1.3.34 , like this bug: http://bugs.php.net/bug.php?id=35029 , only change the apache version. The error is: [Thu Mar 16 03:33:07 2006] [notice] child pid 2121 exit signal Segmentation fault (11) [Thu Mar 16 03:33:08 2006] [notice] child pid 2120 exit signal Segmentation fault (11) We can't do much about segfaults. Post more information on that bug report and help the php guys work out what's going on. -- 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] Re: regular expressions and Phone validation
Paul Goepfert wrote: I have one small problem I don't understand the preg_replace() method. I understand the gist of what it does but I still don't fully know what it does. I have read the entry in the php manual about this and I am still confused about it. I've never been any good with regular expressions. Well, I'm not sure about what you don't understand. Anyway, preg_replace() does "the same" as str_replace(), but using regular-expressions instead of just strings. If you understand how do reg-exp work, then it should have no real problem, if the reg-exp are the problem then you better read a little more about them (the PCRE tutorial at php.net is really good, IMHO) Here is the function in use: function checkPhone ($Phone) [···] $Phone = ereg_replace("[^0-9]", '', $Phone); if ((strlen($Phone)) <= 14) return preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/", "(\\1) \\2-\\3", $Phone); [···] I think my problem is mostly what is returned when preg_replace executes? Well, what's inside parenthesis is "remembered" by preg_replace(), and you make reference to them using "\\n" or "$n" (where "n" is a number) in the "replace-string" (there are some exceptions, but that should do for now) If you look carefuly, there are three expressions between parenthesis, and these are what you're referencing via "(\\1) \\2-\\3" Though, there's something I don't get it: in your reg-exp your ignoring any non-numeric character, but you already got rid of them with ereg_replace()... (??) -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with SSI, Apache & PHP!
i get segmentation fault with apache 1.3.34 , like this bug: http://bugs.php.net/bug.php?id=35029 , only change the apache version. The error is: [Thu Mar 16 03:33:07 2006] [notice] child pid 2121 exit signal Segmentation fault (11) [Thu Mar 16 03:33:08 2006] [notice] child pid 2120 exit signal Segmentation fault (11) [Thu Mar 16 03:33:08 2006] [notice] child pid 2112 exit signal Segmentation fault (11) [Thu Mar 16 03:33:08 2006] [notice] child pid 958 exit signal Segmentation fault (11) [Thu Mar 16 03:33:08 2006] [notice] child pid 957 exit signal Segmentation fault (11) [Thu Mar 16 03:33:09 2006] [notice] child pid 2127 exit signal Segmentation fault (11) [Thu Mar 16 03:33:09 2006] [notice] child pid 2126 exit signal Segmentation fault (11) [Thu Mar 16 03:33:10 2006] [notice] child pid 2128 exit signal Segmentation fault (11) Yy SHTML have a include to a script in PHP, with a connection to mySQL , im using php 4.4.2 Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.2 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a Thank -- bet0x -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: REG-EXPR: Allowing limited number of special chars in usernames
Holger Sunke wrote: I dont know that much aboput regular expressions and just want to know how to find out the number of special (non alphanumeric) characters in a string or how to match a string that contains less than 3 special chars. I don't really understand what you need, but... - how to find out the number of special (non alphanumeric) characters $alpha = '[a-z0-9]'; $special_chars = preg_replace("/$alpha+/Xi", '', $string); * this would replace any alpha-numeric char by... nothing, leaving the "special chars" only, and strlen() will give you how many are * beware that you're saying *anything* other than alpha-numeric chars - how to match a string that contains less than 3 special chars * as I said above, strlen() will give you the number of these chars: $num_special_chars = strlen($special_chars); preg_match('/^[ -~äöüßÄÖÜ]+$/',$string) will return TRUE if $string consists enterily of the chars between the square-brackets. I hope this helped a little. urrently im using a function function valid_username($string) { if(strlen($string)<=16&&strlen($string)>5) { return(preg_match('/^[ -~äöüßÄÖÜ]+$/',$string)); } else { return FALSE; } } This allows usernames of 6 to 16 length containing many special chars and German "Umlaute". But this also allows usernames like "=)/(&%$" what should not be. So how to limit the number of special chars? This function should just return fals if number of special chars > X -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: setcookie security concerns
As far as I see... I can't see any risk. Cookies are saved in the client machine (i.e. the one visiting your site), so any code he might send will be used with him only, and it will not affect other users nor the scripts in the (remote) server. Now, you're not using the input value in anything similar to an eval() expression, hence should some PHP code be sent and it would only be printed, no harm in that either. Inspite of all this, I would really recomend you not to rely on register_globals=On, since: it's not a good idea, it's actually deprecated (someday it will be removed) and makes your code a little bit more confused, since it's not clear where do that variables come from. > 1. Is he right? Yes, and no. In your specific case someone _could_ send you code instead of whatever you're expecting (and you don't validate the input), but it would be harmless for anyone other that himslef. Beware that the risk of code inserted in cookies, form-input elements, the Query string, etc., is real and it depends on the way you use the data received, and if you check it and how do you do it. > 2. How does that work? Well, cookies are stored in your (client) machine, so you're able to modify whatever content they have. One way to test this is using Firefox and an extension that allows you to edit cookies such as "Add N Edit Cookies" (play with the cookie of your own site) > 3. If so, what do I do to correct this? Do not rely on register_globals, and don't ever trust on any input given by the user, treat all of them as enemies and check everything that comes to your mind --and more ;) Note: this is how _I_ see it, so I could be ignoring something that other people did see. tedd wrote: Hi: I've been using a php style switcher allowing users to change css. The code follows: Within the head tags. Within the body tags, allowing the user to select which style they want: Green or href="switch.php?set=style1">Red And, the corresponding (switch.php) php code is: It's pretty simple. But recently, I had one person hammer me stating it was a security problem because I didn't validate the user input. As such, he says that someone could inject an arbitrary code and cause problems. 1. Is he right? 2. How does that work? 3. If so, what do I do to correct this? Many thanks for any replies. tedd -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this password protection script secure?
Oscar Gosdinski wrote: Instead of using a hash if the password string, i prefer to save the following in the password field of my user's table: md5($user . $password) This is a good idea, IMHO of course. There are some md5 databases around that can be used to get the cleartext password from the hash if your database is compromised, if you use this method it's difficult to get the cleartext password because it depends on the user and you are also validating if the user exists. Well, it's a little hard to obtain the "cleartext" from something in MD5-hash, though it's possible via brute-force. You might as well try to use some other method, such as SHA1, combine them or do whatever you want to alter the initial clear-text version to obfuscate it (like you did above) However, i have a question. Which is better?, the md5 function provided by PHP or MySQL? i used the MySQL function because i didn't compile PHP with support for hash. The one in JavaScript :) AFAIK, every MD5 function is based on the MD5 algorithm, so the implementation is rather similar (if not the same) Of course, the result is always the same. -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need shopping cart for online updating
I currently use Pay Pal shopping cart, but I need to find a good, cheap shopping cart that my clients can update themselves. Does anyone know of something I can install so they can work on it easily. They need to do this online. thanks, Lisa A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] heredoc syntax vs Double-Quotes
At 07:06 PM 3/15/2006, Chris Kennon wrote: when is using heredoc advisable over Double-Quotes? I love using heredoc primarily because it helps me separate logic from markup when generating HTML. The text in a heredoc expression is vanilla, no escape sequences needed, so there's less worry about typos. I find it one of the strongest features of PHP as compared to other scripting languages. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] heredoc syntax vs Double-Quotes
Chris Kennon wrote: Hi, Not looking to start some pugilistic fray, but when is using heredoc advisable over Double-Quotes? Probably with really long strings or pages of data so you don't have to worry about quotes etc. Pretty much comes down to personal preference I think. -- 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] dumping array to file
blackwater dev wrote: I am doing a select from a mssql db and will then pump it into a mysql db. What is the easiest way to take the result array from the mssql db and dump it to a file that I can just pull into MySQL short of writing out to the file row by row. Didn't you ask this yesterday ? http://marc.theaimsgroup.com/?l=php-general&m=114239307630043&w=2 The answer is going to be the same. -- 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] heredoc syntax vs Double-Quotes
Hi, Not looking to start some pugilistic fray, but when is using heredoc advisable over Double-Quotes? Return True, Christopher Kennon Principal/Designer/Programmer -Bushidodeep http://bushidodeep.com/ __ "Knowing is not enough, you must apply; willing is not enough, you must do." ---Bruce Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dumping array to file
I am doing a select from a mssql db and will then pump it into a mysql db. What is the easiest way to take the result array from the mssql db and dump it to a file that I can just pull into MySQL short of writing out to the file row by row. Thanks.
Re: [PHP] HIgh score not up to scratch
Mark wrote: Any help Here: At the moment this shows a USERNAME-COMPETITION and POINTS for a user with the highest points out of many competitions. The USERS also have a second points field (acc_margin) where lower score is better. So my problem is that i need to show the highest scoring user (by points) then if there is another user with the exact same points then the user with the lowest (acc_margin) is shown. HERE IS THE TABLE: Field Type Null Default id int(11) No user_id int(11) No 0 comp_id int(11) No 0 username text No points int(11) No 0 amt float No 0 margin int(11) No 0 acc_margin int(11) No 0 I had a similar question earlier that i was helped with but i cant seem make it work here: (here it is) SELECT * FROM leaderboard WHERE comp_id = $comp_id ORDER by points DESC, acc_margin ASC *** What was wrong with this result? ie what did it show and what did you expect it to show? This looks right to me. -- 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] HIgh score not up to scratch
Any help Here: At the moment this shows a USERNAME-COMPETITION and POINTS for a user with the highest points out of many competitions. The USERS also have a second points field (acc_margin) where lower score is better. So my problem is that i need to show the highest scoring user (by points) then if there is another user with the exact same points then the user with the lowest (acc_margin) is shown. " . $leader[$x] . "" . $comp[$x] . "" . number_format($max_query[$x],0) . ""; } ?> HERE IS THE TABLE: Field Type Null Default id int(11) No user_id int(11) No 0 comp_id int(11) No 0 username text No points int(11) No 0 amt float No 0 margin int(11) No 0 acc_margin int(11) No 0 I had a similar question earlier that i was helped with but i cant seem make it work here: (here it is) SELECT * FROM leaderboard WHERE comp_id = $comp_id ORDER by points DESC, acc_margin ASC *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php 5 installation problem
Hi gang: I asked my host to install the current versions of php 5 and the following was his answer: "Sorry but php has some issues with cpanel." Anyone heard of any problems or a work-around? Thanks. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_mail_compose not working
Karel Kozlik wrote: Hi All, function imap_mail_compose() not working on my server. This script: return only one line: --117491828-5973-1142442255=:332-- altouch when I run this script on another server it correctly return this: What version of imap do you have on both servers? Maybe one is older and has some bugs that have been fixed. -- 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] Message board integration with existing site
2wsxdr5 wrote: I have a site with existing users and would like to add a message board such as phpbb or one of the others. The main requirement I have is I need to be able to use the existing user logins to access the forums. I also need a help desk ticket system that is also linked to the same users. I may however write that one myself as it doesn't need to be very sophisticated. Can some one recommend a php forum package and possibly a help desk ticket system that would be easy to integrate with my existing system? Basically what I will need to do is know how the account creation works with both systems and have my existing site populate the DB tables of each system and my existing login system set cookies or other variables so when they are logged into one they are logged into them all. Look for one that has a developer api you can use to create / update users, it will make things easier (come upgrade time it won't change too much either whereas a database can change considerably and all your work goes down the drain). Apart from that you'll need to modify each system so if you log in to the ticket system, you are logged in to the forums, if you log in to the website, you are logged in to both and so on - so the code will need to be "open" (unencrypted). -- 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] GD2 gif resizing problem
John Nichel wrote: Al wrote: Philip Hallstrom wrote: I'm trying to resize GIF images and up with very large files For example: Original width = 720 New width = 980 Original height = 1008 New height = 1274 Original filesize = 80kb After resizing = 235kb Based on the area increase; I'd expect the file size to about double, not be 4x as large. $src_img = imagecreatefromgif($filename); $dest_img = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $org_width, $org_height); imagegif($dest_img, $filename); I tried using imagetruecolortopalette() and it helped a little; but screwed up the image quality. Can anyone explain or have a solution? What's the image? If it's photo-like, save it as a PNG or JPEG and you'll get much smaller files. GIF's don't do very well with some images as it can't encode them very efficiently. I don't remember which way it goes, but a 1x500 gif of a solid color will be much much much larger than a 500x1 gif of a solid color. The latter it can compress by sayign something like "x color for the next 500 columns on this row". If it were me, I'd try jpeg/png first. The image is a simple 4 color street map. Out of the image editor, these images are always much smaller than reasonably compressed jpgs or pngs. I need to keep the file size small as many of our users still use dial-up. If your original is only 4 color, I'm guessing that your new image is 256 colors, giving you the 'out of proportion' filesize. That was my original thought also. So I tried using imagetruecolortopalette() with limited colors and the colors went goofy at less than about 100. The file size saving wasn't appreciable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Message board integration with existing site
I have a site with existing users and would like to add a message board such as phpbb or one of the others. The main requirement I have is I need to be able to use the existing user logins to access the forums. I also need a help desk ticket system that is also linked to the same users. I may however write that one myself as it doesn't need to be very sophisticated. Can some one recommend a php forum package and possibly a help desk ticket system that would be easy to integrate with my existing system? Basically what I will need to do is know how the account creation works with both systems and have my existing site populate the DB tables of each system and my existing login system set cookies or other variables so when they are logged into one they are logged into them all. -- Chris W KE5GIX Gift Giving Made Easy Get the gifts you want & give the gifts they want One stop wish list for any gift, from anywhere, for any occasion! http://thewishzone.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI versus apache module
I have a.php includes b.php . b.php is used by other pages that are served through apache. a.php used to be started through apache, but now need to be started from command line. How do I know if a php file is running as apache module or as CLI ? http://us3.php.net/manual/en/function.php-sapi-name.php -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CLI versus apache module
I have a.php includes b.php . b.php is used by other pages that are served through apache. a.php used to be started through apache, but now need to be started from command line. How do I know if a php file is running as apache module or as CLI ? Thanks Khai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can I specify alternative php.ini in httpd.conf
Hi All, I am using php as an apache module. In my httpd.conf, is there a way to specify which php.ini to use? Thanks Khai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking multiple URL parameters
[EMAIL PROTECTED] wrote: Hi, How can I get multiple values from a variable (from URL) and parse them into an array? For example: example.php?graphArray=20,35,84,21,23,22,24,95 parse_str is for multiple variables, not multiple values of one variable. $x_array = explode(',', $_GET['graphArray']); -- 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: RE: [PHP] checking multiple URL parameters
Hi, How can I get multiple values from a variable (from URL) and parse them into an array? For example: example.php?graphArray=20,35,84,21,23,22,24,95 parse_str is for multiple variables, not multiple values of one variable. PLEASE HELP!!! Thank you Aret -- This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com http://www.opensubscriber.com/message/php-general@lists.php.net/11683.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating forms dynamically
On Tuesday 14 March 2006 20:21, Paul Goepfert wrote: > If anyone has any ideas on how to create the form when the error messages > are displayed without having to code it a second time please let me > know. I use an assoc. array that matches the form inputs, for example: $FormDisplayData = array( 'username' => '', 'email' => '', 'city' => '' ); and a flag variable that is set when an error is encountered. Then in the form: echo "Enter your username: "; if ($FoundErrors) { echo "Invalid username!";} and so on. This way, first time through the form the array is empty and the error flag is false - user gets a form ready to be filled in. If you get a processing error, populate the $FormDisplayData array with the values from $_POST, and the user gets his input back to correct, and a message telling him why. Neat, huh? There are undoubtedly many other ways to do this, but this is the only one I know :) Hope this helps. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Variable Scope Question
Nevermind - i found the documentation that answers my question - thanks for the help Jeremy and Jochas. - MD ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808 On Mar 15, 2006, at 1:54 PM, Mike Dunlop wrote: the fact that you think that it might even be possible that doing myClass::showVar() would cause $this in showVar() to refer to $obj suggests that you don't understand [to some degree] either classes, objects and/or scope (or at least how its implemented/applied in php). No Jochem, I may have not been clear with the phrasing of my question. To simplify, my question was focusing on the scope of "$this". When calling a method via "::" syntax within an outside function, how does that affect the scope of $this (within the class). I appreciate you taking the time to respond to my question. - MD ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808 On Mar 15, 2006, at 1:17 PM, Jochem Maas wrote: Mike Dunlop wrote: Hi Guys, I am wondering how to be able to call a class variable from within an outside function using the "::" syntax: See an example of the logic I am using below: class myClass { var $variable = 1; // this works in php4. 1,"b"=>2,"c"=>3 ); if (empty($key)) { return $defvar; } else if (isset($vars[$key])) { return $vars[$key]; } }} function extFunction() { return myClass::showVar(); } echo extFunction(),"\n", myClass::showVar("a"),"\n", myClass::showVar("b"),"\n", myClass::showVar("c"),"\n"; ?> } $obj = new myClass; function extFunction() { return myClass::showVar(); } I am assuming this isn't working because by calling myClass::showVar () don't assume - run the code and find out :-) the fact that you think that it might even be possible that doing myClass::showVar() would cause $this in showVar() to refer to $obj suggests that you don't understand [to some degree] either classes, objects and/or scope (or at least how its implemented/applied in php). instead of $obj->showVar() "$this" would be undefined...does anyone know how to workaround this (e.g. direct access to a variable via "::" it's hard to define a workaround if we don't know what your trying to achieve and why('why' often speaks volumes :-). syntax like myClass::variable). Does PHP5 address this at all? yup. :-) please install php5 straight away :-P php -r ' class T { private static $U = "V"; static function W() { return self::$U; } } echo T::W(),"\n"; ' now start reading here, plenty of nice OO features that blow php4 out of the water in that context: http://php.net/php5 Many thanks on this. Best, Mike D ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class Variable Scope Question
the fact that you think that it might even be possible that doing myClass::showVar() would cause $this in showVar() to refer to $obj suggests that you don't understand [to some degree] either classes, objects and/or scope (or at least how its implemented/applied in php). No Jochem, I may have not been clear with the phrasing of my question. To simplify, my question was focusing on the scope of "$this". When calling a method via "::" syntax within an outside function, how does that affect the scope of $this (within the class). I appreciate you taking the time to respond to my question. - MD ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808 On Mar 15, 2006, at 1:17 PM, Jochem Maas wrote: Mike Dunlop wrote: Hi Guys, I am wondering how to be able to call a class variable from within an outside function using the "::" syntax: See an example of the logic I am using below: class myClass { var $variable = 1; // this works in php4. 1,"b"=>2,"c"=>3 ); if (empty($key)) { return $defvar; } else if (isset($vars[$key])) { return $vars[$key]; } }} function extFunction() { return myClass::showVar(); } echo extFunction(),"\n", myClass::showVar("a"),"\n", myClass::showVar("b"),"\n", myClass::showVar("c"),"\n"; ?> } $obj = new myClass; function extFunction() { return myClass::showVar(); } I am assuming this isn't working because by calling myClass::showVar () don't assume - run the code and find out :-) the fact that you think that it might even be possible that doing myClass::showVar() would cause $this in showVar() to refer to $obj suggests that you don't understand [to some degree] either classes, objects and/or scope (or at least how its implemented/applied in php). instead of $obj->showVar() "$this" would be undefined...does anyone know how to workaround this (e.g. direct access to a variable via "::" it's hard to define a workaround if we don't know what your trying to achieve and why('why' often speaks volumes :-). syntax like myClass::variable). Does PHP5 address this at all? yup. :-) please install php5 straight away :-P php -r ' class T { private static $U = "V"; static function W() { return self::$U; } } echo T::W(),"\n"; ' now start reading here, plenty of nice OO features that blow php4 out of the water in that context: http://php.net/php5 Many thanks on this. Best, Mike D ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808 -- 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] Class Variable Scope Question
Mike Dunlop wrote: Hi Guys, I am wondering how to be able to call a class variable from within an outside function using the "::" syntax: See an example of the logic I am using below: class myClass { var $variable = 1; // this works in php4. 1,"b"=>2,"c"=>3 ); if (empty($key)) { return $defvar; } else if (isset($vars[$key])) { return $vars[$key]; } }} function extFunction() { return myClass::showVar(); } echo extFunction(),"\n", myClass::showVar("a"),"\n", myClass::showVar("b"),"\n", myClass::showVar("c"),"\n"; ?> } $obj = new myClass; function extFunction() { return myClass::showVar(); } I am assuming this isn't working because by calling myClass::showVar () don't assume - run the code and find out :-) the fact that you think that it might even be possible that doing myClass::showVar() would cause $this in showVar() to refer to $obj suggests that you don't understand [to some degree] either classes, objects and/or scope (or at least how its implemented/applied in php). instead of $obj->showVar() "$this" would be undefined...does anyone know how to workaround this (e.g. direct access to a variable via "::" it's hard to define a workaround if we don't know what your trying to achieve and why('why' often speaks volumes :-). syntax like myClass::variable). Does PHP5 address this at all? yup. :-) please install php5 straight away :-P php -r ' class T { private static $U = "V"; static function W() { return self::$U; } } echo T::W(),"\n"; ' now start reading here, plenty of nice OO features that blow php4 out of the water in that context: http://php.net/php5 Many thanks on this. Best, Mike D ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] to check idle time of users
Peter Lauri wrote: Miles, Please do not scare away people from the list. There can be many reasons why he asks this question without looking at the documentation first. I don't think the idea was to scare him away so much as scare him _to_ the docs... everyone who has been there knows it takes weeks/months before you start to comprehend what you read in the docs - but there is no short cut for reading it front to back. hopefully one day Suresh will come to the list, without the (percieved) high expectations [in terms of 'prefab' answers], with questions that people find appealing (I believe you have to 'sell' the question - i.e. answer the question "what's fun about solving X?".) if the day comes it will be good for Suresh because he will by definition be a better programmer. 1: He/She is maybe new to this subject, and do not have a lot of experience with reading docs. well he's posted 20 similar questions in 3 months, without replying to reponses he recieved (of which there have been plenty). 2: He/She maybe don't have English as mother language that will make manuals difficult to understand etc. he could ask someone for an explaination - only first he has to point at something specific that he's stumped on. no? In the beginning of my "life" in the PHP and web programming world, I found the docs extremely difficult to understand. You learn by doing, and this is maybe his way to start to learn. may we humbly reserve the right to intervene early? before the rot sets in ;-) actually it looks partly like a culture issue - I get the impression Suresh is actually being [comparatively] polite according to his culture (yahoo.in --> indian). If you find this so "Fergawdsake", just ignore it, someone else might see this in a deeper way then you seem to do. You just reference to you knowledge, without being able to reference to others depth of knowledge. Miles, sit down and read your reply again, and you might learn something you too. s/Miles/Jochem/ (or whatever the incantation is) I'm guilty too. Best regards, Peter Lauri PS! This post might not belong to the list, but I think it is important to it's okay - it's got the word PHP in it. :-) address that we can not all be best, we are all at different levels and see problems different DS! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Creating forms dynamically
Hello, on 03/14/2006 05:21 PM Paul Goepfert said the following: > I have been working on a page where I have a form. I currently have > the form in an else block with no access to it if I need to redisplay > the form incase of errors. To be more specific I want to redisplay the > page with the errors displayed. I would like to have the form coded > once. It would save on file size. In my form I have a table that > holds the text inputs. I do have MySQL code for dropdown menus. If > anyone has any ideas on how to create the form when the error messages > are displayed without having to code it a second time please let me > know. Why don't you just use the same script to display and process the form? Just set the form action attribute to an empty string and you do not even have to figure what is the current page URL. I always do that precisely for the reasons you mentioned of the form having invalided fields that need to be corrected by the user. I also use this popular class for forms generation and validation. I just specify which kinds of validation I want and the class validates the form for me on the server side. It also generates automatic Javascript code to perform validation on the browser side before the user submits the form to reduce the need to access the server to perform validation. Now there is even something better. The class comes with an AJAX form submission plug-in that lets the form be validated without reloading the page. If there are invalid fields, your script can command the forms class with that plug-in to mark the fields that are invalid. If the form is completely valid, you can process the form actions and give feedback to the user browser while the form processing occurs on the server side. When all is done you can tell the class to show a success message, wait a few secons and redirect the browser to a new page. The good part is that this works well with all browsers and you do not need to know a single bit of Javascript to implement this. Take a look in particular to the test_ajax_submit.php example. http://www.phpclasses.org/formsgeneration PS. the class also comes with another plug-in to link multiple dropdown (select) inputs loading options taken from a database. http://www.phpclasses.org/browse/view/html/file/9879/name/test_linked_select_page.html -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class Variable Scope Question
[snip] I am wondering how to be able to call a class variable from within an outside function using the "::" syntax: See an example of the logic I am using below: class myClass { var $variable = 1; function showVar() { return $this->variable; } } $obj = new myClass; function extFunction() { return myClass::showVar(); } I am assuming this isn't working because by calling myClass::showVar () instead of $obj->showVar() "$this" would be undefined...does anyone know how to workaround this (e.g. direct access to a variable via "::" syntax like myClass::variable). Does PHP5 address this at all? [/snip] http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class Variable Scope Question
Hi Guys, I am wondering how to be able to call a class variable from within an outside function using the "::" syntax: See an example of the logic I am using below: class myClass { var $variable = 1; function showVar() { return $this->variable; } } $obj = new myClass; function extFunction() { return myClass::showVar(); } I am assuming this isn't working because by calling myClass::showVar () instead of $obj->showVar() "$this" would be undefined...does anyone know how to workaround this (e.g. direct access to a variable via "::" syntax like myClass::variable). Does PHP5 address this at all? Many thanks on this. Best, Mike D ... Mike Dunlop Director of Technology Development [ e ] [EMAIL PROTECTED] [ p ] 323.644.7808
RE: [PHP] regular expressions and Phone validation
[snip] I have one small problem I don't understand the preg_replace() method. I understand the gist of what it does but I still don't fully know what it does. I have read the entry in the php manual about this and I am still confused about it. I've never been any good with regular expressions. Here is the function in use: function checkPhone ($Phone) { global $errmsg; if (!empty($Phone)) { $Phone = ereg_replace("[^0-9]", '', $Phone); if ((strlen($Phone)) <= 14) return preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/", "(\\1) \\2-\\3",$Phone); } } I think my problem is mostly what is returned when preg_replace executes? [/snip] There are several methods of doing phone number validation, one was even mentioned last week. You may try the archives for answers. What are you trying to do here? Once we know that we can probably help you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD2 gif resizing problem
Al wrote: Philip Hallstrom wrote: I'm trying to resize GIF images and up with very large files For example: Original width = 720 New width = 980 Original height = 1008 New height = 1274 Original filesize = 80kb After resizing = 235kb Based on the area increase; I'd expect the file size to about double, not be 4x as large. $src_img = imagecreatefromgif($filename); $dest_img = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $org_width, $org_height); imagegif($dest_img, $filename); I tried using imagetruecolortopalette() and it helped a little; but screwed up the image quality. Can anyone explain or have a solution? What's the image? If it's photo-like, save it as a PNG or JPEG and you'll get much smaller files. GIF's don't do very well with some images as it can't encode them very efficiently. I don't remember which way it goes, but a 1x500 gif of a solid color will be much much much larger than a 500x1 gif of a solid color. The latter it can compress by sayign something like "x color for the next 500 columns on this row". If it were me, I'd try jpeg/png first. The image is a simple 4 color street map. Out of the image editor, these images are always much smaller than reasonably compressed jpgs or pngs. I need to keep the file size small as many of our users still use dial-up. If your original is only 4 color, I'm guessing that your new image is 256 colors, giving you the 'out of proportion' filesize. -- 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] PHP/Oracle : bug with accent...
> > I have a big problem with my Debian server (Apache 2, PHP 5, Oracle > > Instant Client). I've modified the environment variable NLS_LANG and, > > with SQL*Plus, everything is ok ! But, in a PHP page, I can't insert a > > value with accent (ex: Irène). I can read data with accent, but not > > inserting !!! > > I searched all the afternoon, testing many solutions, without success. I > > think I'm not alone with this problem but... > > > > Do you have any clue ? Something to look at ? > > Try looking at the multi-byte string functions. Not sure if that would > help you or not though. OK. I've finally found the solution. Everything was ok except the Apache environment variables (NLS_LANG). Now, it works... Thank you. David. signature.asc Description: Ceci est une partie de message numériquement signée
[PHP] regular expressions and Phone validation
Hi all, I have one small problem I don't understand the preg_replace() method. I understand the gist of what it does but I still don't fully know what it does. I have read the entry in the php manual about this and I am still confused about it. I've never been any good with regular expressions. Here is the function in use: function checkPhone ($Phone) { global $errmsg; if (!empty($Phone)) { $Phone = ereg_replace("[^0-9]", '', $Phone); if ((strlen($Phone)) <= 14) return preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/", "(\\1) \\2-\\3",$Phone); } } I think my problem is mostly what is returned when preg_replace executes? Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD2 gif resizing problem
Philip Hallstrom wrote: I'm trying to resize GIF images and up with very large files For example: Original width = 720 New width = 980 Original height = 1008 New height = 1274 Original filesize = 80kb After resizing = 235kb Based on the area increase; I'd expect the file size to about double, not be 4x as large. $src_img = imagecreatefromgif($filename); $dest_img = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $org_width, $org_height); imagegif($dest_img, $filename); I tried using imagetruecolortopalette() and it helped a little; but screwed up the image quality. Can anyone explain or have a solution? What's the image? If it's photo-like, save it as a PNG or JPEG and you'll get much smaller files. GIF's don't do very well with some images as it can't encode them very efficiently. I don't remember which way it goes, but a 1x500 gif of a solid color will be much much much larger than a 500x1 gif of a solid color. The latter it can compress by sayign something like "x color for the next 500 columns on this row". If it were me, I'd try jpeg/png first. The image is a simple 4 color street map. Out of the image editor, these images are always much smaller than reasonably compressed jpgs or pngs. I need to keep the file size small as many of our users still use dial-up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a shell command using thttpd-php
Nelson Carreira wrote: James E Hicks III wrote: Nelson Carreira wrote: Yes, I've tried using both absolute and relative paths. The system output is 0 when I execute, for example, "nvram show" from the php. From what I know this output means success. Although there's no output on php. Nelson Carreira From your original post it looks like the function you want to use is passthru(). I just noticed the following note on php.net: Note: When safe mode is enabled, you can only execute executables within the safe_mode_exec_dir. For practical reasons it is currently not allowed to have .. components in the path to the executable. Could this be your problem? James This version of php doesn't have a php.ini file for configuration, so there's no safe_mode_exec_dir. I tried to create the one mentioned in php_info() and copy the executables there but it didn't work. Nelson Carreira Hmmm. I'm all out of ideas. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD2 gif resizing problem
I'm trying to resize GIF images and up with very large files For example: Original width = 720 New width = 980 Original height = 1008 New height = 1274 Original filesize = 80kb After resizing = 235kb Based on the area increase; I'd expect the file size to about double, not be 4x as large. $src_img = imagecreatefromgif($filename); $dest_img = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $org_width, $org_height); imagegif($dest_img, $filename); I tried using imagetruecolortopalette() and it helped a little; but screwed up the image quality. Can anyone explain or have a solution? What's the image? If it's photo-like, save it as a PNG or JPEG and you'll get much smaller files. GIF's don't do very well with some images as it can't encode them very efficiently. I don't remember which way it goes, but a 1x500 gif of a solid color will be much much much larger than a 500x1 gif of a solid color. The latter it can compress by sayign something like "x color for the next 500 columns on this row". If it were me, I'd try jpeg/png first. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD2 gif resizing problem
I'm trying to resize GIF images and up with very large files For example: Original width = 720 New width = 980 Original height = 1008 New height = 1274 Original filesize = 80kb After resizing = 235kb Based on the area increase; I'd expect the file size to about double, not be 4x as large. $src_img = imagecreatefromgif($filename); $dest_img = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $org_width, $org_height); imagegif($dest_img, $filename); I tried using imagetruecolortopalette() and it helped a little; but screwed up the image quality. Can anyone explain or have a solution? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [SOLVED] [PHP] date from YYYY-MM-DD to current date
Sorry Gmail doesnt always put all the email address on the TO line in a reply. On 3/15/06, Shaunak Kashyap <[EMAIL PROTECTED]> wrote: > In the future, please reply to the list. Also, I assume this question > has been answered and am, therefore, marking it with [SOLVED]. > > Shaunak Kashyap > > Senior Web Developer > WPT Enterprises, Inc. > 5700 Wilshire Blvd., Suite 350 > Los Angeles, CA 90036 > > Direct: 323.330.9870 > Main: 323.330.9900 > > www.worldpokertour.com > > Confidentiality Notice: This e-mail transmission (and/or the > attachments accompanying) it may contain confidential information > belonging to the sender which is protected. The information is intended > only for the use of the intended recipient. If you are not the intended > recipient, you are hereby notified that any disclosure, copying, > distribution or taking of any action in reliance on the contents of this > information is prohibited. If you have received this transmission in > error, please notify the sender by reply e-mail and destroy all copies > of this transmission. > > > -Original Message- > > From: Dan McCullough [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 15, 2006 10:22 AM > > To: Shaunak Kashyap > > Subject: Re: [PHP] date from -MM-DD to current date > > > > excellent, I was getting close, was getting hung up on a couple of > things > > > > On 3/15/06, Shaunak Kashyap <[EMAIL PROTECTED]> wrote: > > > // $pastDateStr = string representation of past date > > > $pastDateTS = strtotime($pastDateStr); > > > > > > For ($currentDateTS = $pastDateTS; > > >$currentDateTS <= strtotime("now"); > > >$currentDateTS += (60 * 60 * 24)) { > > > > > >// use date() and $currentDateTS to format the dates in > between > > > > > > } > > > > > > HTH, > > > > > > Shaunak Kashyap > > > > > > Senior Web Developer > > > WPT Enterprises, Inc. > > > 5700 Wilshire Blvd., Suite 350 > > > Los Angeles, CA 90036 > > > > > > Direct: 323.330.9870 > > > Main: 323.330.9900 > > > > > > www.worldpokertour.com > > > > > > Confidentiality Notice: This e-mail transmission (and/or the > > > attachments accompanying) it may contain confidential information > > > belonging to the sender which is protected. The information is > intended > > > only for the use of the intended recipient. If you are not the > intended > > > recipient, you are hereby notified that any disclosure, copying, > > > distribution or taking of any action in reliance on the contents of > this > > > information is prohibited. If you have received this transmission in > > > error, please notify the sender by reply e-mail and destroy all > copies > > > of this transmission. > > > > > > > > > > -Original Message- > > > > From: Dan McCullough [mailto:[EMAIL PROTECTED] > > > > Sent: Wednesday, March 15, 2006 9:58 AM > > > > To: php-general@lists.php.net > > > > Subject: [PHP] date from -MM-DD to current date > > > > > > > > I need to loop from a date in the past to current date getting all > > > > dates in between. Anyone have an idea on how to do that? > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [SOLVED] [PHP] date from YYYY-MM-DD to current date
In the future, please reply to the list. Also, I assume this question has been answered and am, therefore, marking it with [SOLVED]. Shaunak Kashyap Senior Web Developer WPT Enterprises, Inc. 5700 Wilshire Blvd., Suite 350 Los Angeles, CA 90036 Direct: 323.330.9870 Main: 323.330.9900 www.worldpokertour.com Confidentiality Notice: This e-mail transmission (and/or the attachments accompanying) it may contain confidential information belonging to the sender which is protected. The information is intended only for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this information is prohibited. If you have received this transmission in error, please notify the sender by reply e-mail and destroy all copies of this transmission. > -Original Message- > From: Dan McCullough [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 15, 2006 10:22 AM > To: Shaunak Kashyap > Subject: Re: [PHP] date from -MM-DD to current date > > excellent, I was getting close, was getting hung up on a couple of things > > On 3/15/06, Shaunak Kashyap <[EMAIL PROTECTED]> wrote: > > // $pastDateStr = string representation of past date > > $pastDateTS = strtotime($pastDateStr); > > > > For ($currentDateTS = $pastDateTS; > >$currentDateTS <= strtotime("now"); > >$currentDateTS += (60 * 60 * 24)) { > > > >// use date() and $currentDateTS to format the dates in between > > > > } > > > > HTH, > > > > Shaunak Kashyap > > > > Senior Web Developer > > WPT Enterprises, Inc. > > 5700 Wilshire Blvd., Suite 350 > > Los Angeles, CA 90036 > > > > Direct: 323.330.9870 > > Main: 323.330.9900 > > > > www.worldpokertour.com > > > > Confidentiality Notice: This e-mail transmission (and/or the > > attachments accompanying) it may contain confidential information > > belonging to the sender which is protected. The information is intended > > only for the use of the intended recipient. If you are not the intended > > recipient, you are hereby notified that any disclosure, copying, > > distribution or taking of any action in reliance on the contents of this > > information is prohibited. If you have received this transmission in > > error, please notify the sender by reply e-mail and destroy all copies > > of this transmission. > > > > > > > -Original Message- > > > From: Dan McCullough [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, March 15, 2006 9:58 AM > > > To: php-general@lists.php.net > > > Subject: [PHP] date from -MM-DD to current date > > > > > > I need to loop from a date in the past to current date getting all > > > dates in between. Anyone have an idea on how to do that? > > > > > > -- > > > 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] date from YYYY-MM-DD to current date
// $pastDateStr = string representation of past date $pastDateTS = strtotime($pastDateStr); For ($currentDateTS = $pastDateTS; $currentDateTS <= strtotime("now"); $currentDateTS += (60 * 60 * 24)) { // use date() and $currentDateTS to format the dates in between } HTH, Shaunak Kashyap Senior Web Developer WPT Enterprises, Inc. 5700 Wilshire Blvd., Suite 350 Los Angeles, CA 90036 Direct: 323.330.9870 Main: 323.330.9900 www.worldpokertour.com Confidentiality Notice: This e-mail transmission (and/or the attachments accompanying) it may contain confidential information belonging to the sender which is protected. The information is intended only for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this information is prohibited. If you have received this transmission in error, please notify the sender by reply e-mail and destroy all copies of this transmission. > -Original Message- > From: Dan McCullough [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 15, 2006 9:58 AM > To: php-general@lists.php.net > Subject: [PHP] date from -MM-DD to current date > > I need to loop from a date in the past to current date getting all > dates in between. Anyone have an idea on how to do that? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date from YYYY-MM-DD to current date
I need to loop from a date in the past to current date getting all dates in between. Anyone have an idea on how to do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how do i select this list
THANKS THAT WORKED GREAT ""João Cândido de Souza Neto"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > $query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id > ORDER by points DESC, margin ASC "); > > Mark wrote: > >> The query below gives me a list of usernames with the highest point score >> at the top. There is also a secondary points list which i need to use to >> rank players if there POINTS are the same. >> >> ie: >> username points margin >> paul2624 >> mark 2311 >> john2310 >> >> I want to rank 'john above 'mark' as his margin points are lower. I can't >> rank by margin alone and i need ranking by points (Desc) first then by >> lowest margin. >> how can i change this statement below to achieve this. >> >> Thanks >> >> $query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id >> ORDER by points DESC "); > > -- > --- > João Cândido de Souza Neto > Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap_mail_compose not working
Hi All, function imap_mail_compose() not working on my server. This script: return only one line: --117491828-5973-1142442255=:332-- altouch when I run this script on another server it correctly return this: MIME-Version: 1.0 Content-Type: MULTIPART/mixed; BOUNDARY="-708698681-1804289383-1142442189=:14362" ---708698681-1804289383-1142442189=:14362 Content-Type: TEXT/plain; CHARSET=US-ASCII asdfjaskdfhjk ---708698681-1804289383-1142442189=:14362 Content-Type: TEXT/html; CHARSET=US-ASCII sdafjaasdjkjdfka ---708698681-1804289383-1142442189=:14362-- I am trying php4 and php5 on windows but with no success. Any ideas what may be wrong? regards Karel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Updating form
[snip] Does anyone know how to update an option list queried from a database table after an insert/delete action on that table? [/snip] We all do. :) Refresh the page. Although I suspect that you want the select list to update without refreshing the page. If that is the case you should explore AJAX -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Updating form
Does anyone know how to update an option list queried from a database table after an insert/delete action on that table? Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how do i select this list
$query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id ORDER by points DESC, margin ASC "); Mark wrote: > The query below gives me a list of usernames with the highest point score > at the top. There is also a secondary points list which i need to use to > rank players if there POINTS are the same. > > ie: > username points margin > paul2624 > mark 2311 > john2310 > > I want to rank 'john above 'mark' as his margin points are lower. I can't > rank by margin alone and i need ranking by points (Desc) first then by > lowest margin. > how can i change this statement below to achieve this. > > Thanks > > $query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id > ORDER by points DESC "); -- --- João Cândido de Souza Neto Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how do i select this list
The query below gives me a list of usernames with the highest point score at the top. There is also a secondary points list which i need to use to rank players if there POINTS are the same. ie: username points margin paul2624 mark 2311 john2310 I want to rank 'john above 'mark' as his margin points are lower. I can't rank by margin alone and i need ranking by points (Desc) first then by lowest margin. how can i change this statement below to achieve this. Thanks $query = mysql_query("SELECT * FROM leaderboard WHERE comp_id = $comp_id ORDER by points DESC "); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last array element not found
On 15/03/06, Roman Rumisek <[EMAIL PROTECTED]> wrote: > Hi, > > this code fragment give following result in my error log: > > foreach($reg_array as $region_item) > $tmp_reg_array[] = $region_item[0]; > $sel_region = explode(',', $_POST[CLIENT_REGION]); > foreach($sel_region as $sel_region_item) > if(!in_array($sel_region_item, $tmp_reg_array)) > { > my_error_log("Unknown region: $sel_region_item, region array: ". > var_export($tmp_reg_array, TRUE)); > header("Location: ". > get_error_result( > $state_def[$_SESSION[STATE_VAR]][STATE_REDIR_PAGE]) > ); > exit; > } It's more likely that you've got whitespace before or after the region, especially if it's the last in the list that's always failing. Try trimming the region before passing it to in_array(). Have you ever considered using braces around loop blocks? -robin
[PHP] Re: Last array element not found
Sorry, this is my bug. Roman Rumisek wrote: > Hi, > > this code fragment give following result in my error log: > > foreach($reg_array as $region_item) > $tmp_reg_array[] = $region_item[0]; > $sel_region = explode(',', $_POST[CLIENT_REGION]); > foreach($sel_region as $sel_region_item) > if(!in_array($sel_region_item, $tmp_reg_array)) > { > my_error_log("Unknown region: $sel_region_item, region array: ". > var_export($tmp_reg_array, TRUE)); > header("Location: ". > get_error_result( > $state_def[$_SESSION[STATE_VAR]][STATE_REDIR_PAGE]) > ); > exit; > } > > The result: > > [15-Mar-2006 15:29:25] 0# - client.php : 327:Unknown region: > 38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d83595a509, > region array: array ( > 0 => > '38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d833f01a86', > 1 => > '38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d8323627c2', > 2 => > '38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d83595a509', > ) > > Is it a bug of php ? > > Thanks > > Rumisek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [NEWBIE GUIDE] For the benefit of new users
[snip] Even the people who top post? *ducks* [/snip] ...you cannot be hit by someone who top posts. If you duck... You know what struck me as funny about this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [NEWBIE GUIDE] For the benefit of new users
Jay Blanchard wrote: And of course everyone that ever posted to php-general. Even the people who top post? *ducks* -- 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] Re: REG-EXPR: Allowing limited number of special chars in usernames
Holger Sunke wrote: Hello, I dont know that much aboput regular expressions and just want to know how to find out the number of special (non alphanumeric) characters in a string or how to match a string that contains less than 3 special chars. urrently im using a function function valid_username($string) { if(strlen($string)<=16&&strlen($string)>5) { return(preg_match('/^[ -~äöüßÄÖÜ]+$/',$string)); } else { return FALSE; } } This allows usernames of 6 to 16 length containing many special chars and German "Umlaute". But this also allows usernames like "=)/(&%$" what should not be. So how to limit the number of special chars? This function should just return fals if number of special chars > X Greets, Holger Sunke One thing that comes to my mind would be splitting up the string into letters, numbers and signs with ereg()/preg() and count each one. Greets Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REG-EXPR: Allowing limited number of special chars in usernames
Hello, I dont know that much aboput regular expressions and just want to know how to find out the number of special (non alphanumeric) characters in a string or how to match a string that contains less than 3 special chars. urrently im using a function function valid_username($string) { if(strlen($string)<=16&&strlen($string)>5) { return(preg_match('/^[ -~äöüßÄÖÜ]+$/',$string)); } else { return FALSE; } } This allows usernames of 6 to 16 length containing many special chars and German "Umlaute". But this also allows usernames like "=)/(&%$" what should not be. So how to limit the number of special chars? This function should just return fals if number of special chars > X Greets, Holger Sunke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [NEWBIE GUIDE] For the benefit of new users
= Please feel free to add more points and updates. 20050322jb - Note the new location of PHP Editors list. = Topics: === - Where to Find More Information - Diagnosing the problem. - Some Quick Guidelines on Posting - Contributors to this document Where to Find More Information === If you have any queries/problems about PHP, the online manual (you can get an offline copy as well) is a good tool to become familiar with. http://php.net/manual Some Key sections of the PHP Manual: - Installation and Configuration http://php.net/install - Language Reference http://php.net/langref - Function Reference http://php.net/funcref tip: if you know the function name but forget exactly how it works just type the name of the function ie: http://php.net/array_merge - The PHP FAQ http://php.net/faq Try http://www.google.com/ Searching for "php YOUR QUERY" may fetch you relevant information within the first 10 results. There is a searchable archive of the mailing list discussion at http://phparch.com/mailinglists. Many of the common topics are discussed repeatedly, and you may get answer to your query from the earlier discussions. For example: One of the repeatedly discussed question in the list is "Best PHP editor". Everyone has his/her favourite editor. You can get all the opinions by going through the list archives. If you want a chosen list try this link: [1] http://www.thelinuxconsultancy.co.uk/phpeditors.php Diagnosing the problem. == Not sure if PHP is working or you want find out what extensions are available to you? Or you're not sure exactly how php is configured? Just put the following code into a file with a .php extension and access it through your webserver: If PHP is installed you will see a page with a lot of information on it. If PHP is not installed (or not working correctly) your browser will try to download the file. One useful trick is to print the variable that you are having troubles with using print or echo command and check whether you get what you expected. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access users' computer related information (OS, screen size etc) using PHP. Nor can you modify any the user side settings. You need to go for JavaScript and ask the question in a JavaScript list. After diagnosing the problem, send the details of your efforts (following 'Where to find more information') and ask for help. Some Quick Guidelines on Posting === - Provide a clear descriptive subject line. Avoid general subjects like "Help!!", "A Question" etc. Especially avoid blank subjects. - Don't just state it doesn't work, be descriptive in why you don't think it works. - Don't send you're 200+ line script to the mailing list and expect an answer to why line 198 doesn't work. If you need to post a large amount of code, provide a link to a page that shows the code, or use a pastebin site like: http://www.pastebin.com/ - When you want to start a new topic, open a new mail composer and enter the mailing list address php-general@lists.php.net instead of replying to an existing thread and replacing the subject and body with your message. - When replying try to include the mailing list with the reply, unless of course it is personal. A common way is by using your email/news readers' "reply to all" functionality. - Compose your message in a format that everyone will be able to read. This means that it would be best to send your message in plain/text format. If you do send in HTML be sure to send your message that includes a plain/text format. - It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. - Ask smart questions http://catb.org/~esr/faqs/smart-questions.html - More on the traditional netiquette. Although the following suggestions have been known to be debatable they should help you in general internet mailing list a. Please do not top post as it is hard to follow. If you are unfamiliar with the concept it is the posting of the reply ABOVE the thing that is being replied to. b. When Replying. Where possible trim your posts so that only relevant portions of the message are being discussed. Replies that become too lengthy are likely to be ignored. Following these guidelines will ensure that you get effective responses from the list members. Otherwise, your questions might not be answered. Contributors to this document ===
Re: [PHP] Re: umlaut problem in firefox
My problem still remains open Help!!! I noticed that if the umlauts are received correctly but they are not submitted in the right way. For a ö I receive a POST as: ö From the DB I get the text correctly. The DB encoding is : iso-8859-1. Now, the strange thing is that is does not appear ALWAYS and only sometimes and only in firefox. So.. I cannot really reproduce the error every time which is hard to debug. As Barry said, the is a Unicode UTF-8 encoding. So, instead of charset=iso-8859-1 it should be charset=UTF-8 Then, I suggest you look-up the code-point of the character you want to use and remember that code-points (HEX) don't work in html (DEC), so you'll have to make that translation to display them. This link might help: http://robinv.pastebin.com/592400 HTH's tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] to check idle time of users
Miles, Please do not scare away people from the list. There can be many reasons why he asks this question without looking at the documentation first. 1: He/She is maybe new to this subject, and do not have a lot of experience with reading docs. 2: He/She maybe don't have English as mother language that will make manuals difficult to understand etc. In the beginning of my "life" in the PHP and web programming world, I found the docs extremely difficult to understand. You learn by doing, and this is maybe his way to start to learn. If you find this so "Fergawdsake", just ignore it, someone else might see this in a deeper way then you seem to do. You just reference to you knowledge, without being able to reference to others depth of knowledge. Miles, sit down and read your reply again, and you might learn something you too. Best regards, Peter Lauri PS! This post might not belong to the list, but I think it is important to address that we can not all be best, we are all at different levels and see problems different DS! -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 15, 2006 9:55 PM To: php Subject: Re: [PHP] to check idle time of users At 09:32 AM 3/15/2006, suresh kumar wrote: >in windows,if user idle for 1 minute,his desktop >screen is changed to screen saver.i like to implement >the same logic in my project if user is idle for 3 >minutes its session will have to automatically >destroy.i am waiting for or response. Fergawdsake - read the bloody manual!! Hint anything associated with "session" is a good place to start looking. You ask question after question that can be solved by checking the docs. Further hint - you're earning a rep for asking questions easily resolved from the docs. Two things can now happen: people will filter you out, or when you have a real problem it will not be looked at. And don't be so damned arrogant you end with "i am waiting for or (sic) reponse". No one on this list is another's servant. Regards - Miles -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006 -- 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] setcookie security concerns
An interesting question in this case is how to do an injection using cookies, injection attacks are generally performed using post & get data as they can be inserted to a link on another page. Getting a working exploit would probably come down to how the browser implemented the cookie security; who can set cookies where. Regardless, it's not worth the risk. Checking for valid values or using htmlentities to make the variable safe is a quick and simple solution. Getting into the practice of screening all user data either manually or using the input_filter extension will also save you from these problems in the future. David David: I thank you for your explanation. I experienced an injection attack on a php-form I wrote/provided where someone entered an incomplete html tag that created problems for the form. So, I realize the potential, I just don't know the scope of those types of problems and that was one of the reasons why I asked about this specific cookie issue. What could a hacker do by injecting whatever into a cookie that resides client-side on his computer? tedd ps: With the form, I solved it by using htmlentities -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Last array element not found
Hi, this code fragment give following result in my error log: foreach($reg_array as $region_item) $tmp_reg_array[] = $region_item[0]; $sel_region = explode(',', $_POST[CLIENT_REGION]); foreach($sel_region as $sel_region_item) if(!in_array($sel_region_item, $tmp_reg_array)) { my_error_log("Unknown region: $sel_region_item, region array: ". var_export($tmp_reg_array, TRUE)); header("Location: ". get_error_result( $state_def[$_SESSION[STATE_VAR]][STATE_REDIR_PAGE]) ); exit; } The result: [15-Mar-2006 15:29:25] 0# - client.php : 327:Unknown region: 38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d83595a509, region array: array ( 0 => '38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d833f01a86', 1 => '38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d8323627c2', 2 => '38579a8bd51c2d656450bc41360362f39fdc528eca7b98b1c05221c676a0ce278cf30109fa1cd9cb5453fb91242176d83595a509', ) Is it a bug of php ? Thanks Rumisek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hostname Filtering
The hostname lookup does not impact performance at all. I am only doing a look-up on the remote ip of the user not on my full blacklist. I am using this on a site to log hits to a banner ad and on listings on a ebay style marketplace. I log the IP and the hostname on a look- up. Dan T On Mar 14, 2006, at 11:30 AM, Philip Hallstrom wrote: I have a few PHP scripts where I log hit to a page i.e. IP and hostname via a look up. What I want to do is create essentially a blacklist to prevent bots and other hosts and IP from being logged and skewing my stats. My local IP/host and the MSN and Googlebot hits should not be in my stats or at least I can flag them to hide them. For example: $blacklist = array( '*.wavefront.ca', '*.googlebot.com', 'msnbot.msn.com', '*.inktomisearch.com', '68.146.96.245' ); So lets say I have my host: $host = 'lj602144.inktomisearch.com'; I want to quickly parse this array and return a simple boolean if I am in the blacklist. I could create a loop and cycle through the array valves and to a regex on each but I was hoping someone would have a more elegant solution. http://us3.php.net/in_array You might want to rethink things though... if you list hostnames you're going to have to do a DNS lookup for *every* request to that script. That's going to take some time. So you might want to log everything, then after the fact prune the results. Just be sure to use some sort of dns caching strategy... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] to check idle time of users
At 09:32 AM 3/15/2006, suresh kumar wrote: in windows,if user idle for 1 minute,his desktop screen is changed to screen saver.i like to implement the same logic in my project if user is idle for 3 minutes its session will have to automatically destroy.i am waiting for or response. Fergawdsake - read the bloody manual!! Hint anything associated with "session" is a good place to start looking. You ask question after question that can be solved by checking the docs. Further hint - you're earning a rep for asking questions easily resolved from the docs. Two things can now happen: people will filter you out, or when you have a real problem it will not be looked at. And don't be so damned arrogant you end with "i am waiting for or (sic) reponse". No one on this list is another's servant. Regards - Miles -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: to check idle time of users
suresh kumar wrote: in windows,if user idle for 1 minute,his desktop screen is changed to screen saver.i like to implement the same logic in my project if user is idle for 3 minutes its session will have to automatically destroy.i am waiting for or response. __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com ~ set php.ini session timeout ~ -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie security concerns
>> >> If this is the value directly from the cookie, it's an example of a >> cross-site scripting (XSS) vulnerability. >> >>> header("Location: $HTTP_REFERER"); >> >> >> This is an HTTP response splitting vulnerability, because the Referer >> header (like the Cookie header) is provided by the client. Future >> versions of PHP will not allow more than one header per header() call, >> but this has been possible until now. >> >> >>> 3. If so, what do I do to correct this? >> >> >> Don't trust any input without inspecting it first. In your case, this >> is particularly easy, because you can just make sure that the value is >> one of the few valid values. >> >> Hope that helps. >> >> Chris > > > Chris: > > Yes, it helps and I thank you for your comments. > > Your question: "It's not entirely clear from this example, but am I > correct in assuming that $thestyle is the same as $_COOKIE['thestyle'] > in this case? In other words, are you relying on register_globals or > assigning the value yourself?" > > The example is here: > > http://www.sperling.com/examples/styleswitch/ > > The complete php code (i.e., switch.php) is: > >setcookie ('thestyle', $set, time()+31536000, '/', '', 0); >header("Location: $HTTP_REFERER"); >?> > > And the value is assigned by the user via a click: > >Green or href="switch.php?set=style1">Red > > And, the style sheet is determined by: > > > > As such, I am expecting the user to provide the value of 'thestyle' via > his choice. > > However, let's say a malicious user would try to do something -- what > could he actually do? The user could insert arbitary HTML where you have the variable. For example they could insert: style1.css">...http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Printing library in PHP ?
robert mena wrote: Hi Manuel, I am trying to print from the client side. The client will be windows. Use ActiveX if you can get them to stick with IE (shouldn't be a problem). Google for 'ScriptX.cab' -- a free printing control that lets to fine tune printing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating a unique index ID
tedd wrote: Hey all, I've got a project where I'm taking form information from the user and writing records to several tables in a MySQL database. The problem I'm having is I need to write a unique number for the ID column of the records. Auto increment won't work because I could have conflicts due to replication of the database servers. Anyone have any techique they use for creating unique ID field entries in a db table? I was thinking maybe using a random 3 digit number and a unix timestamp? Jeff Jeff: Look into getmypid() and uniqid() or combine the two. How about using a DB abstraction layer that provides its own method of implementing sequences? Wouldn't this take away the auto_increment problem? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/Oracle : bug with accent...
David BERCOT wrote: Hi, I have a big problem with my Debian server (Apache 2, PHP 5, Oracle Instant Client). I've modified the environment variable NLS_LANG and, with SQL*Plus, everything is ok ! But, in a PHP page, I can't insert a value with accent (ex: Irène). I can read data with accent, but not inserting !!! I searched all the afternoon, testing many solutions, without success. I think I'm not alone with this problem but... Do you have any clue ? Something to look at ? Try looking at the multi-byte string functions. Not sure if that would help you or not though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] to check idle time of users
[snip] in windows,if user idle for 1 minute,his desktop screen is changed to screen saver.i like to implement the same logic in my project if user is idle for 3 minutes its session will have to automatically destroy.i am waiting for or response. [/snip] Wow dude, you really have never RTFM and don't want to, do you? http://www.php.net/session -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] to check idle time of users
in windows,if user idle for 1 minute,his desktop screen is changed to screen saver.i like to implement the same logic in my project if user is idle for 3 minutes its session will have to automatically destroy.i am waiting for or response. __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] please do my homework for me[was] Re: [PHP] string to integer conversion
suresh kumar wrote: i am facing one problem in type casting. $accno="2927"; $accno=$accno+1; its o/p is 2928. but i want output to be 2928.i am my h/t is g/d but if d/l is w/h then I w/s but only if it's g/v waiting response from u. from what I gather your always waiting for a response. here is a not so subtle hint: READ THE F***ING MANUAL AND SEARCH THE F***ING WEB. seeing as you know both the terms 'PHP' and 'type casting' you might consider starting off by using those as search terms - search terms are generally entered into what we like to call a search engine. here is a link to one just in case the concept is completely alien to you: http://yahoo.com/ and if your feeling really adventurous why not try writing a few lines of code to investigate the problem. e.g. php -r '$a = "000281";var_dump(($a + 1), ($a . 1), ($a . strval(1)));' OUTPUTS: int(282) string(7) "0002811" string(7) "0002811" __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP HOSTNAME environment variable poltergeist
Im having again a problem with hostname environment varible. Hostname is set OK and it is now shown in phpinfo(). But if I run "php -i" hostname is set! Any ideas? Php version: 5.1.2 Configure './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-gettext' '--with-pgsql' '--enable-track-vars' '--enable-force-cgi-redirect' '--with-mime-magic' Thanks in advance, Im completely lost. Any ideas will be appreciated. Note 1: I have another server (shold be exactly the same in configuracion, at least in apache and php _IS_ exactly the same) and hostname variable is shown in phpinfo. Note 2: hostname command and echo $HOSTNAME shows correctly hosname. Note 3: Php bug? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string to integer conversion
On 15/03/06, suresh kumar <[EMAIL PROTECTED]> wrote: > i am facing one problem in type casting. > $accno="2927"; > $accno=$accno+1; > its o/p is 2928. but i want output to be 2928.i am > waiting response from u. $accno = sprintf('%08d', $accno+1); -robin
[PHP] Re: string to integer conversion
Try this: $accno="2927"; $accno=substr("",0,(8-strlen($accno+1))).($accno+1); I don't test, but i hope it'll work fine. suresh kumar wrote: > i am facing one problem in type casting. > $accno="2927"; > $accno=$accno+1; > its o/p is 2928. but i want output to be 2928.i am > waiting response from u. > > > > __ > Yahoo! India Matrimony: Find your partner now. Go to > http://yahoo.shaadi.com -- --- João Cândido de Souza Neto Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] string to integer conversion
i am facing one problem in type casting. $accno="2927"; $accno=$accno+1; its o/p is 2928. but i want output to be 2928.i am waiting response from u. __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: umlaut problem in firefox
This is in the header. If I look at page info in firefox I get: text/html; charset=iso-8859-1. So the setted encoding is correct. The problem that I noticed is that the umlauts are displayed correctly but when I submit them in the POST or GET array I receive them modified. This happens on 2 different servers. The same behavior. Apache2 + php5. With php4 I didn't have this problem. The really stupid thing is that sometimes works well. Andy. - Original Message - From: "Barry" <[EMAIL PROTECTED]> To: Sent: Wednesday, March 15, 2006 11:21 AM Subject: Re: [PHP] Re: umlaut problem in firefox Andy wrote: My problem still remains open Help!!! I noticed that if the umlauts are received correctly but they are not submitted in the right way. For a ö I receive a POST as: ö From the DB I get the text correctly. The DB encoding is : iso-8859-1. Now, the strange thing is that is does not appear ALWAYS and only sometimes and only in firefox. So.. I cannot really reproduce the error every time which is hard to debug. -snip- POST as: ö -snap- This is Unicode UTF-8 encoding. If this error occours again check the following: added tag in HTML: If this is set check if the browser is set correctly: View -> charencoding/websitencoding Check if it is set to Western ISO 8859-1 check how it is given out in the sourcecode. check if there are entries which have an other kollation than the other entries. This is what i can think of. -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- 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] dynamic form
On 3/15/06, Mark <[EMAIL PROTECTED]> wrote: > Can anyone help to make this form dynamic, at hte moment a user picks a > round number from 1-22 but if that round is closed then sends them back to > this page. Anyway of making the form show the current round (as in sports > round fixtures) without adding another field to the table. > FIXTURES > > Field Type Null Default > id int(11) No > round char(2) No 0 > game int(11) No 0 > date text No > home text No > away text No > winner text No > draw text No > closed char(1) No 0 > comp_id int(11) No 0 > margin int(11) No 0 Get the current round the same way from your other question: $query = "select round from fixtures where comp_id='x' where closed='0' order by round asc limit 1"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $current_round = $row['round']; then use that to pre-select your dropdown list. -- 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] Re: umlaut problem in firefox
Andy wrote: My problem still remains open Help!!! I noticed that if the umlauts are received correctly but they are not submitted in the right way. For a ö I receive a POST as: ö From the DB I get the text correctly. The DB encoding is : iso-8859-1. Now, the strange thing is that is does not appear ALWAYS and only sometimes and only in firefox. So.. I cannot really reproduce the error every time which is hard to debug. -snip- POST as: ö -snap- This is Unicode UTF-8 encoding. If this error occours again check the following: added tag in HTML: If this is set check if the browser is set correctly: View -> charencoding/websitencoding Check if it is set to Western ISO 8859-1 check how it is given out in the sourcecode. check if there are entries which have an other kollation than the other entries. This is what i can think of. -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: umlaut problem in firefox
My problem still remains open Help!!! I noticed that if the umlauts are received correctly but they are not submitted in the right way. For a ö I receive a POST as: ö From the DB I get the text correctly. The DB encoding is : iso-8859-1. Now, the strange thing is that is does not appear ALWAYS and only sometimes and only in firefox. So.. I cannot really reproduce the error every time which is hard to debug. Regards. - Original Message - From: "Barry" <[EMAIL PROTECTED]> To: Sent: Friday, February 17, 2006 11:05 AM Subject: [PHP] Re: umlaut problem in firefox Andy wrote: Hi to all, I just reinstalled one of our servers last week, and I am noticing a wierd problem. On the old one was php4 running. Suse 9.1 OS. Everything worked very well. On the new one Suse 10. Php5. Only with firefox (sometimes and not always) and only on some computers the umlauts öäüüü characters are not displayed correctly and they are not submitted correctly to the system. Since then we have some strange problems with our application. Example: S�dbrookmerland instead of Südbrookmerland It seems like an encoding problem, but I really didn't figure it out untill now. Any ideeas??? Best Regards, Andy. This looks like a problem with your encoding. Have you added this to your HTML header? Do you get the Text out of the database? How is it encoded? Also you can use recode() to recode a string. http://de3.php.net/manual/en/function.recode-string.php Greets Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- 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