Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MD5 in oracle

Posted on 2003-10-24
5
Medium Priority
?
3,813 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 60 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

604 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