php-general Digest 27 Nov 2004 16:17:31 -0000 Issue 3137
php-general Digest 27 Nov 2004 16:17:31 - Issue 3137 Topics (messages 202928 through 202953): Re: Go Back Problem 202928 by: StDog just for test 202929 by: StDog Re: Running PHP as CGI 202930 by: Tim Traver Re: How does one get into programming? 202931 by: Rory Browne 202932 by: Jad Madi Re: mysql_connect vs mysql_pconnect 202933 by: Jad Madi 202936 by: fabien champel Re: Reg Jpgraph... 202934 by: Marek Kilimajer Lazy anwsers (WAS: mysql_connect vs mysql_pconnect) 202935 by: Bruno B B Magalhães Re: automatic responder 202937 by: partners.symbulos.com 202939 by: Alessandro Rosa 202941 by: Marek Kilimajer 202943 by: Octavian Rasnita identifying the country of the people who connect to web site / portal 202938 by: partners.symbulos.com 202940 by: Adrian Portsmouth 202949 by: Bruno B B Magalhães How to detect the prefered languages of Web-Clients? 202942 by: Michelle Konzack 202944 by: Marek Kilimajer 202945 by: Adrian Portsmouth 202946 by: Michelle Konzack 202947 by: Michelle Konzack 202948 by: Marek Kilimajer 202950 by: Michelle Konzack 202951 by: Marek Kilimajer 202952 by: Gerhard Meier Comment Speed 202953 by: Bruno B B Magalhães Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- 27 2004 04:59 Cyrus (a): Dear All, I have a problem of back to the previous page in php. I need to create a form let people to fill in .It can let user to preview the form, if information is not correct , user can back to previous page and correct it, I have used the javascript : OnClick='history.go(-1)' and OnClick='history.back()' in php , but it can not workspls help me. Thanks and Regards, Cyrus Chan you must store return point samewhere. f.e. in hidden area in your form, or in $_SESSION array ---End Message--- ---BeginMessage--- testing ---End Message--- ---BeginMessage--- I guess what I'm really asking is do the php_admin environment variables that can get set in Apache get passed to the CGI version of php when called as a CGI ? Tim. Curt Zirzow wrote: * Thus wrote Tim Traver: Hi all, In the quest to secure php script running, I am starting to think about running php as a cgi instead of through the module. I generally set the open_basedir directory within the apache configuration file for individual hosts. If I ran php as a CGI, would that directive still be in effect ? or do I have to set that in a php.ini file that is specific for that virtual host ? The directive will be effectve for which ever apache's Directory direcve applies, other wise the setting to the default directory will be used. php in general, has no clue about virtual hosts. This is rather a appache issue. Curt ---End Message--- ---BeginMessage--- Since this is a PHP list I'm assuming that you want to learn php programming. That being the case, I'd suggest that you first of all go to the PHP website and download the manual. You don't get better docs than the PHP docs, and they are an excellent learning resource for PHP. PHP is a good language to start off with, because (a) it's relitively easy, (b), it borrows syntax from C, and Perl, both of which you should consider as well if you are serious about programming. Both PHP and Java borrow syntax from C, and since php5 borrows its object model, from Java, PHP5 will be a great help for you if/when you decide to learn java. Having that said, I'd suggest you consider Python as well, it's a simple powerful Object Oriented language, that's easy to learn. Due to its emphasis on whitespace, as part of its syntax, it is also easy to read, something that can't really be said in general for C/Java/PHP, and certainly can't be said for Perl(note that it is possible to write readable code in Perl, but not very common). For a beginer to programming I'd read up on C, Java, Perl, and PHP, decide which one you want to start with, and jump in. On Thu, 25 Nov 2004 15:18:16 +0200, Ewald [EMAIL PROTECTED] wrote: I've been in IT for about 12 years and is looking to change my direction to programming. Can anyone direct me in the right direction as to what to study or where to start??? Thx Ewald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Well said Rory Browne after that I recommend downloading some php scripts and start reading their codes and understanding the programming design style.. On Thu, 25 Nov 2004 15:18:16 +0200, Ewald [EMAIL PROTECTED] wrote: I've been in IT for about 12 years and is
Re: [PHP] How does one get into programming?
Since this is a PHP list I'm assuming that you want to learn php programming. That being the case, I'd suggest that you first of all go to the PHP website and download the manual. You don't get better docs than the PHP docs, and they are an excellent learning resource for PHP. PHP is a good language to start off with, because (a) it's relitively easy, (b), it borrows syntax from C, and Perl, both of which you should consider as well if you are serious about programming. Both PHP and Java borrow syntax from C, and since php5 borrows its object model, from Java, PHP5 will be a great help for you if/when you decide to learn java. Having that said, I'd suggest you consider Python as well, it's a simple powerful Object Oriented language, that's easy to learn. Due to its emphasis on whitespace, as part of its syntax, it is also easy to read, something that can't really be said in general for C/Java/PHP, and certainly can't be said for Perl(note that it is possible to write readable code in Perl, but not very common). For a beginer to programming I'd read up on C, Java, Perl, and PHP, decide which one you want to start with, and jump in. On Thu, 25 Nov 2004 15:18:16 +0200, Ewald [EMAIL PROTECTED] wrote: I've been in IT for about 12 years and is looking to change my direction to programming. Can anyone direct me in the right direction as to what to study or where to start??? Thx Ewald -- 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] How does one get into programming?
Well said Rory Browne after that I recommend downloading some php scripts and start reading their codes and understanding the programming design style.. On Thu, 25 Nov 2004 15:18:16 +0200, Ewald [EMAIL PROTECTED] wrote: I've been in IT for about 12 years and is looking to change my direction to programming. Can anyone direct me in the right direction as to what to study or where to start??? Thx Ewald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Web standards Planet http://www.w3planet.info/ Personal Blogger http://www.EasyHTTP.com/jad/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect vs mysql_pconnect
http://www.google.com/search?lr=ie=UTF-8oe=UTF-8q=mysql_connect%20vs%20mysql_pconnect On Fri, 26 Nov 2004 19:55:29 +0100, fabien champel [EMAIL PROTECTED] wrote: hello, I do not know when I must use mysql_pconnect instead of the mysql_connect :( what are the real advantages of persistent connections, please ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Web standards Planet http://www.w3planet.info/ Personal Blogger http://www.EasyHTTP.com/jad/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reg Jpgraph...
Sagar C Nannapaneni wrote: Hi all, I think I shouldnt post this here...but i didnt find proper support at the jpgraph forums. I'm using PHP 4.3.9 with GDK precompiled on apache2 using win2k. When i open any of the jpgraph example files its giving me an error saying IE cannot find the site your are requesting. But when i remove some code in the example file and refresh the page its working and when i put the deleted code again back in that file and refresh its displaying the graph. When i close and open a fresh browser the same problem persisting. Couldnt find what might be the problem. Again ...i'm sorry for posting this topic here... /sagar More details. What did you remove, request method, are you using sessions. ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Lazy anwsers (WAS: mysql_connect vs mysql_pconnect)
Hey Guys, I don´t know if anyone agrees with me, but I really dismiss this kind of comment: http://www.google.com/search?q=mysqlie=UTF-8oe=UTF-8 In fact, before I ask anything in this forum, I do search others sources (including google, phpbuilder, phpfreaks, sf.net, ,php.net,...) and I believe that others do too. So I think that this is the worst kind of comment or suggestion someone can receive. Sorry everybody. Regards, Bruno B B Magalhães -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect vs mysql_pconnect
ok, i'm sorry, i was probably too tired. i've search the doc, but didn't found this page : http://www.php.net/manual/en/features.persistent-connections.php will me excuse me ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: automatic responder
Alessandro Rosa wrote: How about coding an automatic responder via PHP ? Anybody ever done that using qmail? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] identifying the country of the people who connect to web site / portal
We would like to identify the country of the people who connect to our website / portal using php. The idea is to provide them directly with the homepage in their language. Is that possible? Has anybody ever doen anything like that using php? We are using php 4.3.x on a Debian server (stable, with some tweaking). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] automatic responder
Thank you for all responses about this topic. I would also solve a more practical doubt finally: if I use for example the PHP code 'POP3class', as suggested by Manuel Lemos, it's implicitly meant that it should run periodically on a web-server (for example, under a timer of a given number of seconds), don't you? Example: check pop3 mailbox every 5 secs by php code and then perform all the required actions. Alessandro Rosa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] identifying the country of the people who connect to web site / portal
Hi, I believe you can detect via the browser settings which language the user is using and then display the correct page depending on this. The PHP.net web site itself does this in some form whether or not by my suggested method I do not know, but it uses some form of detection to direct the user to the appropriate mirror web site. HTH Adrian Portsmouth .htaccess Manager - SilkPHP [e] [EMAIL PROTECTED] [w] www.htaccessmanager.com This email, its contents and attachments are confidential and may be covered by legal privilege. This email contains information intended only for the person(s) and/or entity named above. The views and opinions expressed are those of the sender and not necessarily those of SilkPHP or its affiliates. Any other distribution, copying, review, use or disclosure is strictly prohibited. If you are not the intended recipient, please delete this message and any attachments without making a copy and advise the sender by return email - thank you. This mail and any attachments have been scanned for viruses prior to leaving the SilkPHP network. SilkPHP will not be liable for direct, special, indirect or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 27 November 2004 12:36 To: [EMAIL PROTECTED] Subject: [PHP] identifying the country of the people who connect to web site / portal We would like to identify the country of the people who connect to our website / portal using php. The idea is to provide them directly with the homepage in their language. Is that possible? Has anybody ever doen anything like that using php? We are using php 4.3.x on a Debian server (stable, with some tweaking). -- 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] automatic responder
Alessandro Rosa wrote: Thank you for all responses about this topic. I would also solve a more practical doubt finally: if I use for example the PHP code 'POP3class', as suggested by Manuel Lemos, it's implicitly meant that it should run periodically on a web-server (for example, under a timer of a given number of seconds), don't you? Example: check pop3 mailbox every 5 secs by php code and then perform all the required actions. Yes, but perhaps every 5 minutes. You have to solve this too, either cron job if you have it available or it can be trigered by user http requests (not very reliable). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to detect the prefered languages of Web-Clients?
Hello, I was reading the book Programming PHP (O'Reilly) and searching the PHP docs but have not found the answer, how to get the Web-Clients prefered Languages. I was thinking it is in the $_SERVER Variable but nothing. Thanks Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] automatic responder
You just need to get the HTTP_ACCEPT_LANGUAGE environment variable and see the order of the prefered languages. After that, you see if you have a translation for the first language, if the site doesn't have it, try for the next language, and so on. Teddy - Original Message - From: Alessandro Rosa [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 27, 2004 3:14 PM Subject: [PHP] automatic responder Thank you for all responses about this topic. I would also solve a more practical doubt finally: if I use for example the PHP code 'POP3class', as suggested by Manuel Lemos, it's implicitly meant that it should run periodically on a web-server (for example, under a timer of a given number of seconds), don't you? Example: check pop3 mailbox every 5 secs by php code and then perform all the required actions. Alessandro Rosa -- 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] How to detect the prefered languages of Web-Clients?
Michelle Konzack wrote: Hello, I was reading the book Programming PHP (O'Reilly) and searching the PHP docs but have not found the answer, how to get the Web-Clients prefered Languages. I was thinking it is in the $_SERVER Variable but nothing. Thanks Michelle You were not looking well, or your browser did not send it. $_SERVER['HTTP_ACCEPT_LANGUAGE'] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to detect the prefered languages of Web-Clients?
Hi Michelle, I believe you can detect it from the $_SERVER['HTTP_ACCEPT_LANGUAGE'] superglobal. There is a good thread on this topic at: http://forums.postnuke.com/index.php?name=PNphpBB2file=viewtopict=32841 Which might be of assistance to you. Adrian Portsmouth .htaccess Manager - SilkPHP [e] [EMAIL PROTECTED] [w] www.htaccessmanager.com This email, its contents and attachments are confidential and may be covered by legal privilege. This email contains information intended only for the person(s) and/or entity named above. The views and opinions expressed are those of the sender and not necessarily those of SilkPHP or its affiliates. Any other distribution, copying, review, use or disclosure is strictly prohibited. If you are not the intended recipient, please delete this message and any attachments without making a copy and advise the sender by return email - thank you. This mail and any attachments have been scanned for viruses prior to leaving the SilkPHP network. SilkPHP will not be liable for direct, special, indirect or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on. -Original Message- From: Michelle Konzack [mailto:[EMAIL PROTECTED] Sent: 27 November 2004 13:30 To: [EMAIL PROTECTED] Subject: [PHP] How to detect the prefered languages of Web-Clients? Hello, I was reading the book Programming PHP (O'Reilly) and searching the PHP docs but have not found the answer, how to get the Web-Clients prefered Languages. I was thinking it is in the $_SERVER Variable but nothing. Thanks Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to detect the prefered languages of Web-Clients?
Hello Marek, Am 2004-11-27 14:46:20, schrieb Marek Kilimajer: Michelle Konzack wrote: Hello, I was reading the book Programming PHP (O'Reilly) and searching the PHP docs but have not found the answer, how to get the Web-Clients prefered Languages. I was thinking it is in the $_SERVER Variable but nothing. Thanks Michelle You were not looking well, or your browser did not send it. Not right, because curently I have only Mailaccess to the Internet and browsing http://www.php.net/ with Lynx is a horror. The book Programming PHP (O'Reilly) is from Marchg 2002 and between the Pages 160-162 (Server Informations) there is no description of it. $_SERVER['HTTP_ACCEPT_LANGUAGE'] Thanks and now it works... Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: How to detect the prefered languages of Web-Clients?
Hello Adrian, Am 2004-11-27 13:52:30, schrieb Adrian Portsmouth: Hi Michelle, I believe you can detect it from the $_SERVER['HTTP_ACCEPT_LANGUAGE'] superglobal. There is a good thread on this topic at: http://forums.postnuke.com/index.php?name=PNphpBB2file=viewtopict=32841 Curenly I can only access the web with 'lynx' and do you have already tried it with ? - It is a nightmare... Which might be of assistance to you. Maybe with Windows but not on a Linux console which is my second home for many years. Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Re: Re: How to detect the prefered languages of Web-Clients?
Am 2004-11-27 15:27:29, schrieb Marek Kilimajer: Yes, I was using lynx as my main browser for about 2 years at my school :-) (windows machines were always taken). This makes you an Hard-Core Console $USER :-) I use lynx since DOS... Have you tried links? Yes, but not found the right answer... And then some links in the php.net site are broken... Have tried to download the php_manual_en.html.gz from a French mirror and gotten a Server Parse Error. fr.php.net is working... Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Re: Re: How to detect the prefered languages of Web-Clients?
Michelle Konzack wrote: Have you tried links? Yes, but not found the right answer... And then some links in the php.net site are broken... Have tried to download the php_manual_en.html.gz from a French mirror and gotten a Server Parse Error. fr.php.net is working... I meant links browser :-) http://links.sourceforge.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How to detect the prefered languages of Web-Clients?
Michelle Konzack wrote: Hello Marek, Am 2004-11-27 14:46:20, schrieb Marek Kilimajer: Michelle Konzack wrote: Hello, I was reading the book Programming PHP (O'Reilly) and searching the PHP docs but have not found the answer, how to get the Web-Clients prefered Languages. I was thinking it is in the $_SERVER Variable but nothing. Thanks Michelle You were not looking well, or your browser did not send it. Not right, because curently I have only Mailaccess to the Internet and browsing http://www.php.net/ with Lynx is a horror. Yes, I was using lynx as my main browser for about 2 years at my school :-) (windows machines were always taken). Have you tried links? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] identifying the country of the people who connect to web site / portal
Hi, course you can, you should search harder for it, but I will facilitate for you! :o) http://www.phpclasses.org/browse/package/1477.html Best Regards, Bruno B B Magalhães -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How to detect the prefered languages of Web-Clients?
On Sat, Nov 27, 2004 at 03:20:45PM +0100, Michelle Konzack wrote: Curenly I can only access the web with 'lynx' and do you have already tried it with ? - It is a nightmare... There is a lynx friendly version of the documentation at http://www.php.net/manual/en/print/index.php /GM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comment Speed
Does anyone has a solid benchmark about comments speed.. I mean, too many comments will decrease speed of the PHP scripts... I've tried without success using a class, and also a simple micro-time operation... Well, cause the file is evaluated before it is executed, I didn't had success. Any idea? Regards, Bruno B B Magalhaes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Random number generation and phpBB search IDs
Hi, I'm currently experiencing a problem with a phpBB board that appears to be due to the way random number generation works in PHP. I have posted on serveral phpBB boards and have received no answers, so I think I need to understand how PHP is dealing with this in order to resolve it. phpBB generates a unique index for search results using the following code (in search.php): - 8 - Code - 8 - mt_srand ((double) microtime() * 100); $search_id = mt_rand(); - 8 - Code - 8 - The problem is that the seed is generated from the system clock, and if two people search at the exact same moment (or more strictly, if the mt_srand statements get executed at the exact same moment), the random number generation system is initialised with the same seed in each case, so both searches receive the same $search_id, resulting in a MySQL error due to non-unique index fields. Looking through the documentation for PHP, it seems that versions 4.2.0 do not require the use of mt_srand as they will seed themselves when required. I've had a look at the PHP source code, and from my limited understanding, the seed appears to be generated using a function in php_rand.h: - 8 - Code - 8 - #define GENERATE_SEED() ((long) (time(0) * getpid() * 100 * php_combined_lcg(TSRMLS_C))) - 8 - Code - 8 - So this is still based to some extent on the current system clock, and the php_combined_lcg function in lcg.c also appears to rely on the current system clock along with the current process/thread ID. There is also some code to ensure that seeding only occurs once. But is this once per thread? Once per process? Once per something-else? What I'm trying to find out is whether this new seeding system will produce the same 'random' number if two mt_rand() statements are executing concurrently. My guess is that they won't, but I don't understand the internals of PHP or Apache well enough to know if their use of threads and processes will ensure uniqueness. The problem is occuring with PHP 4.3.9 running under Apache 1.3.33 on Linux kernel 2.4.26 (on a fairly typical cPanel-based shared hosting box). Unfortunately due to the timing-based nature of the problem, it has proven very difficult to set up test cases. I'd be very grateful for any assistance. Gordon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comment Speed
Bruno B B Magalhães wrote: Does anyone has a solid benchmark about comments speed.. I mean, too many comments will decrease speed of the PHP scripts... I've tried without success using a class, and also a simple micro-time operation... Well, cause the file is evaluated before it is executed, I didn't had success. Any idea? include() the file you want to time -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comment Speed
On Sat, 2004-11-27 at 11:13, Bruno B B Magalhães wrote: Does anyone has a solid benchmark about comments speed.. I mean, too many comments will decrease speed of the PHP scripts... I've tried without success using a class, and also a simple micro-time operation... Well, cause the file is evaluated before it is executed, I didn't had success. Any idea? Regards, Bruno B B Magalhaes Under Linux you can use the time command... but comments are parsed out EXTREMELY fast and are generally negligible, even if you have a lot. Also, a nice accelerator will assuage all your worries since the comments won't be encountered after the cache is created. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: Re: How to detect the prefered languages of Web-Clients?
Am 2004-11-27 16:50:21, schrieb Marek Kilimajer: I meant links browser :-) :-) http://links.sourceforge.net/ [EMAIL PROTECTED]:/~ su root -- apt-get install links-ssl [EMAIL PROTECTED]:/~ links http://www.php.net/ Mayby I should use links :-) TABLE support :-) Thanks and nice evening Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Random number generation and phpBB search IDs
Apologies, my mail client was supposed to line-wrap that for me - Hi, I'm currently experiencing a problem with a phpBB board that appears to be due to the way random number generation works in PHP. I have posted on serveral phpBB boards and have received no answers, so I think I need to understand how PHP is dealing with this in order to resolve it. phpBB generates a unique index for search results using the following code (in search.php): - 8 - Code - 8 - mt_srand ((double) microtime() * 100); $search_id = mt_rand(); - 8 - Code - 8 - The problem is that the seed is generated from the system clock, and if two people search at the exact same moment (or more strictly, if the mt_srand statements get executed at the exact same moment), the random number generation system is initialised with the same seed in each case, so both searches receive the same $search_id, resulting in a MySQL error due to non-unique index fields. Looking through the documentation for PHP, it seems that versions 4.2.0 do not require the use of mt_srand as they will seed themselves when required. I've had a look at the PHP source code, and from my limited understanding, the seed appears to be generated using a function in php_rand.h: - 8 - Code - 8 - #define GENERATE_SEED() ((long)(time(0) * getpid() * 100 \ * php_combined_lcg(TSRMLS_C))) - 8 - Code - 8 - So this is still based to some extent on the current system clock, and the php_combined_lcg function in lcg.c also appears to rely on the current system clock along with the current process/thread ID. There is also some code to ensure that seeding only occurs once. But is this once per thread? Once per process? Once per something-else? What I'm trying to find out is whether this new seeding system will produce the same 'random' number if two mt_rand() statements are executing concurrently. My guess is that they won't, but I don't understand the internals of PHP or Apache well enough to know if their use of threads and processes will ensure uniqueness. The problem is occuring with PHP 4.3.9 running under Apache 1.3.33 on Linux kernel 2.4.26 (on a fairly typical cPanel-based shared hosting box). Unfortunately due to the timing-based nature of the problem, it has proven very difficult to set up test cases. I'd be very grateful for any assistance. Gordon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random number generation and phpBB search IDs
Gordon McKeown wrote: Apologies, my mail client was supposed to line-wrap that for me - Hi, I'm currently experiencing a problem with a phpBB board that appears to be due to the way random number generation works in PHP. I have posted on serveral phpBB boards and have received no answers, so I think I need to understand how PHP is dealing with this in order to resolve it. phpBB generates a unique index for search results using the following code (in search.php): - 8 - Code - 8 - mt_srand ((double) microtime() * 100); $search_id = mt_rand(); - 8 - Code - 8 - The problem is that the seed is generated from the system clock, and if two people search at the exact same moment (or more strictly, if the mt_srand statements get executed at the exact same moment), the random number generation system is initialised with the same seed in each case, so both searches receive the same $search_id, resulting in a MySQL error due to non-unique index fields. Looking through the documentation for PHP, it seems that versions 4.2.0 do not require the use of mt_srand as they will seed themselves when required. I've had a look at the PHP source code, and from my limited understanding, the seed appears to be generated using a function in php_rand.h: - 8 - Code - 8 - #define GENERATE_SEED() ((long)(time(0) * getpid() * 100 \ * php_combined_lcg(TSRMLS_C))) - 8 - Code - 8 - no need to look as far inside as that... :) So this is still based to some extent on the current system clock, and the php_combined_lcg function in lcg.c also appears to rely on the current system clock along with the current process/thread ID. There is also some code to ensure that seeding only occurs once. But is this once per thread? Once per process? Once per something-else? per process What I'm trying to find out is whether this new seeding system will produce the same 'random' number if two mt_rand() statements are executing concurrently. My guess is that they won't, but I don't understand the internals of PHP or Apache well enough to know if their use of threads and processes will ensure uniqueness. Comment out the seeding if you're using PHP 4.2.0+ and it'll work fine. (mt_srand function, not the mt_rand one!) The problem is occuring with PHP 4.3.9 running under Apache 1.3.33 on Linux kernel 2.4.26 (on a fairly typical cPanel-based shared hosting box). Unfortunately due to the timing-based nature of the problem, it has proven very difficult to set up test cases. I'd be very grateful for any assistance. Gordon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Random number generation and phpBB search IDs
Use a database query to verify the random number has not been used before. $number_checker = 1; while ($number_checker != 0){ #insert your $random_number code $query = SELECT COUNT(*) AS total FROM some_table WHERE random_number_field = '$random_number'; $result = mysql_query($query); $number_checker = mysql_result($result, 0, total); } If this is in fact a bug (not likely) and it gets past this too, then wow start using auto increment or something? Best, Thomas S. Crum -Original Message- From: Gordon Mckeown [mailto:[EMAIL PROTECTED] Sent: Saturday, November 27, 2004 11:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Random number generation and phpBB search IDs Hi, I'm currently experiencing a problem with a phpBB board that appears to be due to the way random number generation works in PHP. I have posted on serveral phpBB boards and have received no answers, so I think I need to understand how PHP is dealing with this in order to resolve it. phpBB generates a unique index for search results using the following code (in search.php): - 8 - Code - 8 - mt_srand ((double) microtime() * 100); $search_id = mt_rand(); - 8 - Code - 8 - The problem is that the seed is generated from the system clock, and if two people search at the exact same moment (or more strictly, if the mt_srand statements get executed at the exact same moment), the random number generation system is initialised with the same seed in each case, so both searches receive the same $search_id, resulting in a MySQL error due to non-unique index fields. Looking through the documentation for PHP, it seems that versions 4.2.0 do not require the use of mt_srand as they will seed themselves when required. I've had a look at the PHP source code, and from my limited understanding, the seed appears to be generated using a function in php_rand.h: - 8 - Code - 8 - #define GENERATE_SEED() ((long) (time(0) * getpid() * 100 * php_combined_lcg(TSRMLS_C))) - 8 - Code - 8 - So this is still based to some extent on the current system clock, and the php_combined_lcg function in lcg.c also appears to rely on the current system clock along with the current process/thread ID. There is also some code to ensure that seeding only occurs once. But is this once per thread? Once per process? Once per something-else? What I'm trying to find out is whether this new seeding system will produce the same 'random' number if two mt_rand() statements are executing concurrently. My guess is that they won't, but I don't understand the internals of PHP or Apache well enough to know if their use of threads and processes will ensure uniqueness. The problem is occuring with PHP 4.3.9 running under Apache 1.3.33 on Linux kernel 2.4.26 (on a fairly typical cPanel-based shared hosting box). Unfortunately due to the timing-based nature of the problem, it has proven very difficult to set up test cases. I'd be very grateful for any assistance. Gordon. -- 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] Random number generation and phpBB search IDs
Many thanks Thomas and Maciek. I'll try removing mt_srand to start with, and if that doesn't work out I'll put in the uniqueness check. Cheers, Gordon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHPmysqladmin
Where can you get PHPmysqladmin? I would like to load it on my test server to make updating and entering Mysql data easier. Thanks for your help! Tim
RE: [PHP] PHPmysqladmin
http://www.phpmyadmin.net/home_page/downloads.php -R. Van Tassel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, November 27, 2004 1:27 PM To: PHP general Subject: [PHP] PHPmysqladmin Where can you get PHPmysqladmin? I would like to load it on my test server to make updating and entering Mysql data easier. Thanks for your help! Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHPmysqladmin
What about looking for yourself? http://www.google.com/search?hl=enlr=q=phpmyadmin -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 27. November 2004 19:27 An: PHP general Betreff: [PHP] PHPmysqladmin Where can you get PHPmysqladmin? I would like to load it on my test server to make updating and entering Mysql data easier. Thanks for your help! Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPmysqladmin
On Sunday 28 November 2004 02:27, [EMAIL PROTECTED] wrote: Where can you get PHPmysqladmin? I would like to load it on my test server to make updating and entering Mysql data easier. I believe it's called phpMyAdmin now. google for it. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* HAL 9000: Dave. Put down those Windows disks, Dave. DAVE! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bad PHP error
Hi all, I have tried the following script: $val = 100; if (is_int($val)) { echo $val; } else { echo $val is not an integer\n; } The answer is: 100 is not an integer. Why does this happen? I use PHP 5. Isn't PHP able to work with values like 10 billion? Do I need to use a certain special class for dealing with big numbers? How can I use that class? Thank you. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bad PHP error
Octavian Rasnita wrote: Hi all, I have tried the following script: $val = 100; if (is_int($val)) { echo $val; } else { echo $val is not an integer\n; } The answer is: 100 is not an integer. Why does this happen? I use PHP 5. Isn't PHP able to work with values like 10 billion? Do I need to use a certain special class for dealing with big numbers? How can I use that class? Thank you. Teddy reply it's treated as a double since integers have a max value of (-2e32 +1 up to) 2e32-1, which is 4,294,967,296 (4 billion and some). However, you shouldn't really see any difference in working, it's just treated as a double inside (a double float, that is). Which means it'll be written like 1.0e10 internally -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
M. Sokolewicz wrote: Octavian Rasnita wrote: Hi all, I have tried the following script: $val = 100; if (is_int($val)) { echo $val; } else { echo $val is not an integer\n; } The answer is: 100 is not an integer. Why does this happen? I use PHP 5. Isn't PHP able to work with values like 10 billion? Do I need to use a certain special class for dealing with big numbers? How can I use that class? Thank you. Teddy reply it's treated as a double since integers have a max value of (-2e32 +1 up to) 2e32-1, which is 4,294,967,296 (4 billion and some). This would be for unsigned integers. PHP knows only signed integers, however. So the limit is 2147483648 However, you shouldn't really see any difference in working, it's just treated as a double inside (a double float, that is). Which means it'll be written like 1.0e10 internally -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Ok, I understand. But what can I do if I want to print big numbers like 123 billion? (but real numbers, not those written with the E letter in them? Is this possible with PHP or I need to do it with another language? Thank you. Teddy From: M. Sokolewicz [EMAIL PROTECTED] Octavian Rasnita wrote: Hi all, I have tried the following script: $val = 100; if (is_int($val)) { echo $val; } else { echo $val is not an integer\n; } The answer is: 100 is not an integer. Why does this happen? I use PHP 5. Isn't PHP able to work with values like 10 billion? Do I need to use a certain special class for dealing with big numbers? How can I use that class? Thank you. Teddy reply it's treated as a double since integers have a max value of (-2e32 +1 up to) 2e32-1, which is 4,294,967,296 (4 billion and some). However, you shouldn't really see any difference in working, it's just treated as a double inside (a double float, that is). Which means it'll be written like 1.0e10 internally -- 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] Re: Bad PHP error
Marek Kilimajer wrote: This would be for unsigned integers. PHP knows only signed integers, however. So the limit is 2147483648 Good point :) When you're outputting it, PHP will convert it back to a string, using the normal integer representation (which is stored aswell). So that should be fine ;) - Tul Octavian Rasnita wrote: Ok, I understand. But what can I do if I want to print big numbers like 123 billion? (but real numbers, not those written with the E letter in them? Is this possible with PHP or I need to do it with another language? Thank you. Teddy From: M. Sokolewicz [EMAIL PROTECTED] Octavian Rasnita wrote: Hi all, I have tried the following script: $val = 100; if (is_int($val)) { echo $val; } else { echo $val is not an integer\n; } The answer is: 100 is not an integer. Why does this happen? I use PHP 5. Isn't PHP able to work with values like 10 billion? Do I need to use a certain special class for dealing with big numbers? How can I use that class? Thank you. Teddy reply it's treated as a double since integers have a max value of (-2e32 +1 up to) 2e32-1, which is 4,294,967,296 (4 billion and some). However, you shouldn't really see any difference in working, it's just treated as a double inside (a double float, that is). Which means it'll be written like 1.0e10 internally -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fedora core 3 mail() not working from web
Thanks Curt. I decided after a while to chalk this up as incomplete installation of Fedora Core 3, and just removed the Apache-PHP-MySQL RPMs and replaced them with their sources. I compiled them and now everything works! NOTE: Since re-installing those three fixed the problem, there was no issue with Sendmail, probably just with PHP/Apache. - Original Message - From: Curt Zirzow [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Thursday, November 25, 2004 2:54 PM Subject: Re: [PHP] fedora core 3 mail() not working from web * Thus wrote Minuk Choi: hey gang, I have a fedora core 3, with standard PHP and MySQL included with the distribution. I'm having a rather odd problem. the following script(mailTest.php) ?PHP $result = mail('[EMAIL PROTECTED]', 'test subject', 'test message'); if (!$result) echo FAILURE; else echo SUCCESS; ? does NOT work if I access it from the web BUT if I were to execute it as root on the Command prompt php mailTest.php It executes correctly and I get mail. This feels like the apache user is lacking access over sendmail or something... since as root I can execute the script from the CLI without a problem, but from the web, I get a failure. You're probably on the right track with this. Check your php.ini settings for sendmail_path. Also.. the default setting for sendmail_path is 'sendmail -t -i' so if sendmail isn't in the path for your webuser then it wont get executed. To fix this, specifiy in you php.ini with the sendmail_path the absolute sendmail executable. ie: sendmail_path = /usr/sbin/sendmail -t -i HTH, Curt -- Quoth the Raven, Nevermore. -- 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] fedora core 3 mail() not working from web
The weirdest thing was that there was NO error message. Even though in the php.ini, I set the error reporting to E_ALL, I got no warnings, notices, or failures. I removed the RPMs and compiled the sources and now they work... so I guess the problem was due to a incomplete installation of those RPMs off the Fedora Core 3 CDs... - Original Message - From: Angelo Zanetti [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, November 26, 2004 7:50 AM Subject: Re: [PHP] fedora core 3 mail() not working from web Hi, It could have something to do with your PHP.ini file?? Can you post the error message, as it will give us a better idea of what could be wrong. Angelo Minuk Choi [EMAIL PROTECTED] 11/26/2004 10:31:59 AM hey gang, I have a fedora core 3, with standard PHP and MySQL included with the distribution. I'm having a rather odd problem. the following script(mailTest.php) ?PHP $result = mail('[EMAIL PROTECTED]', 'test subject', 'test message'); if (!$result) echo FAILURE; else echo SUCCESS; ? does NOT work if I access it from the web BUT if I were to execute it as root on the Command prompt php mailTest.php It executes correctly and I get mail. This feels like the apache user is lacking access over sendmail or something... since as root I can execute the script from the CLI without a problem, but from the web, I get a failure. Can anyone shed a light as to what settings I need to tweak PHP so mail() can work? Thanks -Minuk Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- 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] mysql query with exclude
Hey all, Hope you all have fun this saturday evening :) I'm sure i'm having fun except i'm kinda stuck... Ok here goes... I have 2 tables, one with the people online (chat_online): session_id activity And a second one where i keep the conversations between people(chat): user1_sessionid user2_sessionid chat_conv To see what chatter are still online during the last 2 minutes i do a check like this on the chat_online table: $limit_time= time()-130; $sqlchatonline=select * from chat_online where UNIX_TIMESTAMP(activity) =$limit_time; ok, on my page i also do a query to see what conversations are going on with the user: $thisuser=session_id(); $getchatlist=select * from chat where (user1_sessionid=$thisuser) or (user2_sessionid=$thisuser); This selects all the conversations which this user has been/or is into. I list all the chatpartners of thisuser. Off course it is possible that other chatters who had a conversation with this user are not online anymore. So i need to combine those two queries in a way... this is what i think it should be: $getchatlist=select * from chat where (user1_sessionid=$thisuser) or (user2_sessionid=$thisuser); $resultchatlist=mysql_query($getchatlist); while ($row=mysql_fetch_array($resultchatlist)) { get the second chattersessionid in each conversation and check if this chatter was still online in the last two minutes. if he is not, exclude him from the array and do not show him in the list (optional delete the record in the database) } or maybe i can combine those two queries in one? Can someone help me out on this? Thx in advance, Reinhart _ Reinhart Viane mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
[PHP] get image dimensions
Hi there - I was wondering if there was a way to get PHP to get the dimensions of an image? I want to be able to have PHP dynamically write the image size (of the IMG tag) so that my pages validate when displaying a dynamic image. Thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] get image dimensions
-Original Message- From: Reinhart Viane [mailto:[EMAIL PROTECTED] Sent: zaterdag 27 november 2004 23:24 To: 'Dustin Krysak' Subject: RE: [PHP] get image dimensions $dimensions=getimagesize($image_url); $dimensions[0]=width $dimensions[1]=height Hope this helps -Original Message- From: Dustin Krysak [mailto:[EMAIL PROTECTED] Sent: zaterdag 27 november 2004 23:17 To: PHP Subject: [PHP] get image dimensions Hi there - I was wondering if there was a way to get PHP to get the dimensions of an image? I want to be able to have PHP dynamically write the image size (of the IMG tag) so that my pages validate when displaying a dynamic image. Thanks in advance! d -- 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] Re: Bad PHP error
Well, that big number is not converted as a string and printed this way, or I am missing something. Here is an example: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: 1E+012 and... not 1 as it should. I have first tried just echo $var, but I thought that maybe if I put it between quotes, it will be printed right, but... Thank you. Teddy - Original Message - From: M. Sokolewicz [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Octavian Rasnita [EMAIL PROTECTED] Sent: Saturday, November 27, 2004 11:08 PM Subject: Re: [PHP] Re: Bad PHP error Marek Kilimajer wrote: This would be for unsigned integers. PHP knows only signed integers, however. So the limit is 2147483648 Good point :) When you're outputting it, PHP will convert it back to a string, using the normal integer representation (which is stored aswell). So that should be fine ;) - Tul Octavian Rasnita wrote: Ok, I understand. But what can I do if I want to print big numbers like 123 billion? (but real numbers, not those written with the E letter in them? Is this possible with PHP or I need to do it with another language? Thank you. Teddy From: M. Sokolewicz [EMAIL PROTECTED] Octavian Rasnita wrote: Hi all, I have tried the following script: $val = 100; if (is_int($val)) { echo $val; } else { echo $val is not an integer\n; } The answer is: 100 is not an integer. Why does this happen? I use PHP 5. Isn't PHP able to work with values like 10 billion? Do I need to use a certain special class for dealing with big numbers? How can I use that class? Thank you. Teddy reply it's treated as a double since integers have a max value of (-2e32 +1 up to) 2e32-1, which is 4,294,967,296 (4 billion and some). However, you shouldn't really see any difference in working, it's just treated as a double inside (a double float, that is). Which means it'll be written like 1.0e10 internally -- 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] get image dimensions
Dustin Krysak wrote: Hi there - I was wondering if there was a way to get PHP to get the dimensions of an image? I want to be able to have PHP dynamically write the image size (of the IMG tag) so that my pages validate when displaying a dynamic image. Thanks in advance! d It's all in the manual... http://us4.php.net/getimagesize -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Octavian Rasnita wrote: Well, that big number is not converted as a string and printed this way, or I am missing something. Here is an example: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: 1E+012 and... not 1 as it should. I have first tried just echo $var, but I thought that maybe if I put it between quotes, it will be printed right, but... If you do: $var = '1'; echo $var; it will print fine, but you can't do any math operations on it or it will get converted to float again. You can use BCMath functions, if available. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Thank you. It seems that finally I will need to divide the numbers with 100, make the calculations that way, and specify that the numbers are in millions, because I can't find any solution with PHP. bcmath functions are not good, because they need a string to work for, and not a number, and if I want to make some calculations, the numbers will be converted to numbers and... Thanks. Teddy - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 28, 2004 12:39 AM Subject: Re: [PHP] Re: Bad PHP error Octavian Rasnita wrote: Well, that big number is not converted as a string and printed this way, or I am missing something. Here is an example: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Octavian Rasnita wrote: Thank you. It seems that finally I will need to divide the numbers with 100, make the calculations that way, and specify that the numbers are in millions, because I can't find any solution with PHP. Yes, this is also a solution. bcmath functions are not good, because they need a string to work for, and not a number, and if I want to make some calculations, the numbers will be converted to numbers and... You have to use bc* functions for all calculations. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPmysqladmin
Thanks for your help! T on 11/27/04 12:31, R. Van Tassel at [EMAIL PROTECTED] wrote: http://www.phpmyadmin.net/home_page/downloads.php -R. Van Tassel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, November 27, 2004 1:27 PM To: PHP general Subject: [PHP] PHPmysqladmin Where can you get PHPmysqladmin? I would like to load it on my test server to make updating and entering Mysql data easier. Thanks for your help! Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Hello, Octavian Rasnita wrote: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: 1E+012 and... not 1 as it should. I tried the above example, and I got what you want, i.e. 1. My environment is Windows 2k, PHP 4.3.3 and Apache 2.0.47. Best Bao I have first tried just echo $var, but I thought that maybe if I put it between quotes, it will be printed right, but... Thank you. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
you might want to try using number_format() to change the format back to integer likeness Bao Ruixian wrote: Hello, Octavian Rasnita wrote: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: 1E+012 and... not 1 as it should. I tried the above example, and I got what you want, i.e. 1. My environment is Windows 2k, PHP 4.3.3 and Apache 2.0.47. Best Bao I have first tried just echo $var, but I thought that maybe if I put it between quotes, it will be printed right, but... Thank you. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Hello, M. Sokolewicz wrote: you might want to try using number_format() to change the format back to integer likeness After I changed to echo number_format($var), I got 1,000,000,000,000:) Well, actually this is not my problem. I just tested this for fun. Best Bao Bao Ruixian wrote: Hello, Octavian Rasnita wrote: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: 1E+012 and... not 1 as it should. I tried the above example, and I got what you want, i.e. 1. My environment is Windows 2k, PHP 4.3.3 and Apache 2.0.47. Best Bao -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Hi, I also use Win 2k with PHP 5 in command line mode. It is pretty strange that in an older version of Jaws it works better. Or... could I make some settings to make it work like in your case? Teddy - Original Message - From: BAO RuiXian [EMAIL PROTECTED] To: Octavian Rasnita [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 28, 2004 1:58 AM Subject: Re: [PHP] Re: Bad PHP error Hello, Octavian Rasnita wrote: ?php $var = 1; //Here I have also tried inserting $var = (string) $var; echo $var; ? This prints: 1E+012 and... not 1 as it should. I tried the above example, and I got what you want, i.e. 1. My environment is Windows 2k, PHP 4.3.3 and Apache 2.0.47. Best Bao I have first tried just echo $var, but I thought that maybe if I put it between quotes, it will be printed right, but... Thank you. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Oh thanks, I hope I will find a good combination that migh help me finally. Teddy - Original Message - From: BAO RuiXian [EMAIL PROTECTED] To: M. Sokolewicz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 28, 2004 2:23 AM Subject: Re: [PHP] Re: Bad PHP error Hello, M. Sokolewicz wrote: you might want to try using number_format() to change the format back to integer likeness After I changed to echo number_format($var), I got 1,000,000,000,000:) Well, actually this is not my problem. I just tested this for fun. Best -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comment Speed
Bruno B B Magalhães wrote: Does anyone has a solid benchmark about comments speed.. I mean, too many comments will decrease speed of the PHP scripts... I've tried without success using a class, and also a simple micro-time operation... Well, cause the file is evaluated before it is executed, I didn't had success. Any idea? Surely there are more important things for you to worry about. Regards, Bruno B B Magalhaes -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bad PHP error
Hello, Octavian Rasnita wrote: Hi, I also use Win 2k with PHP 5 in command line mode. This is the result I got when run from the command line: C:\Program Files\Apache Group\Apache2\htdocs\php Content-type: text/html X-Powered-By: PHP/4.3.3 1,000,000,000,000 C:\Program Files\Apache Group\Apache2\htdocs\php It is pretty strange that in an older version of Jaws it works better. No any idea about Jaws. Or... could I make some settings to make it work like in your case? No idea. I have not done any special settings for what I remember. Maybe it is a PHP version problem. Best Bao Teddy
Re: [PHP] mysql query with exclude
Sounds like you need a join. Maybe something like: select * from chat c1, chat_online c2 where UNIX_TIMESTAMP(c2.activity)=$limit_time and c2.session_id = $thisuser and ((c1.user1_sessionid = $thisuser) or c1.user2_sessionid = $thisuser)); Respectfully, Ligaya Turmelle Reinhart Viane wrote: Hey all, Hope you all have fun this saturday evening :) I'm sure i'm having fun except i'm kinda stuck... Ok here goes... I have 2 tables, one with the people online (chat_online): session_id activity And a second one where i keep the conversations between people(chat): user1_sessionid user2_sessionid chat_conv To see what chatter are still online during the last 2 minutes i do a check like this on the chat_online table: $limit_time= time()-130; $sqlchatonline=select * from chat_online where UNIX_TIMESTAMP(activity) =$limit_time; ok, on my page i also do a query to see what conversations are going on with the user: $thisuser=session_id(); $getchatlist=select * from chat where (user1_sessionid=$thisuser) or (user2_sessionid=$thisuser); This selects all the conversations which this user has been/or is into. I list all the chatpartners of thisuser. Off course it is possible that other chatters who had a conversation with this user are not online anymore. So i need to combine those two queries in a way... this is what i think it should be: $getchatlist=select * from chat where (user1_sessionid=$thisuser) or (user2_sessionid=$thisuser); $resultchatlist=mysql_query($getchatlist); while ($row=mysql_fetch_array($resultchatlist)) { get the second chattersessionid in each conversation and check if this chatter was still online in the last two minutes. if he is not, exclude him from the array and do not show him in the list (optional delete the record in the database) } or maybe i can combine those two queries in one? Can someone help me out on this? Thx in advance, Reinhart _ Reinhart Viane mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting static member for a class which name is stored in a variable
Simas Toleikis wrote: Jake Press wrote: Hi Francisco, Your not alone, a number of other users have enountered this bug. string get_class ( object obj ) Its not a bug... You are getting class name as a string for output purposes etc.. Doing something like TestClass::some_static is ofcourse illegal wih strings. Morning, Umm, it is an unclear syntax limitation, which is a bug. ... either language or manual. i understand what you are saying, i beleive i disclaimer'd my own examples somewhere down the line in those threads ;) i beleive there should be a better way to do this without: - using reflection - instantiating the class and using a method to retrieve the variable - eval Also please notice the existance of the call_user_func and what this gives us ;) = this gives us a solution (workaround??) to access static functions within a class Perhaps we need a similar function to provide access to our static variables! :) Best Regards Jake Press -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php