I'm able to encrypt the passwords enetered as such: [code] <?php require_once('Connections/access.php'); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['textfield'])) { $loginUsername=$_POST['textfield']; $password=$_POST['textfield2']; $MM_fldUserAuthorization = "group"; $MM_redirectLoginSuccess = "index.php"; $MM_redirectLoginFailed = "login.php"; $MM_redirecttoReferrer = true; mysql_select_db($database_access, $access); $LoginRS__query=sprintf("SELECT name, pass, `group` FROM users WHERE name='%s' AND pass=AES_ENCRYPT('%s','TEXT_STRING_PASSWORD')", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $access) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = mysql_result($LoginRS,0,'group'); //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && true) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?>[/code] This line: [code] $LoginRS__query=sprintf("SELECT name, pass, `group` FROM users WHERE name='%s' AND pass=AES_ENCRYPT('%s','TEXT_STRING_PASSWORD')",[/code] The problem is trying to get them unencrypted. It's no problem if I specify the username as such: [code]<?php require_once('Connections/access.php'); if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = "admin"; $MM_donotCheckaccess = "false"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && false) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "login.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } mysql_select_db($database_access, $access); $query_Recordset1 = "SELECT AES_DECRYPT(pass, 'TEXT_STRING_PASSWORD') AS decrypt FROM users WHERE name = 'SPECIFIED_USERNAME_HERE'"; $Recordset1 = mysql_query($query_Recordset1, $access) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> [/code] I'd like to be able to pass that unencrypted password to the 'decrypted' variable based on the session username, similar to the code below: [code] $colname_Recordset1 = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_access, $access); $query_Recordset1 = sprintf("SELECT * FROM users WHERE name = '%s'", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $access) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); [/code] Any suggestions? I'm ready to give up and keep them in plain-text. The problem is that I'm storing several set of password to pass on to other forms on other server (sort of a half-assed single sign-on password repository). So I NEED to be able to pass them unencrypted.