Jump to content

mikejr

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mikejr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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.
  2. Question One: I never use it. Question two: try viewing in something other than ie. This is just a by-product of using css/div/layers. You can sometimes work around it with placement and ordering.
  3. Since noone else replied I'll take a stab. Nothing Fancy! First you will need a server running php/MySQL (obviously) Next, you need a basic log in page: Add a table to you db via phpmyadmin(or whatever) with three fields. One named id(make auto increment, primary), one named username, and one named password. Go ahead and insert a couple users into the db for testing. Create a form with two fields, user and password. Using the Application Menu in DW, add a recordset to the page using the DB you just set up. Select Log in User from the same menu and set that up as you like. OK, so you have a db, and you have the users stored in it. keep in mind the passwords are stored in the db as plain text, so it's not that secure. You can similarly make pages to add records to the db, modify ect... You can protect pages via user/pass or level as well. This should get you started. Good Luck! Add content the same way.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.