Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Luc de Brouwer
seal-mask
.a{fill-rule:evenodd;}techdegree
Luc de Brouwer
Full Stack JavaScript Techdegree Student 17,939 Points

OOP | Data escaping related question

Hi everyone,

I am developing a login system in OOP php and I was curious what the outcome of one particular line would be.

  public function clean($data)
  {
    if(!empty($data))
    {
      $data = trim(strip_tags(stripslashes(mysql_real_escape_string($data))));
      return $data;
    }
  }

        $username = $loginSystem->clean($_POST['username_']);
        $password = $loginSystem->clean($_POST['password_']);

If I use this function to literally 'clean' the input data, like for an username or password and I am using a special character password like 'FFe89!Gzt@r)6z'. Will my code clean the characters in my password?

Or a rather different question, how will this function behave for crud operations