Jump to content
MakeWebGames

help! asap!


Nicholas

Recommended Posts

hi, im having a huge problem and cant figure out why its happening!

say someone on my game puts

 

hi, welcome to blah blah

the requirements to join is the following...

strength, agility, defence in hall of fame

active daily

 

but some reason it comes out like this

 

hi, welcome to blah blah the requirements to join is the following... strength, agility, defence in hall of fame active daily

 

it doesnt allow enter bars (drop down a line)

any idea why it would be doing this?

Link to comment
Share on other sites

Well, it might not work depending on where you are using it. I assumed you'd be using it when you output the text on a web page.

nl2br() converts all your new lines into

tags so if you output text with newlines on an html page, it will display correctly.

If you're displaying it in a text field, of course it will show

, html is not rendered in form fields.

Also, if you are using code like htmlentities after you use nl2br, it will convert all the < and > to html entities.

Link to comment
Share on other sites

ahh ha i think i figured the bloody thing out!

i added this to globals.php

 

function anti_inject($campo)
{
   foreach($campo as $key => $val)
   {
       $val = mysql_real_escape_string($val);
       // store it back into the array
       $campo[$key] = $val;
   }
   return $campo; //Returns the the var clean
}

//the next two lines make sure all post and get vars are filtered through this function
$_POST = anti_inject($_POST);
$_GET = anti_inject($_GET);
Link to comment
Share on other sites

ive only been coding for just over 3 months lol, and im kinda a slow learner lol.

also ive tried searching for security stuff on google, im not a good searcher lol.

cant find any tips at all...

i do happen to have a "essential PHP Security" book made by Chris Shiflett tho... im gonna try and learn them the book about security.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...