Re: [PHP] Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?
Curt Zirzow wrote: On Sat, Feb 11, 2006 at 12:48:50PM +0800, HoWang Wang wrote: HoWang Wang wrote: Hi all, The Zend Encoder 4.0 (beta) have a new function in the license manager which can limit the number of concurrent users. I have wriiten something to work like it. But I found a problem. My script can limit the number of concurrent running script only. When the script ends, there is some data remain in the buffer (of Apache, I think) and the client connection is still active! How can I solve this? Please help, Thanks. Regards Is it really impossible? Can I do it with Connection Handling? It is really unclear on exactly what you are doing and i have no clue what data is remaining in what buffer you think might be the problem. You really dont want to do this. By doing that while loop, you will do a couple of bad things: - eating up a lot of CPU usage, of course a sleep in the loop would probably prevent cpu abuse but still not the ideal way to do it. - You will most likely run out of available slots that http has available. Curt. Let me give an example: on fileplanet.com, they have something so called "download slot" and "lines". They limit the number of concurrent downloads. If there are too many users, they will disallow new user to download their files. As I know, they do it with custom HTTP server. PHP run very quickly & pass all contents to Apache within 0.000X second. But the web server usually have to take up 1 or more seconds to send all the contents to the client. Is it possible to limit the concurrent users (including the users receiving data but the php script already finished) with PHP? Please reply, thanks to all. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class/functions question
Hi all, I building a website with PHP. I am going to be using functions to deal with vaildation. I am putting all the methods in a class called Validation. My problem is I do not know how to call the function. Well I shouldn't say that. I know how to call functlions, I just just don't know how to do it in PHP. Let me put it this way. When I write programs in C++/Java I know that I have to do the following steps, create an object reference to the class use the object reference to access the methods. I am almost certain that it is the same thing in PHP. So this is what I did in my web page. . First Name * checkEmpty($_POST["name"]); ?> .. ... = rest of php/html code the else block holds the entire html code for the page Do I have the logic right? Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Asynchronous Processing
Hey folks, i am writing a small program in C that does mysql queries. The problem i am facing is that it is done in synchronous fashion. I wonder how php does mysql queries in asynchronous fashion? Thanks for your time and cooperation. Best regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unsupported binary characters in database,
I have the following encryption function: function RC4( $data) { //ecncrypt $data with the key in $keyfile with an rc4 algorithm $pwd = implode('', file(/key.php')); $pwd_length = strlen($pwd); for ($i = 0; $i < 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1)); $counter[$i] = $i; } for ($i = 0; $i < 255; $i++) { $x = ($x + $counter[$i] + $key[$i]) % 256; $temp_swap = $counter[$i]; $counter[$i] = $counter[$x]; $counter[$x] = $temp_swap; } for ($i = 0; $i < strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $counter[$a]) % 256; $temp = $counter[$a]; $counter[$a] = $counter[$j]; $counter[$j] = $temp; $k = $counter[(($counter[$a] + $counter[$j]) % 256)]; $Zcipher = ord(substr($data, $i, 1)) ^ $k; $Zcrypt .= chr($Zcipher); } return $Zcrypt; } source: zend code gallery When I encrypt a string that ends in e it shows up as a space in the database, when I pull it back out of the database, the string is missing the e. I tried converting the field in the database to a blob and that didn't work either. My next idea is to add a bin2hex and then a hex2bin: function hex2bin($hexdata) { $bindata=""; for ($i=0;$ihttp://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?
On Sat, Feb 11, 2006 at 12:48:50PM +0800, HoWang Wang wrote: > HoWang Wang wrote: > > Hi all, > > > > The Zend Encoder 4.0 (beta) have a new function in the license manager > > which can limit the number of concurrent users. I have wriiten something > > to work like it. But I found a problem. My script can limit the number > > of concurrent running script only. When the script ends, there is some > > data remain in the buffer (of Apache, I think) and the client connection > > is still active! How can I solve this? Please help, Thanks. > > > > Regards > > Is it really impossible? Can I do it with Connection Handling? It is really unclear on exactly what you are doing and i have no clue what data is remaining in what buffer you think might be the problem. > set_time_limit(0); > ignore_user_abort(true); > // add 1 to the number of concurrent users > // the rest of code > while (!connection_aborted()) { > // keep on locking > } else { > // release lock > } > ?> You really dont want to do this. By doing that while loop, you will do a couple of bad things: - eating up a lot of CPU usage, of course a sleep in the loop would probably prevent cpu abuse but still not the ideal way to do it. - You will most likely run out of available slots that http has available. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't insert values into MySQL DB via PHP
An update to my (former) problem: Hi, I've taken all your advice on debuggin, netequitte and the like. It works now and I would like to thank you all for your help in my stupidly newbie question. Thanks :)
Re: [PHP] how to learn php
tedd wrote: hello i have been trying to learn php. what is the best approach to learning php for someone who has no programming experience? -snip- any advice and/or opinions would be greatly appreciated. thanks. First, welcome to the language. Second, I suggest that you find a beginner's book -- 1. If you can do any learning from books (e.g. you were/are a decent student in whatever educational system you did/are attend/attending), by all means follow tedd's "Second," Somewhat contrary to the advise "get a book with everything in it", I found Larry Ullman's "PHP & The World Wide Web" (PeachPit Press) to be "da bomb" when I decided to learn PHP. I'll plug him for readability, his explanations, and he was a fellow Missourian (think he's in California now). I get no money from PeachPit or Larry for that, though ... ;-) Keep in mind that there is no way that books can keep up with real-time development on a language like PHP; the need for the online manual (or the Windows .chm help files) is also great. In particular, I found that Larry's book was mostly written from a PHP3 POV, but PHP4 was out by the time I got my hands on it. There were a few differences; sometimes he made mention of that. 2. Write some code: 3. Read the source code of scripts you can download for free at sites like hotscripts.com. Then, write something better (be sure to adhere to any licensing restrictions you find)! Then, you can start reading source code for bigger projects, and see how the "big boys" work 4. Get involved in a PHP developer community (PHPBuilder.com's forum gets my vote, and, of course, you've joined this mail-list, I suppose...) and read, read, read, and ask sensible questions. Read Eric S. Raymond's essay 'How to ask questions the smart way", if you've not already done so. So, it's "read, code, and read code; then, ask for help nicely if you need it!" Good luck with PHP, Kevin Kinsey -- Chicagoan: So, wherere you from?" Hoosier:"Whats wrong with Indiana? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to learn php
Btw, if we are talking about tutorials :) PHP 101 (part 1): Down The Rabbit Hole http://www.weberdev.com/ViewArticle/433 PHP 101 (part 2): Calling All Operators http://www.weberdev.com/ViewArticle/435 PHP 101 (part 3): Looping The Loop http://www.weberdev.com/ViewArticle/436 PHP 101 (part 4): The Food Factor http://www.weberdev.com/ViewArticle/438 PHP 101 (part 5): Rank And File http://www.weberdev.com/ViewArticle/440 PHP 101 (part 6): Function-ally Yours http://www.weberdev.com/ViewArticle/443 PHP 101 (part 7): The Bear Necessities http://www.weberdev.com/ViewArticle/445 PHP 101 (part 8): Databases and Other Animals http://www.weberdev.com/ViewArticle/449 More will come... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, February 11, 2006 8:28 PM To: tedd; php-general@lists.php.net Subject: Re: [PHP] how to learn php tedd wrote: >> hello >> >> i have been trying to learn php. >> >> what is the best approach to learning php for someone who has no >> programming experience? >> -snip- >> >> any advice and/or opinions would be greatly appreciated. >> >> thanks. Here's a tutorial I found useful, and would be good for someone without a programming background as it has good explanations of not only the code, but the concepts. http://www.brainbell.com/tutors/php/php_mysql/index.html. I found it when I started to try to learn authentication. I was having a hard time wrapping my head around it, and this site took me over the hump!! This is also on that site, but I haven't really looked at this section. http://www.brainbell.com/tutorials/php/ Another thing I did was to download the php reference manual to my desk top so I can easily pull it up. I typically look there first, and if I still need some help, I will google for code snippets. Then I ask for help on one of the lists. I don't remember where I got the manual, but I'm sure someone here can give you a link. Or you can google for it. jimmy -- 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] Weirdness with PHP FreeBSD/OSX/Linux headers already sent
To respond I do know the paths to the php.ini for all of the servers I used. In all of my scripts I turn error_reporting to E_ALL and use a custom error handler script to deal with errors. I was just looking for the setting that could cause the problem and its the ouput_buffering directive. I thought it was something to do with output buffering because the scripts had been showing random behavior to when it would show the "headers already sent" message or not. I just didn't realize such a thing existed in the php.ini because I never hack on it since that is the job of our sysadmin. Suppose I ought to read up on it to see what other things can or cannot happen. I looked at the phpinfo() for the company webserver versus my own and noticed the output buffer lines are like this: server: output_buffering 4096 4096 mine: output_buffering 0 0 Thanks for the replies!
Re: [PHP] how to learn php
tedd wrote: hello i have been trying to learn php. what is the best approach to learning php for someone who has no programming experience? -snip- any advice and/or opinions would be greatly appreciated. thanks. Here's a tutorial I found useful, and would be good for someone without a programming background as it has good explanations of not only the code, but the concepts. http://www.brainbell.com/tutors/php/php_mysql/index.html. I found it when I started to try to learn authentication. I was having a hard time wrapping my head around it, and this site took me over the hump!! This is also on that site, but I haven't really looked at this section. http://www.brainbell.com/tutorials/php/ Another thing I did was to download the php reference manual to my desk top so I can easily pull it up. I typically look there first, and if I still need some help, I will google for code snippets. Then I ask for help on one of the lists. I don't remember where I got the manual, but I'm sure someone here can give you a link. Or you can google for it. jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] scope of classes in PHP
Hi I'm developing an app to administer LDAP (phpLdapAdmin is too complex for the customer). I have created an LDAP class, in a file class_ldap.php. It include methods for connecting to the server, binding a DN (effectively login), and adding posix groups. I have an index.php with include_once 'class_ldap.php', which allows me to login using the HTTP authentication mechanism. The connect method stores the resulting connection resource in a global variable (included in a config.php file). When I then go to add the posix group (from add_group.php, that also includes class_ldap.php), I find that the global connection variable is not valid. My question is, do I need to connect and authenticate with the LDAP server every time I want to perform an action, or is there a way to establish a connection for the user's session, that is cleared when the user logs out. Many thanks, Stuart. -- --- Stuart Bailey BSc (hons) CEng CITP MBCS LinuSoft (Proprietor) Linux Specialist (01953) 601294 (07778) 383739 http://www.linusoft.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to learn php
hello i have been trying to learn php. what is the best approach to learning php for someone who has no programming experience? -snip- any advice and/or opinions would be greatly appreciated. thanks. First, welcome to the language. Second, I suggest that you find a beginner's book -- if not hard-copy, then try this: http://www.unf.edu/~rita0001/eresources/php_tutorials/index.htm -- and go through all the examples. Write a program that deals with each example and get it to work. Now, realize that this is not lost effort because those examples will become your references for future development. Until those examples become second nature to you, you'll be looking back at them time and time again. I've found that as I code, I build bigger and more specialized routines/libraries that I incorporate into other projects. Third, develop a style and stick with it. There are different styles that help us in reviewing code. Some programmers have the ability to look at cryptic code and understand it's meaning immediately, while others require more natural language or verbose syntax. Also, even the way you indent can help you in reviewing code. There are several different ways to do that, but you pick something that makes sense to you and be consistent in it's application. Fourth, and IMO most important, is to develop a manner of documentation. This is simply writing notes to the person who will be reading your code at some point in the future -- which usually is a smarter you. So, do yourself a favor and impress your future self, by documenting what you're doing now. Now, go forth and be fruitful in your coding. tedd -- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Oracle buying out Zend ... how does that affect PHP?
Marc G. Fournier wrote: http://www.businessweek.com/technology/content/feb2006/tc20060209_810527.htm "Also in Oracle's crosshairs: closely held Zend, based in Cupertino, Calif. Zend's PHP software language is one of the most prevalent on the Web, present in more than 18 million Web sites. The company, which snared headlines last year when Netscape co-founder Marc Andreessen joined its board, has been trying to extend its success with the Web into business applications. Zend could sell for $200 million, according to one source." Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: [EMAIL PROTECTED] Yahoo!: yscrappy ICQ: 7615664 Well, we'd run the risk of a good support company and optimizer. But the language above is misleading: PHP isn't owned, per se, by Zend, although Zend is owned or at least was founded by some pretty big guns on the PHP Devel Team. So the effects might not be much beyond what I mention above. It's kind of interesting to speculate, though; and it's good news for the Zend guys --- nice (for them anyway) when you start "looking that juicy to the big players", as a friend of mine says. Makes you wonder if this really isn't a jab against the other DB companies/orgs --- I could foresee Zend pushing some PHP/Oracle interface/optimization products within a year or so if this happens Kevin Kinsey -- Reality -- what a concept! -- Robin Williams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL request on DBase file...
> >Hi, > > > >I have to rewrite an application from ASP. In this application, I > >receive DBase files which may be saved into Oracle. > >In ASP, I used a generic driver and I made SQL requests on these files. > >It is possible with PHP on Linux ? > >Do you have some examples ? > > > >Thank you very much. > > > >David. > > Come on -- read the manual. There's a section .dbf files. Of course I read the manual !!! In fact, there's a section on .dbf files, but the request mode is sequentiel one... But I want to do SQL request !!! And my question is : is it possible with PHP on Linux ? It's easy on Windows with ASP but I don't know with PHP on Linux. I search a little bit before sending a mail on the list ;-) Thank you. David. signature.asc Description: Ceci est une partie de message numériquement signée
Re: [PHP] how to learn php
I started out by getting a reference manual, one with every function describing what the function does. Just like the php.net online function reference but one that can be read lying on the couch. Now when I need some code to do something I'll remember there's a function for it (maybe) and I go to php.net and search for it. I search for PHP examples online for more advanced stuff than I can do and study it. This gives me some knowledge of proper approach to coding; when to use what. Finally if the code looks funky I send a snip to this list and someone will suggest a better function or approach. Oh yea, this is great, I use Dreamweaver's (grimace) PHP coding abilities to get projects started. Dreamweaver can do the preliminary basic database connection stuff: INSERT, UPDATE, DELETE pages. Then I hack the Dreamweaver code. Doing a MySQL tutorial is a good idea too. > hello > > i have been trying to learn php. > > what is the best approach to learning php for someone who has no > programming experience? > > i am very familiar with html, xhtml, and css. i'm not an idiot when it > comes to using computers. > i have bought several books and have subscribed to a couple of the php > mailing lists, but i feel that i could be doing more to learn php. > > what approach (and steps) did you take in learning this really cool > scripting language? should i look into taking classes or stick with an > autodidact approach? > > any advice and/or opinions would be greatly appreciated. > > thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to learn php
If you like to learn while playing, you may want to look at http://www.webertrivia.com. You can learn PHP, MySQL And Linux while playing trivia :) Sincerely berber Visit the Weber Sites Today, To see where PHP might take you tomorrow. PHP & MySQL Forums : http://www.weberforums.com Search for PHP Code from your browser http://toolbar.weberdev.com -Original Message- From: /dev/null [mailto:[EMAIL PROTECTED] Sent: Saturday, February 11, 2006 2:10 AM To: php-general@lists.php.net Subject: [PHP] how to learn php hello i have been trying to learn php. what is the best approach to learning php for someone who has no programming experience? i am very familiar with html, xhtml, and css. i'm not an idiot when it comes to using computers. i have bought several books and have subscribed to a couple of the php mailing lists, but i feel that i could be doing more to learn php. what approach (and steps) did you take in learning this really cool scripting language? should i look into taking classes or stick with an autodidact approach? any advice and/or opinions would be greatly appreciated. thanks. -- 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