FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how to do auto break..?





molif
i need help..

i have a textarea.. if i were to type as below:

Quote:
i need to vomit.
so, i go to the toilet.
and vomit


and when i press submit, the query goes into my sql database..

BUT..

if i print it out from the database, it appears in a single query like this:

Quote:
i need to vomit.so, i go to the toilet.and vomit


i can solve it by typing like this:

Quote:
i need to vomit.<br>
so, i go to the toilet.<br>
and vomit<br>


BUT, obviously, itz very inconvenient if that someone doesnt know html..

so, when submit, or any way tt i could hve auto break...?
snowboardalliance
http://us3.php.net/manual/en/function.nl2br.php

sould do it, I think...
molif
GREAT...

its done....... thanx..

btw.. i love TBS too..
Rhysige
Dont forget to use mysql_real_escape_string on everything that goes into the query...
molif
what is that..?

can explain..?
hexkid
molif wrote:
what is that..?

can explain..?


Because I can input into the textarea something like
Quote:
I like Mc'Donalds.
and break your script when it tries to
Code:
$sql = "insert table (txt) values('I like Mc'Donalds.')";
mysql_query($sql); // oops
Rhysige
it adds \ to all things which would interfere with the query.. prevents dodgy inputs.

like hexkid said though most likely you do something like..

Code:

//lets say they entered
stuff' OR 1=1'

$sql = SELECT * FROM `users` WHERE `password`='$password'


Basically you alter what the query Runs as, this is known as SQL Injection.
molif
hahaha

i still don get it guys..

like... wat is the purpose..?

i don get the idea/purpose behind it...
Related topics
Okay, I'm done trying to use CSS for layout.
auto refresh
Auto redirect your visitors to a different page
Grand Theft Auto: Liberty City Stories
Importing an existing database...
(official) Firefox & Thunderbird 1.5 Beta2 Now Available
Auto-Surfers
How to Protect ur windows System
Auto-cura da SIDA - opiniões
Flash Theft Auto
break dance
writing COM components in Perl
An Example to mySQL class
Am I allowed to install these?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.