RE: [PHP-DB] Password decryption
Hi, Note from the manual: PASSWORD() encryption is one-way (not reversible). Also note: === Note The PASSWORD() function is used by the authentication system in MySQL Server; you should not use it in your own applications. For that purpose, consider MD5() or SHA1() instead. Also see RFC 2195, section 2 (Challenge-Response Authentication Mechanism (CRAM)), for more information about handling passwords and authentication securely in your applications. === The way to do it is to encrypt the response password from the logon and compare the encrypted versions; rather than decrypting for the compare. Gary -Original Message- From: Nasreen Laghari [mailto:[EMAIL PROTECTED] Sent: Sat, February 16, 2008 10:18 PM To: php-db@lists.php.net Subject: [PHP-DB] Password decryption Hi, I'm junior in PHP and stuck on Encryption. I have encrypted password using SQL : $query = insert into user (userid,password,) values ('$username',Password('$pass'));; Which is working perfect. Now I'm working on Login page where I have to compare passwords.. As password in database is encrypted so I need to decrypt it back for compression. I have tried the flowing but not working. if ($pwd != Password($info['password'])) { echo(-); //header(Location: abuse.php); } and if ($pwd != $info(Password(['password'])) { echo(-); //header(Location: abuse.php); } Could any one please help.. Thank you __ __ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Password decryption
Nasreen Laghari wrote: Hi, I'm junior in PHP and stuck on Encryption. I have encrypted password using SQL : $query = insert into user (userid,password,) values ('$username',Password('$pass'));; Which is working perfect. Now I'm working on Login page where I have to compare passwords.. As password in database is encrypted so I need to decrypt it back for compression. I have tried the flowing but not working. if ($pwd != Password($info['password'])) { echo(-); //header(Location: abuse.php); } and if ($pwd != $info(Password(['password'])) { echo(-); //header(Location: abuse.php); } Could any one please help.. Thank you Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ the password is encrypted one way ( usually md5() ) so you must compare the encrypted hashes -- Matteo Cisilino Blog : http://matteo.cisilino.com CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help with MySql float
Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? Thanks Velen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySql float
Velen wrote: Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? Thanks Velen Hello Velen, Your question seem purely related to MySQL. Not very PHP related. Anyway... It depends on your version of MySQL. Check the documentation for Numeric Types. It says you can specify the number of decimals you want to store, something like FLOAT(max_digits,precision). If you need more precision, there's also the DOUBLE PRECISION. If your MySQL column is specified for higher precision already, then it could be a PHP issue. Is this the case? For MySQL = 5.0 http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html For MySQL 5.0 http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html /Tobias -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Password decryption
On Feb 16, 2008 10:17 PM, Nasreen Laghari [EMAIL PROTECTED] wrote: Hi, I'm junior in PHP and stuck on Encryption. I have encrypted password using SQL : $query = insert into user (userid,password,) values ('$username',Password('$pass'));; It's a one-way encryption method, so you won't be able to see the plain-text equivalent of the password again, but you can use this when testing a login: SELECT * FROM user WHERE userid='.$username.' AND password=PASSWORD('.$pass.'); Also, to correct your $query above, some things to note: PASSWORD is a reserved word in MySQL, so you shouldn't name any columns or databases as such. You have a comma after `userid,password,` in your column bracket. With PHP, you shouldn't end your MySQL query with a semicolon. The code needs it to terminate the line, the query doesn't. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySql float
On Feb 17, 2008 10:59 AM, Velen [EMAIL PROTECTED] wrote: Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? That's a MySQL question, not a PHP question, but my guess is that the column is set as FLOAT(x,2) (where x is any real number). Try changing that to FLOAT(10,4). The first number is everything to the left of the decimal, while the second is the number of places to count after the decimal. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Importing CSV files to MySql Db issue.
Chris Carter wrote: Is there something that has changed in the new MySql DB ? What new mysql? Has your host upgraded your database version or something? Mysql won't change the interface between versions except to improve it. I am trying to upload a data like this from my CSV file to a table through CSV upload and not CSV Load Data: Eh? You're using the csv table type or how are you importing the data? field1,field2,field3,field4,field5,field,6,field7,field8 field1,field2,field3,field4,field5,field,6,field7,field8 Parameters I am using are: Fields Terminated By: , Fields Enclosed By: _ (space character) Fields Escaped By: _ (space character) Every time I am getting this error: Invalid field count in line 1 If you're using spaces for enclosing then I'm sure you're not handling something properly. Chris,Carter,[EMAIL PROTECTED] -- 3 records Chris Carter,[EMAIL PROTECTED] -- 2 records The second one is probably going to break because of the space in the middle of the name. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySql float
Daniel Brown wrote: On Feb 17, 2008 10:59 AM, Velen [EMAIL PROTECTED] wrote: Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? That's a MySQL question, not a PHP question, but my guess is that the column is set as FLOAT(x,2) (where x is any real number). Try changing that to FLOAT(10,4). The first number is everything to the left of the decimal, while the second is the number of places to count after the decimal. Also note that a float type is not guaranteed to come back the same as it goes in (and this will also affect maths operations) - so if you need 4 decimal places, then use decimal or numeric as the data type. http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html MySQL performs rounding when storing values, so if you insert 999.9 into a FLOAT(7,4) column, the approximate result is 999.0001. The DECIMAL and NUMERIC data types are used to store exact numeric data values. . These types are used to store values for which it is important to preserve exact precision, for example with monetary data. This is the same in any db, it's not a mysql specific behaviour. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Importing CSV files to MySql Db issue.
Chris, If you're using spaces for enclosing then I'm sure you're not handling something properly. Chris,Carter,[EMAIL PROTECTED] -- 3 records Chris Carter,[EMAIL PROTECTED] -- 2 records Don't you mean: Chris,Carter,[EMAIL PROTECTED] -- 3 *fields* Chris Carter,[EMAIL PROTECTED] -- 2 *fields* And both only result in one record for each CSV line? Or do PHP and MySql handle CSV files different from most other applications? Gary -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Importing CSV files to MySql Db issue.
Gary Wardell wrote: Chris, If you're using spaces for enclosing then I'm sure you're not handling something properly. Chris,Carter,[EMAIL PROTECTED] -- 3 records Chris Carter,[EMAIL PROTECTED] -- 2 records Don't you mean: Chris,Carter,[EMAIL PROTECTED] -- 3 *fields* Chris Carter,[EMAIL PROTECTED] -- 2 *fields* And both only result in one record for each CSV line? Ah yes - sorry about that :) -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Importing CSV files to MySql Db issue.
I am not using spaces for closing. Every field is tightly packed with comma only. No spaces, no semicolon. The reason I used space is if I use space at least 3 or 4 fields get uploaded but not all. But we can ignore space for now as it happened earlier. I am using the CSV import option from MySql admin. Still stuggling, Thanks, Chris chris smith-9 wrote: Chris Carter wrote: Is there something that has changed in the new MySql DB ? What new mysql? Has your host upgraded your database version or something? Mysql won't change the interface between versions except to improve it. I am trying to upload a data like this from my CSV file to a table through CSV upload and not CSV Load Data: Eh? You're using the csv table type or how are you importing the data? field1,field2,field3,field4,field5,field,6,field7,field8 field1,field2,field3,field4,field5,field,6,field7,field8 Parameters I am using are: Fields Terminated By: , Fields Enclosed By: _ (space character) Fields Escaped By: _ (space character) Every time I am getting this error: Invalid field count in line 1 If you're using spaces for enclosing then I'm sure you're not handling something properly. Chris,Carter,[EMAIL PROTECTED] -- 3 records Chris Carter,[EMAIL PROTECTED] -- 2 records The second one is probably going to break because of the space in the middle of the name. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/Importing-CSV-files-to-MySql-Db-issue.-tp15514806p15538890.html Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Importing CSV files to MySql Db issue.
Chris Carter wrote: I am not using spaces for closing. Every field is tightly packed with comma only. No spaces, no semicolon. The reason I used space is if I use space at least 3 or 4 fields get uploaded but not all. But we can ignore space for now as it happened earlier. Then your issue will be a comma in your data. Header: Company Name, Name #1: Widget Co, Chris #2: Widget Co, New York, Chris #1 will work fine. #2 will be seen as company name - Widget Co Name - New York Extra data - Chris at the end. Enclose your entries with something ( or ' or ~ or something else that's not going to be in your data). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php