The Saint Posted August 5, 2007 Share Posted August 5, 2007 Can someone tell me why my database is encrypting passwords, changing into numbers and lettters. The reason this effects me is because when i try to log in the database only allows me to log in with the encrypted pass. How do i change it so it dosen't code it? Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/ Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 It's only doing what you tell it to. Either your create user code is telling it to encrypt or you're encrypting it with some sort of MySQL encryption function. Figure out why it's being encrypted then we can help you go from there. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315805 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 It's only doing what you tell it to. Either your create user code is telling it to encrypt or you're encrypting it with some sort of MySQL encryption function. Figure out why it's being encrypted then we can help you go from there. i know i tried all the combinations i dont know what setting it needs to be on Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315807 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Are you using a form to create the new users/passwords or doing it through a database admin interface such as phpMyAdmin? Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315809 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 Are you using a form to create the new users/passwords or doing it through a database admin interface such as phpMyAdmin? yea when i sign up the passwords go to my tables in phpmyadmin i dont want to uncrpty all the passes to lose security but only uncrypt the passwords that are sent to db user table USERS Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315816 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 So you're saying that you specified some sort of encryption in the DB then? Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315821 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Typically I use either crypt and md5 hashes to encrypt the passwords when putting them into the database (these functions are non-reversable and very secure when used appropriately). Then the trick is encrypting the password that the user gives you and comparing encrypted to encrypted instead of trying to encrypt/decrypt anything. Theres no need to store passwords clear text. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315823 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 So you're saying that you specified some sort of encryption in the DB then? yes exactly i was playing around with this thing and u could edit fields,type,lengths , ect and i kept tryna see what happened it changed but didnt show so if this would change what do i have to change it too Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315829 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 Typically I use either crypt and md5 hashes to encrypt the passwords when putting them into the database (these functions are non-reversable and very secure when used appropriately). Then the trick is encrypting the password that the user gives you and comparing encrypted to encrypted instead of trying to encrypt/decrypt anything. Theres no need to store passwords clear text. Well that is a problem because itll only allow me to log in with the encrypted password Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315831 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Well I believe that the MySQL encryption stuff is reversable so in theory you could run a query specifying the appropriate decryption function to pull out all the current usernames and passwords. I still think the md5/crypt approach is way better for passwords. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315834 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 Well I believe that the MySQL encryption stuff is reversable so in theory you could run a query specifying the appropriate decryption function to pull out all the current usernames and passwords. I still think the md5/crypt approach is way better for passwords. could u possibly make one for me, ovarall view is i sign up, try and log in it dont work. end of story lol Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315839 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 I don't know the encryption functions you're using and the "salt" being passed to them. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315842 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 I don't know the encryption functions you're using and the "salt" being passed to them. php is very complicated :-\ why is it even encrypted any if i am the person at localhost Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315844 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Argh, it doesn't sound like PHP is encrypting anything... it sounds like the database. Without knowing what you've done it's really hard to say. I don't know what version of MySQL you're using but some of this may or may not help you. It varies slightly depending on version. http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315847 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 Argh, it doesn't sound like PHP is encrypting anything... it sounds like the database. Without knowing what you've done it's really hard to say. I don't know what version of MySQL you're using but some of this may or may not help you. It varies slightly depending on version. http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html nothing there i understood Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315856 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Heh, well without knowing everything that you've done I'm not sure that I can help you... sorry buddy. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315860 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 Heh, well without knowing everything that you've done I'm not sure that I can help you... sorry buddy. well is there ANYONE her have any possible other solutions wont hurt to try Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315862 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Give some more details on the situation. You're not giving a lot to work with. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315864 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 Give some more details on the situation. You're not giving a lot to work with. Okay ive went throught ALOT just to create a basic form Here are all my files <a href="http://thesaintcodes.eamped.com/post6.html#6">register.php</a> <a href="http://thesaintcodes.eamped.com/post7.html#7">login.php</a> <a href="http://thesaintcodes.eamped.com/post8.html#8">do_login.php</a> <a href="http://img523.imageshack.us/img523/6455/taskjk1.png">db:user table:users(snapshot)</a> <a href="http://img106.imageshack.us/img106/650/images1td1.png">Browse Table(Snpashot Fullscreen)</a> Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315874 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 $password = md5($password); in register.php this is where you are encrypting it. So when you're doing your select you simply need to encrypt the raw data so that you are comparing apples to apples (encrypted to encrypted) rather than (raw to encrypted) which won't work. Furthermore you should salt crypt/md5 hashes or they can and probably will be cracked. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315880 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 $password = md5($password); in register.php this is where you are encrypting it. So when you're doing your select you simply need to encrypt the raw data so that you are comparing apples to apples (encrypted to encrypted) rather than (raw to encrypted) which won't work. Furthermore you should salt crypt/md5 hashes or they can and probably will be cracked. ??? uhm confused so what do i need to change about $password = md5($password); <--that? Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315885 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 blah, you're killing me. You didn't write any of this script did you? In you're do_login.php file change: $sql = "SELECT id FROM users WHERE username='".$_POST[username]."' And password='".$_POST[password]."'"; to $sql = "SELECT id FROM users WHERE username='".$_POST[username]."' And password='". md5($_POST[password]) ."'"; and it should work. That being said, without a salt this is definately not the best way to do it... but it should let you login. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315888 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 blah, you're killing me. You didn't write any of this script did you? In you're do_login.php file change: $sql = "SELECT id FROM users WHERE username='".$_POST[username]."' And password='".$_POST[password]."'"; to $sql = "SELECT id FROM users WHERE username='".$_POST[username]."' And password='". md5($_POST[password]) ."'"; and it should work. That being said, without a salt this is definately not the best way to do it... but it should let you login. haha yea lemme try it sorry im like a n00b compared to this i only help people with basic logic Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315889 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 And please continue to do so. I dunno it's a matter of opinion I guess but I personally will not use anyone else's scripts without knowing exactly how they work. Without knowing you can't do maintenance, debug... and there could be security holes. If you want to use scripts available online or whatever it's fine but I'd suggest you make sure you understand the logic before going live with them. Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315893 Share on other sites More sharing options...
The Saint Posted August 5, 2007 Author Share Posted August 5, 2007 And please continue to do so. I dunno it's a matter of opinion I guess but I personally will not use anyone else's scripts without knowing exactly how they work. Without knowing you can't do maintenance, debug... and there could be security holes. If you want to use scripts available online or whatever it's fine but I'd suggest you make sure you understand the logic before going live with them. Topic Solved! HAHA ur BALLIN Thankks for the help Quote Link to comment https://forums.phpfreaks.com/topic/63366-solved-password-encrypt/#findComment-315895 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.