Re: [PHP] Re: limiting
On Wed, Oct 10, 2012 at 7:37 PM, Jim Giner wrote: > On 10/10/2012 4:27 PM, Matijn Woudt wrote: >> >> On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan >> wrote: >>> >>> On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote: >>> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote: > > On 10 Oct 2012 at 19:17, David McGlone wrote: > > >>> >>> >>> BTW - in any of your other computer languages didn't they utilize a >>> 'return' statement? PHP's is no different. >> >> >> >> >> back in like '85, I learned Pascal that's the only language I learned >> and >> I don't recall if it used return. > > > > Mmmm. There's the problem. Pascal doesn't *have* a return statement. In > Pascal, implicitly, you return when execution reaches the end of a > function. In fact the same is true of PHP and JavaScript, but in those > languages you can return early just by saying return. > IMO, this is a major limitation of Pascal. I use returns wherever I > feel > like it - if I detect there's nothing more for the function to do, I > return. Purists object to this; they say you should enter a function at > one > place and leave at one place. Well, that's a point of view. But more > often > that not it just leads to convoluted code in order to achieve that. The > one > time I *had* to use Pascal as that was the only option, I simply put a > 999: > label at the end of the function and did goto 999 wherever I wanted to > do a > return. Simples! goto was the thing that got on my nerves. Even to this day I hate that word with a passion. >>> >>> >>> I think most people do, all but BASIC purists! >>> >> >> Not really, goto can safe you a mess. In some situations it's much >> easier and cleaner to use something like goto cleanup; at each error >> case, instead of duplicating the cleanup code all over again (Closing >> sockets, or in languages like C, freeing memory). >> >> - Matijn >> > haven't used a goto or go in 30 years. > > It's the whence command that will get you every time (aka "comesfrom"). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On 10/10/2012 4:27 PM, Matijn Woudt wrote: On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan wrote: On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote: On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote: On 10 Oct 2012 at 19:17, David McGlone wrote: BTW - in any of your other computer languages didn't they utilize a 'return' statement? PHP's is no different. back in like '85, I learned Pascal that's the only language I learned and I don't recall if it used return. Mmmm. There's the problem. Pascal doesn't *have* a return statement. In Pascal, implicitly, you return when execution reaches the end of a function. In fact the same is true of PHP and JavaScript, but in those languages you can return early just by saying return. IMO, this is a major limitation of Pascal. I use returns wherever I feel like it - if I detect there's nothing more for the function to do, I return. Purists object to this; they say you should enter a function at one place and leave at one place. Well, that's a point of view. But more often that not it just leads to convoluted code in order to achieve that. The one time I *had* to use Pascal as that was the only option, I simply put a 999: label at the end of the function and did goto 999 wherever I wanted to do a return. Simples! goto was the thing that got on my nerves. Even to this day I hate that word with a passion. I think most people do, all but BASIC purists! Not really, goto can safe you a mess. In some situations it's much easier and cleaner to use something like goto cleanup; at each error case, instead of duplicating the cleanup code all over again (Closing sockets, or in languages like C, freeing memory). - Matijn haven't used a goto or go in 30 years. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan wrote: > On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote: > >> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote: >> > On 10 Oct 2012 at 19:17, David McGlone wrote: >> > >> > >> > >> >> > >> >> > >> BTW - in any of your other computer languages didn't they utilize a >> > >> 'return' statement? PHP's is no different. >> > > >> > > >> > > >> > > back in like '85, I learned Pascal that's the only language I learned >> > > and >> > > I >> don't recall if it used return. >> > >> > >> > Mmmm. There's the problem. Pascal doesn't *have* a return statement. In >> > Pascal, implicitly, you return when execution reaches the end of a >> > function. In fact the same is true of PHP and JavaScript, but in those >> > languages you can return early just by saying return. >> >> > IMO, this is a major limitation of Pascal. I use returns wherever I feel >> > like it - if I detect there's nothing more for the function to do, I >> > return. Purists object to this; they say you should enter a function at one >> > place and leave at one place. Well, that's a point of view. But more often >> > that not it just leads to convoluted code in order to achieve that. The one >> > time I *had* to use Pascal as that was the only option, I simply put a 999: >> > label at the end of the function and did goto 999 wherever I wanted to do a >> > return. Simples! >> >> goto was the thing that got on my nerves. Even to this day I hate that word >> with a passion. >> >> > > > I think most people do, all but BASIC purists! > Not really, goto can safe you a mess. In some situations it's much easier and cleaner to use something like goto cleanup; at each error case, instead of duplicating the cleanup code all over again (Closing sockets, or in languages like C, freeing memory). - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Re: limiting
On Wed, Oct 10, 2012 at 8:17 PM, David McGlone wrote: >> >> BTW - in any of your other computer languages didn't they utilize a >> 'return' statement? PHP's is no different. > > back in like '85, I learned Pascal that's the only language I learned and I > don't recall if it used return. > > -- Pascal does have return, it only has a different name, exit. The concept is the same. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote: > On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote: > > On 10 Oct 2012 at 19:17, David McGlone wrote: > > > > > > >> > > >> > > >> BTW - in any of your other computer languages didn't they utilize a > > >> 'return' statement? PHP's is no different. > > > > > > > > > > > > back in like '85, I learned Pascal that's the only language I learned and > > > I > don't recall if it used return. > > > > > > Mmmm. There's the problem. Pascal doesn't *have* a return statement. In > > Pascal, implicitly, you return when execution reaches the end of a > > function. In fact the same is true of PHP and JavaScript, but in those > > languages you can return early just by saying return. > > > IMO, this is a major limitation of Pascal. I use returns wherever I feel > > like it - if I detect there's nothing more for the function to do, I > > return. Purists object to this; they say you should enter a function at one > > place and leave at one place. Well, that's a point of view. But more often > > that not it just leads to convoluted code in order to achieve that. The one > > time I *had* to use Pascal as that was the only option, I simply put a 999: > > label at the end of the function and did goto 999 wherever I wanted to do a > > return. Simples! > > goto was the thing that got on my nerves. Even to this day I hate that word > with a passion. > > I think most people do, all but BASIC purists! -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: limiting
On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote: > On 10 Oct 2012 at 19:17, David McGlone wrote: > > > >> > >> > >> BTW - in any of your other computer languages didn't they utilize a > >> 'return' statement? PHP's is no different. > > > > > > > > back in like '85, I learned Pascal that's the only language I learned and > > I don't recall if it used return. > > > Mmmm. There's the problem. Pascal doesn't *have* a return statement. In > Pascal, implicitly, you return when execution reaches the end of a > function. In fact the same is true of PHP and JavaScript, but in those > languages you can return early just by saying return. > IMO, this is a major limitation of Pascal. I use returns wherever I feel > like it - if I detect there's nothing more for the function to do, I > return. Purists object to this; they say you should enter a function at one > place and leave at one place. Well, that's a point of view. But more often > that not it just leads to convoluted code in order to achieve that. The one > time I *had* to use Pascal as that was the only option, I simply put a 999: > label at the end of the function and did goto 999 wherever I wanted to do a > return. Simples! goto was the thing that got on my nerves. Even to this day I hate that word with a passion. -- David M.
Fwd: Re: [PHP] Re: limiting
-- Forwarded Message -- Subject: Re: [PHP] Re: limiting Date: Wednesday, October 10, 2012, 02:03:57 PM From: David McGlone To: jim.gi...@albanyhandball.com On Wednesday, October 10, 2012 01:31:58 PM Jim Giner wrote: > On 10/10/2012 1:19 PM, David McGlone wrote: > > With that said, I just may leave the list. After all if this is all I'm > > going to get out of it, it's not worth it! > > > > -- > > > > David M. > > This list has given you some very good advice, much of it from others. > It may not have solved your understanding of 'glob' (which is just > another function - how could it alone mess up your project?) At first is was going to be a project, because I thought that would help keep focus, but once I was introduced to glob it went from being a project, to a function to just plain code. I turned all my attention to glob and that little bit of code that I completely forgot I was trying keep focus by keeping it a project. > but it has > felt your pain and offered you some ways to get up to speed. Don't > leave - take the advice with the sentiment it was given and learn. This > list is all about learning. Just don't tackle the Tour de France until > you get your training wheels off! :) Your advise was not what bothered me, it was way off base to say the least. What bothered me was the judgement that was cast upon me because I didn't understand return very well and when that came up, it added to my confusion and frusturation of trying to use glob which wasn't even my plan in the first place. > > BTW - in any of your other computer languages didn't they utilize a > 'return' statement? PHP's is no different. back in like '85, I learned Pascal that's the only language I learned and I don't recall if it used return. -- David M. - -- David M.
Re: [PHP] Re: limiting
> [snip] > With that said, I just may leave the list. After all if this is all I'm going > to get out of it, it's not worth it! > [snip] > Hi David, it sounds like cliche, but you get out of it what you put in it. I recommend: (If you *want* to write code, then:) - don't get flustered; don't take any of this too seriously, esp. the emotional part (except the fun of creating); don't let the experts bother/intimidate you - just take from them what you can use, and ignore the rest. - focus on what you are trying to do, ignore everything else. Even experts who know what they are doing can easily get lost and waste time if they do not just focus on the one thing they originally set out to do, and just drop everything else. Focus! - break every problem down into smaller problems; everything is easy and simple once you isolate an unknown/unlearned thing/issue down to just that one thing. Build up your code in baby steps. If you ask big questions that are actually conglomerates of many unknowns (black holes in your understanding), then experts don't know where to begin to help you, so they post those (these ;-) long-winded advice columns. But do ask the/any forum/list, "Why does this one little thing behave like this ", and you get instant expert useful answers every time. You have to be the one to later glue together all the little things. But you will be able to - if you have started with understanding how to do the little things that make up the larger thing you are creating. Make sure you understand every little thing and nuance in your code. - resist the urge to just "get it to work" and then drop it. One has to actually know HOW/WHY it works, and not just get lucky. This is all logic, not luck. Luck is not enough to rely on in coding. There are many many people on this list who are feeling supportive of you... hoping you do not get discouraged, but do try again, and again. :-) -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On 10/10/2012 1:19 PM, David McGlone wrote: With that said, I just may leave the list. After all if this is all I'm going to get out of it, it's not worth it! -- David M. This list has given you some very good advice, much of it from others. It may not have solved your understanding of 'glob' (which is just another function - how could it alone mess up your project?) but it has felt your pain and offered you some ways to get up to speed. Don't leave - take the advice with the sentiment it was given and learn. This list is all about learning. Just don't tackle the Tour de France until you get your training wheels off! :) BTW - in any of your other computer languages didn't they utilize a 'return' statement? PHP's is no different. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Wednesday, October 10, 2012 05:48:10 PM Matijn Woudt wrote: > On Wed, Oct 10, 2012 at 5:12 PM, Jim Giner wrote: > > On 10/10/2012 10:07 AM, Floyd Resler wrote: > >> On Oct 10, 2012, at 9:12 AM, Andy McKenzie wrote: > >>> > >>> > > Have you read a book on php and perhaps one on CSS to help > > with your "hiding" problem? (BTW - that last was a hint.) > > I've read plenty of PHP books I own at least 5 and ALL of them I've > read > hardly ever explain anything at all. They just throw some code in there > and > say "this is what it does" and gives a picture of the finished product. > Total > waste of my money! Also, how am I going to learn PHP if I've got to mix > it all > up with CSS. It's just going to make things harder and more confusing > on > me. I > only threw lightbox in there because I knew I didn't have to do or > learn > anything special and to put a smile on my face if it worked. After all, > if it > can't be fun, why do it? > >>> > >>> > >>> > >>> I rarely post anything to this list, because almost everything asked > >>> is above my level of understanding. But, speaking as a relative > >>> beginner, I have a few comments here. > >>> > >>> 1) Books. I, too, have read a lot of PHP books. In the end, the ones > >>> I've found most useful were by WROX press. Their "Beginning PHP4" by > >>> Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to > >>> programming" type books I've found for the way I learn. It's now > >>> obsolete, but the core information is still good. I haven't read > >>> through the Beginning PHP 5.3 version as thoroughly, but it also seems > >>> to be pretty good. You might also want to check with local community > >>> colleges to see if someone offers a basic course -- PHP, C, C++, > >>> something like that. The language may be different, but the concepts > >>> remain the same. > >>> > >>> 2) "They just throw some code in there and say "this is what it does" > >>> and gives a picture of the finished product. Total waste of my money! > >>> Also, how am I going to learn PHP if I've got to mix it all up with > >>> CSS." > >>> > >>> This one's harder. These days CSS is part of the web, and you're > >>> > >>> stuck with it if you want to do anything complex. So here's my > >>> advice: Find something simple to experiment with. Don't start with a > >>> complex project, start with something that doesn't actually do > >>> anything useful. When I start trying to understand a function I > >>> haven't used before, I build a new page called something like > >>> "foo_test", where foo is the name of the function. These days it > >>> might be ip2long_test, or something like that, but I still have some > >>> in my test folder with names like "echo_test.php" where I was trying > >>> to figure out how that function worked. Start there. Do something > >>> simple. Lightbox may be too complex. Maybe build a fortune cookie > >>> webpage, where every time you click a button it reloads with a new > >>> fortune. Learn to pull fortunes out of a file and out of a database. > >>> Once you've got the hang of that, start using CSS to change how it > >>> looks. Once THAT's working right, figure out how to use JavaScript > >>> (you're going to need it sooner or later!) and AJAX to make it reload > >>> the fortune without reloading the whole page. > >>> > >>> Yeah, it's a boring project. But it's a stepping stone to doing > >>> > >>> what you really want to do. The alternative is to do what I did: > >>> start with a big project, and accept that you're going to rewrite it > >>> dramatically later. I started with a book inventory system. First I > >>> built a login and authentication system -- that builds a form, and > >>> queries the database to see if the userid and password are correct. > >>> Then I built a system to list what was in the book table for the > >>> database. Around the time I finished that, I realized I needed more > >>> granularity in user logins, so I went back and rebuilt the login tool. > >>> Then I realized I didn't actually have a way to add stuff to the DB, > >>> so I built that tool and so on. It ended up taking me something > >>> like a year, because I'd never looked at PHP before, and I've now > >>> scrapped the entire project and rebuilt it. Why? Because I did just > >>> about everything wrong. It just plain wasn't practical to try to fix > >>> it. I'd never learned the basics, I just threw myself at a big > >>> project to see what would happen. > >>> > >>> Good luck! > >>> > >>> -Andy McKenzie > >> > >> Excellent advise! When learning any language, those small steps you > >> suggest is how I've always learned the language. A few years ago I ran > >> across someone who didn't know a thing about programming but wanted to > >> learn. The first project he wanted to tackle was to write his own online > >> role playing game. Y
Re: [PHP] Re: limiting
On Wed, Oct 10, 2012 at 5:12 PM, Jim Giner wrote: > On 10/10/2012 10:07 AM, Floyd Resler wrote: >> >> >> >> On Oct 10, 2012, at 9:12 AM, Andy McKenzie wrote: >> >>> > > Have you read a book on php and perhaps one on CSS to help > with your "hiding" problem? (BTW - that last was a hint.) I've read plenty of PHP books I own at least 5 and ALL of them I've read hardly ever explain anything at all. They just throw some code in there and say "this is what it does" and gives a picture of the finished product. Total waste of my money! Also, how am I going to learn PHP if I've got to mix it all up with CSS. It's just going to make things harder and more confusing on me. I only threw lightbox in there because I knew I didn't have to do or learn anything special and to put a smile on my face if it worked. After all, if it can't be fun, why do it? >>> >>> >>> >>> I rarely post anything to this list, because almost everything asked >>> is above my level of understanding. But, speaking as a relative >>> beginner, I have a few comments here. >>> >>> 1) Books. I, too, have read a lot of PHP books. In the end, the ones >>> I've found most useful were by WROX press. Their "Beginning PHP4" by >>> Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to >>> programming" type books I've found for the way I learn. It's now >>> obsolete, but the core information is still good. I haven't read >>> through the Beginning PHP 5.3 version as thoroughly, but it also seems >>> to be pretty good. You might also want to check with local community >>> colleges to see if someone offers a basic course -- PHP, C, C++, >>> something like that. The language may be different, but the concepts >>> remain the same. >>> >>> 2) "They just throw some code in there and say "this is what it does" >>> and gives a picture of the finished product. Total waste of my money! >>> Also, how am I going to learn PHP if I've got to mix it all up with >>> CSS." >>> >>> This one's harder. These days CSS is part of the web, and you're >>> stuck with it if you want to do anything complex. So here's my >>> advice: Find something simple to experiment with. Don't start with a >>> complex project, start with something that doesn't actually do >>> anything useful. When I start trying to understand a function I >>> haven't used before, I build a new page called something like >>> "foo_test", where foo is the name of the function. These days it >>> might be ip2long_test, or something like that, but I still have some >>> in my test folder with names like "echo_test.php" where I was trying >>> to figure out how that function worked. Start there. Do something >>> simple. Lightbox may be too complex. Maybe build a fortune cookie >>> webpage, where every time you click a button it reloads with a new >>> fortune. Learn to pull fortunes out of a file and out of a database. >>> Once you've got the hang of that, start using CSS to change how it >>> looks. Once THAT's working right, figure out how to use JavaScript >>> (you're going to need it sooner or later!) and AJAX to make it reload >>> the fortune without reloading the whole page. >>> >>> Yeah, it's a boring project. But it's a stepping stone to doing >>> what you really want to do. The alternative is to do what I did: >>> start with a big project, and accept that you're going to rewrite it >>> dramatically later. I started with a book inventory system. First I >>> built a login and authentication system -- that builds a form, and >>> queries the database to see if the userid and password are correct. >>> Then I built a system to list what was in the book table for the >>> database. Around the time I finished that, I realized I needed more >>> granularity in user logins, so I went back and rebuilt the login tool. >>> Then I realized I didn't actually have a way to add stuff to the DB, >>> so I built that tool and so on. It ended up taking me something >>> like a year, because I'd never looked at PHP before, and I've now >>> scrapped the entire project and rebuilt it. Why? Because I did just >>> about everything wrong. It just plain wasn't practical to try to fix >>> it. I'd never learned the basics, I just threw myself at a big >>> project to see what would happen. >>> >>> Good luck! >>> >>> -Andy McKenzie >> >> >> Excellent advise! When learning any language, those small steps you >> suggest is how I've always learned the language. A few years ago I ran >> across someone who didn't know a thing about programming but wanted to >> learn. The first project he wanted to tackle was to write his own online >> role playing game. You know, like World of Warcraft! Uh, yeah. I steered >> him away from that! >> >> Take care, >> Floyd >> > All great advice but alas, I fear that my long-winded response that began > all these succeeding advice columns has steered our OP away from this list. > H
Re: [PHP] Re: limiting
On 10/10/2012 10:07 AM, Floyd Resler wrote: On Oct 10, 2012, at 9:12 AM, Andy McKenzie wrote: Have you read a book on php and perhaps one on CSS to help with your "hiding" problem? (BTW - that last was a hint.) I've read plenty of PHP books I own at least 5 and ALL of them I've read hardly ever explain anything at all. They just throw some code in there and say "this is what it does" and gives a picture of the finished product. Total waste of my money! Also, how am I going to learn PHP if I've got to mix it all up with CSS. It's just going to make things harder and more confusing on me. I only threw lightbox in there because I knew I didn't have to do or learn anything special and to put a smile on my face if it worked. After all, if it can't be fun, why do it? I rarely post anything to this list, because almost everything asked is above my level of understanding. But, speaking as a relative beginner, I have a few comments here. 1) Books. I, too, have read a lot of PHP books. In the end, the ones I've found most useful were by WROX press. Their "Beginning PHP4" by Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to programming" type books I've found for the way I learn. It's now obsolete, but the core information is still good. I haven't read through the Beginning PHP 5.3 version as thoroughly, but it also seems to be pretty good. You might also want to check with local community colleges to see if someone offers a basic course -- PHP, C, C++, something like that. The language may be different, but the concepts remain the same. 2) "They just throw some code in there and say "this is what it does" and gives a picture of the finished product. Total waste of my money! Also, how am I going to learn PHP if I've got to mix it all up with CSS." This one's harder. These days CSS is part of the web, and you're stuck with it if you want to do anything complex. So here's my advice: Find something simple to experiment with. Don't start with a complex project, start with something that doesn't actually do anything useful. When I start trying to understand a function I haven't used before, I build a new page called something like "foo_test", where foo is the name of the function. These days it might be ip2long_test, or something like that, but I still have some in my test folder with names like "echo_test.php" where I was trying to figure out how that function worked. Start there. Do something simple. Lightbox may be too complex. Maybe build a fortune cookie webpage, where every time you click a button it reloads with a new fortune. Learn to pull fortunes out of a file and out of a database. Once you've got the hang of that, start using CSS to change how it looks. Once THAT's working right, figure out how to use JavaScript (you're going to need it sooner or later!) and AJAX to make it reload the fortune without reloading the whole page. Yeah, it's a boring project. But it's a stepping stone to doing what you really want to do. The alternative is to do what I did: start with a big project, and accept that you're going to rewrite it dramatically later. I started with a book inventory system. First I built a login and authentication system -- that builds a form, and queries the database to see if the userid and password are correct. Then I built a system to list what was in the book table for the database. Around the time I finished that, I realized I needed more granularity in user logins, so I went back and rebuilt the login tool. Then I realized I didn't actually have a way to add stuff to the DB, so I built that tool and so on. It ended up taking me something like a year, because I'd never looked at PHP before, and I've now scrapped the entire project and rebuilt it. Why? Because I did just about everything wrong. It just plain wasn't practical to try to fix it. I'd never learned the basics, I just threw myself at a big project to see what would happen. Good luck! -Andy McKenzie Excellent advise! When learning any language, those small steps you suggest is how I've always learned the language. A few years ago I ran across someone who didn't know a thing about programming but wanted to learn. The first project he wanted to tackle was to write his own online role playing game. You know, like World of Warcraft! Uh, yeah. I steered him away from that! Take care, Floyd All great advice but alas, I fear that my long-winded response that began all these succeeding advice columns has steered our OP away from this list. He thinks we're above his level (we are) and that he needs to start somewhere else, which means he'll probably repeat the mistakes that have been mentioned here. Oh, well you can only help those who ask for it, and only if they know what to do with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Oct 10, 2012, at 9:12 AM, Andy McKenzie wrote: > >>> Have you read a book on php and perhaps one on CSS to help >>> with your "hiding" problem? (BTW - that last was a hint.) >> >> I've read plenty of PHP books I own at least 5 and ALL of them I've read >> hardly ever explain anything at all. They just throw some code in there and >> say "this is what it does" and gives a picture of the finished product. Total >> waste of my money! Also, how am I going to learn PHP if I've got to mix it >> all >> up with CSS. It's just going to make things harder and more confusing on me. >> I >> only threw lightbox in there because I knew I didn't have to do or learn >> anything special and to put a smile on my face if it worked. After all, if it >> can't be fun, why do it? > > > I rarely post anything to this list, because almost everything asked > is above my level of understanding. But, speaking as a relative > beginner, I have a few comments here. > > 1) Books. I, too, have read a lot of PHP books. In the end, the ones > I've found most useful were by WROX press. Their "Beginning PHP4" by > Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to > programming" type books I've found for the way I learn. It's now > obsolete, but the core information is still good. I haven't read > through the Beginning PHP 5.3 version as thoroughly, but it also seems > to be pretty good. You might also want to check with local community > colleges to see if someone offers a basic course -- PHP, C, C++, > something like that. The language may be different, but the concepts > remain the same. > > 2) "They just throw some code in there and say "this is what it does" > and gives a picture of the finished product. Total waste of my money! > Also, how am I going to learn PHP if I've got to mix it all up with > CSS." > > This one's harder. These days CSS is part of the web, and you're > stuck with it if you want to do anything complex. So here's my > advice: Find something simple to experiment with. Don't start with a > complex project, start with something that doesn't actually do > anything useful. When I start trying to understand a function I > haven't used before, I build a new page called something like > "foo_test", where foo is the name of the function. These days it > might be ip2long_test, or something like that, but I still have some > in my test folder with names like "echo_test.php" where I was trying > to figure out how that function worked. Start there. Do something > simple. Lightbox may be too complex. Maybe build a fortune cookie > webpage, where every time you click a button it reloads with a new > fortune. Learn to pull fortunes out of a file and out of a database. > Once you've got the hang of that, start using CSS to change how it > looks. Once THAT's working right, figure out how to use JavaScript > (you're going to need it sooner or later!) and AJAX to make it reload > the fortune without reloading the whole page. > > Yeah, it's a boring project. But it's a stepping stone to doing > what you really want to do. The alternative is to do what I did: > start with a big project, and accept that you're going to rewrite it > dramatically later. I started with a book inventory system. First I > built a login and authentication system -- that builds a form, and > queries the database to see if the userid and password are correct. > Then I built a system to list what was in the book table for the > database. Around the time I finished that, I realized I needed more > granularity in user logins, so I went back and rebuilt the login tool. > Then I realized I didn't actually have a way to add stuff to the DB, > so I built that tool and so on. It ended up taking me something > like a year, because I'd never looked at PHP before, and I've now > scrapped the entire project and rebuilt it. Why? Because I did just > about everything wrong. It just plain wasn't practical to try to fix > it. I'd never learned the basics, I just threw myself at a big > project to see what would happen. > > Good luck! > > -Andy McKenzie Excellent advise! When learning any language, those small steps you suggest is how I've always learned the language. A few years ago I ran across someone who didn't know a thing about programming but wanted to learn. The first project he wanted to tackle was to write his own online role playing game. You know, like World of Warcraft! Uh, yeah. I steered him away from that! Take care, Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
>> Have you read a book on php and perhaps one on CSS to help >> with your "hiding" problem? (BTW - that last was a hint.) > > I've read plenty of PHP books I own at least 5 and ALL of them I've read > hardly ever explain anything at all. They just throw some code in there and > say "this is what it does" and gives a picture of the finished product. Total > waste of my money! Also, how am I going to learn PHP if I've got to mix it all > up with CSS. It's just going to make things harder and more confusing on me. I > only threw lightbox in there because I knew I didn't have to do or learn > anything special and to put a smile on my face if it worked. After all, if it > can't be fun, why do it? I rarely post anything to this list, because almost everything asked is above my level of understanding. But, speaking as a relative beginner, I have a few comments here. 1) Books. I, too, have read a lot of PHP books. In the end, the ones I've found most useful were by WROX press. Their "Beginning PHP4" by Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to programming" type books I've found for the way I learn. It's now obsolete, but the core information is still good. I haven't read through the Beginning PHP 5.3 version as thoroughly, but it also seems to be pretty good. You might also want to check with local community colleges to see if someone offers a basic course -- PHP, C, C++, something like that. The language may be different, but the concepts remain the same. 2) "They just throw some code in there and say "this is what it does" and gives a picture of the finished product. Total waste of my money! Also, how am I going to learn PHP if I've got to mix it all up with CSS." This one's harder. These days CSS is part of the web, and you're stuck with it if you want to do anything complex. So here's my advice: Find something simple to experiment with. Don't start with a complex project, start with something that doesn't actually do anything useful. When I start trying to understand a function I haven't used before, I build a new page called something like "foo_test", where foo is the name of the function. These days it might be ip2long_test, or something like that, but I still have some in my test folder with names like "echo_test.php" where I was trying to figure out how that function worked. Start there. Do something simple. Lightbox may be too complex. Maybe build a fortune cookie webpage, where every time you click a button it reloads with a new fortune. Learn to pull fortunes out of a file and out of a database. Once you've got the hang of that, start using CSS to change how it looks. Once THAT's working right, figure out how to use JavaScript (you're going to need it sooner or later!) and AJAX to make it reload the fortune without reloading the whole page. Yeah, it's a boring project. But it's a stepping stone to doing what you really want to do. The alternative is to do what I did: start with a big project, and accept that you're going to rewrite it dramatically later. I started with a book inventory system. First I built a login and authentication system -- that builds a form, and queries the database to see if the userid and password are correct. Then I built a system to list what was in the book table for the database. Around the time I finished that, I realized I needed more granularity in user logins, so I went back and rebuilt the login tool. Then I realized I didn't actually have a way to add stuff to the DB, so I built that tool and so on. It ended up taking me something like a year, because I'd never looked at PHP before, and I've now scrapped the entire project and rebuilt it. Why? Because I did just about everything wrong. It just plain wasn't practical to try to fix it. I'd never learned the basics, I just threw myself at a big project to see what would happen. Good luck! -Andy McKenzie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
Matijn Woudt wrote: >On Wed, Oct 10, 2012 at 12:06 AM, Tim Streater >wrote: >> On 09 Oct 2012 at 20:46, Matijn Woudt wrote: >> >>> For example your previous post, you >>> could have just looked up what the 'echo' and 'return' statements do >>> in the PHP manual, and they are probably explained pretty OK in >those >>> books you own too. You probably could have answered the questions >you >>> posted here yourself, after reading PHP manual carefully. >> >> Here, the phrase "PHP manual" means: >> >> http://www.php.net/manual/en/ >> >> which I consider to be an excellent written resource for the >language. In fact, I own no PHP books at all (whereas I do for >JavaScript/HTML/CSS/SQLite) so that must say something about the >quality of the on-line documentation. Further, it is written in a >straightforward way, not trying to be clever (unlike some languages I >could mention), so I can recommend it. It's available in languages >other than English, too. >> >> -- >> Cheers -- Tim >> > >Thanks Tim! Should have mentioned the URL indeed. >Don't forget that if you want to find the manual page for a function >fast, try >http://www.php.net/ >where is the name you're looking for, so for example >for return, you could use >http://www.php.net/return >And there ya go, PHP manual page for return! > >- Matijn > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php It also has the option to integrate as a search engine option within your browser too, so you can search right from the search bar without having to go to the site first; a feature I use all the time. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Tue, Oct 9, 2012 at 5:19 PM, Matijn Woudt wrote: > On Wed, Oct 10, 2012 at 12:06 AM, Tim Streater wrote: >> On 09 Oct 2012 at 20:46, Matijn Woudt wrote: >> >>> For example your previous post, you >>> could have just looked up what the 'echo' and 'return' statements do >>> in the PHP manual, and they are probably explained pretty OK in those >>> books you own too. You probably could have answered the questions you >>> posted here yourself, after reading PHP manual carefully. >> >> Here, the phrase "PHP manual" means: >> >> http://www.php.net/manual/en/ >> >> which I consider to be an excellent written resource for the language. In >> fact, I own no PHP books at all (whereas I do for >> JavaScript/HTML/CSS/SQLite) so that must say something about the quality of >> the on-line documentation. Further, it is written in a straightforward way, >> not trying to be clever (unlike some languages I could mention), so I can >> recommend it. It's available in languages other than English, too. >> >> -- >> Cheers -- Tim >> > > Thanks Tim! Should have mentioned the URL indeed. > Don't forget that if you want to find the manual page for a function fast, try > http://www.php.net/ > where is the name you're looking for, so for example > for return, you could use > http://www.php.net/return > And there ya go, PHP manual page for return! > > - Matijn > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > The problems don't seem to be quite in understanding PHP, but programming in general. O'Reilly this week has a special offer going on books on general programming, which I hope no one minds if i spam it in here: < http://shop.oreilly.com/category/deals/geek-code-owo.do?code=WKGKCD&imm_mid=0975a3&cmp=em-code-books-videos-geek-code-elist > The code is WKGKCD, which should automatically be applied. Disclaimer: I am not an employee or stakeholder in O'Reilly, I just like their books an awful lot, and they've helped me a great deal. That said, I have to say I only own 1 PHP book: PHP Cookbook, which I think is buried under quite a pile of stuff as I never have used it. Yes, the online PHP docu is *that* *good*. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Wed, Oct 10, 2012 at 12:06 AM, Tim Streater wrote: > On 09 Oct 2012 at 20:46, Matijn Woudt wrote: > >> For example your previous post, you >> could have just looked up what the 'echo' and 'return' statements do >> in the PHP manual, and they are probably explained pretty OK in those >> books you own too. You probably could have answered the questions you >> posted here yourself, after reading PHP manual carefully. > > Here, the phrase "PHP manual" means: > > http://www.php.net/manual/en/ > > which I consider to be an excellent written resource for the language. In > fact, I own no PHP books at all (whereas I do for JavaScript/HTML/CSS/SQLite) > so that must say something about the quality of the on-line documentation. > Further, it is written in a straightforward way, not trying to be clever > (unlike some languages I could mention), so I can recommend it. It's > available in languages other than English, too. > > -- > Cheers -- Tim > Thanks Tim! Should have mentioned the URL indeed. Don't forget that if you want to find the manual page for a function fast, try http://www.php.net/ where is the name you're looking for, so for example for return, you could use http://www.php.net/return And there ya go, PHP manual page for return! - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On 10/9/2012 3:46 PM, Matijn Woudt wrote: On Tue, Oct 9, 2012 at 9:18 PM, David McGlone wrote: On Tuesday, October 09, 2012 12:18:06 PM Jim Giner wrote: Sorry to be so blunt. It's fine I kinda figured I'd be either ignored, or yelled at when I asked and I now know that I need to be a professional to ask questions here so there went my confidence. -- David M. David, You really don't need to be a professional here to ask questions, but you can imagine that we're not going to write code for you. Some people expect professional support here (like they paid for it), and that's clearly not the case. We are all volunteers with our (limited) spare time. Therefore, you're expected to figure out most things out yourself (reading PHP manual, google, etc), and only ask here if you really can't figure things out. Then you can post what you have tried, and what you think it should do. For example your previous post, you could have just looked up what the 'echo' and 'return' statements do in the PHP manual, and they are probably explained pretty OK in those books you own too. You probably could have answered the questions you posted here yourself, after reading PHP manual carefully. - Matijn Matijn - well said. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
PLEASE SEE MY COMMENTS INTERSPERSED AND BELOW. (yes this is a top post) On 10/9/2012 3:18 PM, David McGlone wrote: On Tuesday, October 09, 2012 12:18:06 PM Jim Giner wrote: On 10/8/2012 11:11 PM, David McGlone wrote: Hi all, is there any other way to limit this code to only displaying 1 image other than using return. When I use return, I can't get the other images to display in lightbox, but when I use echo, all 5 of the images will correctly display in lightbox, but they are also displaying on the page. $result = mysql_query("SELECT * FROM properties"); $row = mysql_fetch_array($result); $matches = glob('images/property_pics/212006966/' .$prefix. '*'); foreach($matches as $match){ echo ""; I'm not even sure if this is possible, but thought I'd ask before I scrapped the idea. I've been at this code since last thursday trying to learn as much as I can about it and I just keep going in circles and I'm starting to feel like glob() is what is limiting me. I've tried various code blocks with things like where(), str_repeat, basename, scandir, sort etc with no luck. :-/ I hate to sound condescending, but you are showing some serious deficiencies in your programming ability. I have to say that you are tackling some very complex processes without the basic understanding of programming that one needs. What I base this opinion on is that since you first revealed your lack of understanding of Return and echo in php, you have spent another 3 days and STILL don't understand? Really? I was afraid when I first posted that question, it would give that impression. I've known what echo does, but not very much about return. Also a part of me has always wondered when I'm studying code from things like wordpress I don't think I have seen any echo statements. If I did it was very very few. (hint: why I asked about templeting systems about a month ago.) As for the code above - once again it looks like you have posted a re-typing of some code you have tried to execute. I say that because you have a query and a fetch of one record of the results THAT HAS NOTHING TO DO WITH THE REST OF THE CODE! The query is geting a number out of the database and putting the value in $prefix. NOT IN THIS SCRIPT!! Also - you have an array being used as part of the Rel tag? What's up with that? (I think you meant to use $match - but that further verifies that this is NOT the code you ran.) I tried using $match and $matches because I got confused there for a bit and changed it. $MATCH WOULD WORK; $MATCHES WOULD NOT. It's suppose to be a 'name' - so why would you put an array reference in the Rel attribute? Finally - the code is (from your description) doing exactly what it is designed to do (the running code that is). It sure is, and I found out what my whole problem was this morning before I went to work. My problem was lightbox was not putting all the images in $match. but I never suspected it until Matijn and Marco, posted an example of code and It turned my attention to the piece of code... put a bunch of images in a folder and try running the code. You'll see what I'm talking about. THATS' CAUSE YOU DIDN'T LABEL THEM WITH $MATCH! All the (repeated) "echo" statements are going to put something on your web page. Yes I was getting stuff on the page, and then when I'd try and build onto the idea, and things broke, I'd try something else, and something else, until finally I'm all confused with it. for example I'd forget to terminate something and get a blank screen and imediately suspect it was the new code I introduced. After the millionith time I started realizing when I get a blank screen, I forgot my semicolon at the end of a line somewhere. The question you have is (apparently) how to hide them, since I believe Lightbox is going to have to have them present in order to do its thing. That's part of it. the other part is that lighbox is supposed to do that automatically and it should, and that's another reason I was getting confused. like I said earlier run the code and you'll see what I'm saying. I HAVE USED LB - IT DOESN'T HIDE THINGS. IT DISPLAYS THINGS. THINGS THAT YOU PROVIDE - WHETHER YOU HAVE THEM HIDDEN OR NOT. Feel free to check out a site I developed - voorheesvilefd.org. This site uses plenty of php and LB to display random photos drawn from folders across the site. And so - in parting - I think you need to develop some html knowledge to facilitate that "hiding" part and some immediate skills in the general area of programming and learning to locate and read the right manuals. "Glob" is the least of your concerns. Yes - I'm being rough (I say this to you David as well as the rest of the community that is still interested in this post) but somebody has to make you realize that you are seriously in over your head and don't even know it. I've said it many times, I am doing this to try and further my knowledge in PHP and get past the
Re: [PHP] Re: limiting
On Tue, Oct 9, 2012 at 9:18 PM, David McGlone wrote: > On Tuesday, October 09, 2012 12:18:06 PM Jim Giner wrote: >> >> Sorry to be so blunt. > > It's fine I kinda figured I'd be either ignored, or yelled at when I asked > and I > now know that I need to be a professional to ask questions here so there went > my confidence. > > -- > David M. > David, You really don't need to be a professional here to ask questions, but you can imagine that we're not going to write code for you. Some people expect professional support here (like they paid for it), and that's clearly not the case. We are all volunteers with our (limited) spare time. Therefore, you're expected to figure out most things out yourself (reading PHP manual, google, etc), and only ask here if you really can't figure things out. Then you can post what you have tried, and what you think it should do. For example your previous post, you could have just looked up what the 'echo' and 'return' statements do in the PHP manual, and they are probably explained pretty OK in those books you own too. You probably could have answered the questions you posted here yourself, after reading PHP manual carefully. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting
On Tuesday, October 09, 2012 12:18:06 PM Jim Giner wrote: > On 10/8/2012 11:11 PM, David McGlone wrote: > > Hi all, > > > > is there any other way to limit this code to only displaying 1 image other > > than using return. When I use return, I can't get the other images to > > display in lightbox, but when I use echo, all 5 of the images will > > correctly display in lightbox, but they are also displaying on the page. > > > > $result = mysql_query("SELECT * FROM properties"); > > > >$row = mysql_fetch_array($result); > >$matches = glob('images/property_pics/212006966/' .$prefix. '*'); > >foreach($matches as $match){ > >echo " > > > $match>"; > > > > I'm not even sure if this is possible, but thought I'd ask before I > > scrapped the idea. I've been at this code since last thursday trying to > > learn as much as I can about it and I just keep going in circles and I'm > > starting to feel like glob() is what is limiting me. I've tried various > > code blocks with things like where(), str_repeat, basename, scandir, sort > > etc with no luck. :-/ > I hate to sound condescending, but you are showing some serious > deficiencies in your programming ability. I have to say that you are > tackling some very complex processes without the basic understanding of > programming that one needs. What I base this opinion on is that since > you first revealed your lack of understanding of Return and echo in php, > you have spent another 3 days and STILL don't understand? Really? I was afraid when I first posted that question, it would give that impression. I've known what echo does, but not very much about return. Also a part of me has always wondered when I'm studying code from things like wordpress I don't think I have seen any echo statements. If I did it was very very few. (hint: why I asked about templeting systems about a month ago.) > > As for the code above - once again it looks like you have posted a > re-typing of some code you have tried to execute. I say that because > you have a query and a fetch of one record of the results THAT HAS > NOTHING TO DO WITH THE REST OF THE CODE! The query is geting a number out of the database and putting the value in $prefix. > Also - you have an array > being used as part of the Rel tag? What's up with that? (I think you > meant to use $match - but that further verifies that this is NOT the > code you ran.) I tried using $match and $matches because I got confused there for a bit and changed it. > > Finally - the code is (from your description) doing exactly what it is > designed to do (the running code that is). It sure is, and I found out what my whole problem was this morning before I went to work. My problem was lightbox was not putting all the images in $match. but I never suspected it until Matijn and Marco, posted an example of code and It turned my attention to the piece of code... put a bunch of images in a folder and try running the code. You'll see what I'm talking about. > All the (repeated) "echo" > statements are going to put something on your web page. Yes I was getting stuff on the page, and then when I'd try and build onto the idea, and things broke, I'd try something else, and something else, until finally I'm all confused with it. for example I'd forget to terminate something and get a blank screen and imediately suspect it was the new code I introduced. After the millionith time I started realizing when I get a blank screen, I forgot my semicolon at the end of a line somewhere. > The question > you have is (apparently) how to hide them, since I believe Lightbox is > going to have to have them present in order to do its thing. That's part of it. the other part is that lighbox is supposed to do that automatically and it should, and that's another reason I was getting confused. like I said earlier run the code and you'll see what I'm saying. > And so - > in parting - I think you need to develop some html knowledge to > facilitate that "hiding" part and some immediate skills in the general > area of programming and learning to locate and read the right manuals. > "Glob" is the least of your concerns. > > Yes - I'm being rough (I say this to you David as well as the rest of > the community that is still interested in this post) but somebody has to > make you realize that you are seriously in over your head and don't even > know it. I've said it many times, I am doing this to try and further my knowledge in PHP and get past the basic echoing of variables and strings, and this is nothing more than practice. > Have you read a book on php and perhaps one on CSS to help > with your "hiding" problem? (BTW - that last was a hint.) I've read plenty of PHP books I own at least 5 and ALL of them I've read hardly ever explain anything at all. They just throw some code in there and say "this is what it does" and gives a picture of the finished product. Total waste of my money! Als
Re: [PHP] Re: Limiting Cpu usage
Hi, Wednesday, April 13, 2005, 8:20:46 AM, you wrote: z> Yeahh! i have made it z> i can slow down a php script , as i edited the zend engine source to usleep z> every 1000 low-level instructions z> now, is there a way to determine to check my cpu load and adjust it by that z> so if nothing (or very low cpu usage) is running on the system he'll get z> extra power? On Linux you can cat /proc/loadavg to get the current load (3rd number in) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Limiting Cpu usage
> but i must give them php support or else they coulnot do > anything on the server... > im limiting them by functions , safe mode and more.. I've known atleast one hosting operation that compile their own custom PHP, to limit the impact of problematic code. The only thing I can remember that was specifically done was alter mysql_pconnect() to call mysql_connect(). Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Limiting Cpu usage
On Sun, April 10, 2005 10:55 am, zini10 said: > Thought about that, but its a free host that will host many many users.ill > prefer them to have low cpu usage limit also if the system is free of > tasks > as that will never happen. > any user can come, prepare a script which will do a infinite loop and will > make the server slow for all other users. > thought about timeouts but the user can refresh and refresh the page for > ever. > the only idea other than limit cpu usage is to check for users which use > to > much cpu power for too long, and block them for running any script at all, > but an "Evil" user can signup many many times. Giving all and sundry un-trusted users access to PHP is akin to passing out free loaded hand-guns to every gang-banger, convicted criminal, and child under the age of 12. Don't do that. :-| Not everybody is as nice as you. Sorry. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Limiting repetitive file access
Hello, On 11/16/2003 04:32 PM, Andre Dubuc wrote: Sometimes I have that problem because some users of my site think they can use site sucking programs to get all its content. What was done is to have a script monitoring the Web server logs and if the same user of the same IP makes an excessive amount of accesses in a short period, add it to the list of denied addresses for a while. This way, the Web server will not even spare resources for abusing users. Since you use .haccess based permissions, you can just update that file regularly. I do not have that script quite ready for release now, but if there is interest, I can release it later as a part of this class that already provides log watching services: http://www.phpclasses.org/logwatcher Thanks Manuel, Actually I like your idea -- it is much better. However, I do not use .htaccess permissions -- When I tried uploading the .htaccess file into the docroot area of my site, and it froze the works! Basically the idea of using the webaccess log file - searching for repetitive usage over a defined period of time (in my case it was every second!) -- sounds good. Now, I just have to determine whether I can use .htaccess with my IP -- they have very restrictive rules. The advantage of .htaccess is that it is evaluated on each access. So, if you need to block certain IP addresses, you just update .htacess of the respective directory. That can be done by the user that owns the directory. Otherwise you may need to update the Web server configuration files and restart the Web server. For that you need root access. -- Regards, Manuel Lemos 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] Re: Limiting repetitive file access
On Sunday 16 November 2003 06:40 am, Manuel Lemos wrote: > Hello, > > On 11/16/2003 02:52 AM, Andre Dubuc wrote: > > Recently, a 'user' attempted to access a restricted area of my site > > repetitively (spanning five hours) entering the same url repetitively > > [probably by script]. A massive log file was generated. I would like to > > ban such behavior by limiting the number of successive 'get's a user can > > do (say 4 attempts) before an appropriate action is taken.. > > > > As a temporary measure (until I can figure a better way) the url in > > question was disabled. > > > > What I'd like to do, on a per-file basis using $_SESSION, is a > > combination of ipaddress perhaps with a counter that records the number > > of times that file was accessed, and limit the number of successive > > 'get's that can be done before the file is no longer accessible. > > This solutions will not avoid your problem. > > Sometimes I have that problem because some users of my site think they > can use site sucking programs to get all its content. > > What was done is to have a script monitoring the Web server logs and if > the same user of the same IP makes an excessive amount of accesses in a > short period, add it to the list of denied addresses for a while. This > way, the Web server will not even spare resources for abusing users. > > Since you use .haccess based permissions, you can just update that file > regularly. > > I do not have that script quite ready for release now, but if there is > interest, I can release it later as a part of this class that already > provides log watching services: > > http://www.phpclasses.org/logwatcher > > -- > > Regards, > Manuel Lemos > > Free ready to use OOP components written in PHP > http://www.phpclasses.org/ Thanks Manuel, Actually I like your idea -- it is much better. However, I do not use .htaccess permissions -- When I tried uploading the .htaccess file into the docroot area of my site, and it froze the works! Basically the idea of using the webaccess log file - searching for repetitive usage over a defined period of time (in my case it was every second!) -- sounds good. Now, I just have to determine whether I can use .htaccess with my IP -- they have very restrictive rules. Thanks again. Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: limiting lines
* dan <[EMAIL PROTECTED]> [010729 11:11]: > Problem is, the only new lines are at the end of paragraphs, so that, in > effect, is limiting them to 55 paragraphs. I'm using a wrap=physical> which says that it adds a "%0A%0D" (carriage return/line > feed) at the end of each line. > > Anyone know how to convert that to a "\n" ? I don't understand what you're saying about the new lines and end of paragraphs. But if you want to convert CRLF to LF, try: str_replace("\r\n","\n",$string); -- Jan Wilson, SysAdmin _/*]; [EMAIL PROTECTED] Corozal Junior College | |:' corozal.com corozal.bz Corozal Town, Belize | /' chetumal.com & linux.bz Reg. Linux user #151611 |_/ Network, SQL, Perl, HTML -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: limiting lines
Thanks for the quick answers. Problem is, the only new lines are at the end of paragraphs, so that, in effect, is limiting them to 55 paragraphs. I'm using a which says that it adds a "%0A%0D" (carriage return/line feed) at the end of each line. Anyone know how to convert that to a "\n" ? thanks again. Dan Mojolin: The Linux Employment Site http://mojolin.com > If you're expecting new lines, you could do this: > > $length = explode("\n", $message); > > if (sizeof($length) > 55) { > // error > } > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]