| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | Injection (php-mysql) I have got a problem with a character. I do not know which one it is. I am inserting long text files into database and sometime i can not insert. Any idea which character can it be? I am using this code PHP Code: |
| |
| | #2 (permalink) |
| Senior Member | The easy way to fix this problem is to use mysql_real_escape_string() on your input this will ensure that any relevant characters are escaped. Oh and by the way stop using addslashes it is far from ideal, if you use the above mentioned function then the addslashes function is not needed (and can cause problems) anyway. I would also check and see if you have magic_quotes_gpc enabled (most hosts do). If that is the case reverse what this feature does or disable it using a .htaccess file if you are able too. In fact while you are at it disable register_globals.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #3 (permalink) |
| NamePros Member | PHP Code: thanks |
| |
| | #4 (permalink) |
| Senior Member | yes thats fine, just a note I do not know what the content of $type should be but you should run the function on that as well.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #5 (permalink) |
| NamePros Member | it did not work. Same problem. then i used this code but same problem again. I do not know if this code is ok PHP Code: |
| |
| | #6 (permalink) |
| Senior Member | echo out the query and post it here, also a copy of the error message you receive. Ahh and just noticed. Do the mysql_real_escape_string lines after the following not before, i never noticed it before:- PHP Code:
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #7 (permalink) |
| NamePros Member | This is the code i used PHP Code: Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. |
| |
| | #8 (permalink) |
| Senior Member | That seems completely unrelated.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #10 (permalink) |
| Senior Member | invalid characters should not cause a Service Temporarily Unavailable if it does then there is something seriously wrong.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #12 (permalink) |
| Senior Member | Why are you replacing them with a space? They will not be causing you any problem and in fact you are losing formatting by doing this.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #14 (permalink) |
| Senior Member | it shouldn't do, mysql_real_escape_string takes into account the charset that is in use. Anyway if the charset was the problem you should see a mySQL error being generated.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft Last edited by peter@flexiwebhost; 11-23-2007 at 03:31 PM. |
| |
| | #19 (permalink) | |
| NamePros Member | Quote:
PHP Code: | |
| |
| | #20 (permalink) |
| Senior Member | i cant see why having the string wget would cause problems unless you were running it through exec or something like that.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #21 (permalink) | |
| NamePros Member | Quote:
I deleted that word from the post and it worked fine. I tried to enter onlt the word "wget " and it fails. | |
| |
| | #24 (permalink) | |
| NamePros Member | Quote:
I just made a simple script to try one by one if the problem is "wget " I can insert "wget" but not "wget " here is the simple code i am using. PHP Code: Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. | |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |