This is a discussion on "Infinite Loop" within the PHP Forum section. This forum, and the thread "Infinite Loop are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Infinite Loop
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Infinite Loop
I recently got a formal warning by my web hosting provider for having bad code and crashing one of thier shared servers :S.
This is why;
|
|
|
|
|||
|
Re: Infinite Loop
That is not (inless you refer it to itself) an infinite loop ... and in any case, there's a timeout on such things in PHP so they should not crash the server. It IS a script that is open to injection attacks as malicious site visitors could fillin your "category" box with something starting "http://" or "/" and pick up code from other accounts on the same shared server, or other servers.
You should add code to check your "category" and "home" inputs to ensure that they only contain letters or digits, or validate them against a fixed list of whats's allowed, or something like that. To get you started if (! eregi('[a-z0-9]]+$',$_GET['category'])) { ..... will check if the category input is just letters and digits |
|
|||
|
Re: Infinite Loop
Thanks for that Grahame,
Yeah I relised that that piece of code wasnt the one that crashed it. I have another problem, the links now work fine except that I get an error when you open up the index.php file itself, and you must click on a link to not get an error, I cant set the inital page. |
![]() |
| Tags |
| infinite, loop, problem, website |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Do a while loop once? | Jack Franklin | PHP Forum | 2 | Feb 15th, 2008 11:07 |
| The Loop (Again) | Blake121 | Free Web Site Critique | 16 | Sep 7th, 2007 13:57 |
| The Loop V2 | Blake121 | Free Web Site Critique | 8 | May 15th, 2007 09:37 |
| The Loop | Blake121 | Free Web Site Critique | 5 | May 1st, 2007 14:25 |
| Loop??? | tazek0 | Classic ASP | 0 | Jan 27th, 2006 07:38 |