LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-30-2012, 06:27 AM   #1
mscoder
LQ Newbie
 
Registered: Jun 2011
Posts: 18

Rep: Reputation: Disabled
php sha2() function


i am using php-mysql for a project in which i am storing
passwords in table in encrypted form.
Code:
$sql_insert = mysql_query("INSERT INTO       userinfo(full_name,id,pass,email,address,contact)
		    VALUES
		    ('$full_name','$uid',SHA2(CONCAT('$pass1','$uid'),1024),'$email','$address','$contact')");
m usind sh2() function here for encryption.My problem occurs when i try to use this function in a place thats not an sql query like:
Code:
 $en_entered_pass=SHA2(CONCAT('$password','$username'),512);
Here i am trying to use this encryption and store the value in another variable but is shows error that function not recognized.why? is it not supported by php itself? if so, is there no way to store the encrypted password in some temporary variable??

Last edited by mscoder; 11-30-2012 at 06:28 AM.
 
Old 12-01-2012, 06:33 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
At a guess CONCAT is a SQL function and so you want something like:
Code:
$en_entered_pass=SHA2($password + $username,512);
 
  


Reply

Tags
php


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP Array to Tuple: Is there a built-in php function that does this? rm_-rf_windows Programming 3 04-18-2012 06:25 PM
PHP/MySQL | insert on duplicate key run php function?? xsyntax Programming 2 09-10-2010 03:14 AM
PHP: How to can a PHP function without refreshing the page? frenchn00b Programming 6 04-23-2009 04:57 PM
calling a function from within another function in php jayakrishnan Programming 2 06-19-2007 08:36 AM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 12:08 PM


All times are GMT -5. The time now is 01:18 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration