0

I'm storing passwords in my Mysql database , these passwords have special characters . The passwords are storing fine but while retrieving these passwords , incomplete passwords are displayed , the password is not shown after less than sign '<'

For eg : this is the password -> abcxyz abcxyz

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1477731
  • 13
  • 2
  • 9

3 Answers3

3

I assume that you're displaying in on webiste using HTML. Then < is used to start a HTML tag , this is why you can't see them, but if you'll view source code then it should be there. If string contains special characters then you should escape them, e.g. with htmlspecialchars function.

As a side note, you shouln't store password as plain text (or display them).

Zbigniew
  • 27,184
  • 6
  • 59
  • 66
0

You should never store passwords as plain text! Never!

It is a security problem. Store a (salted) hash of it and you will also get rid of your problem since a hash does not contain special characters.

Community
  • 1
  • 1
juergen d
  • 201,996
  • 37
  • 293
  • 362
0

if you store special character in your database then it's not a good idea.for security reason use

//convert password into the hash as a 32-character hexadecimal number
1) md5 — Calculate the md5 hash of a string 
2) mysql_real_escape_string — Escapes special characters in a string for use in an SQL statement. 

this link will helpful if talk about database handling:-

How can I prevent SQL injection in PHP?

Community
  • 1
  • 1
Ankur Saxena
  • 629
  • 3
  • 13
  • 26