Solved

MD5 in oracle

Posted on 2003-10-24
5
3,700 Views
Last Modified: 2013-12-12
hi
a very small question that , i am getting error if i write like this, i want to create login/logout for my web interface using PHP, i am using oracle

insert into users(user_id, username, password) values(1,'test', md5('test'));

can any one tell be how should i write .
As i know The md5() function is built into PHP, and will convert your password into a 32 character string. This is one good method for encrypting password information
 
desc users

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 USER_ID                                   NOT NULL NUMBER(10)
 USERNAME                                  NOT NULL VARCHAR2(20)
 PASSWORD                                  NOT NULL VARCHAR2(32)

thx
0
Comment
Question by:manish14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:ThG
ID: 9619071

i don't have oracle here to test but it should work. First, report the error you are getting, second try:
select md5('test');

if that shouldn't work, you can still insert "values (1,'test','" . md5("test") . "');
0
 

Author Comment

by:manish14
ID: 9625841
error is ORA-00904: "MD5": invalid identifier

i tried your solution, i am getting password field like this, is it correct way to encrypt the password

 select * from users;

   USER_ID USERNAME             PASSWORD
---------- -------------------- --------------------------------
         1 test                 " . md5("test") . "
0
 
LVL 14

Expert Comment

by:ThG
ID: 9626950
what's that?! you inserted the raw string!
you need proper escaping.. please note that my md5() was a PHP function, not an ORACLE function like yours (that actually doesn't exist..)

Please keep quotes consistent:

$query = "insert into users(user_id, username, password) values(1,'test', " . md5("test") . ");";
0
 
LVL 14

Accepted Solution

by:
ThG earned 20 total points
ID: 9626955
whops.. this is the correct one:

$query = "insert into users(user_id, username, password) values(1,'test', '" . md5("test") . "');";
0
 

Author Comment

by:manish14
ID: 9641704
md5  didn't work in insert statement for me so i put md5 in the begning , like this i am inserting already encrypted value.

thx for your comment
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question