close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Opening Profile page

Thread began 6/10/2011 12:31 am by jen425288 | Last modified 6/18/2011 11:42 am by jen425288 | 2847 views | 26 replies

tom92909Beta Tester

Sorry for the 24hrs silence. I started over from scratch. The combination of your edits to my originals and your table differences to my original test table was really messing things up. So I duplicated your configuration as best as I could and started fresh...

Below is a functional (administrative) solution to what you are needing which does not require DataAssist. It does not use SecurityAssist either, but I have a few recommendations in regards to that.

1. Use Security Assist for an Admin User level for these pages.
2. Place these files behind a Secure Directory.

MySQL tables



Visitor Email Search page

html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form action="edituserprofile.php" method="post">
<table>
<tr>
<td nowrap="nowrap">Enter Email Address:</td><td>&nbsp;</td><td><input name="email" type="text" size="30" /></td><td>&nbsp;</td><td><input type="submit" value="Go" /></td>
</tr>
</table>
</form>
</body>
</html>



Edit User Profile page

php:
<?php require_once('Connections/securityAssist.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "update")) {
  
$updateSQL sprintf("UPDATE visitors SET VisitorFirstName=%s, VisitorLastName=%s, userLevel=%s WHERE VisitorID=%s",
                       
GetSQLValueString($_POST['FirstName'], "text"),
                       
GetSQLValueString($_POST['LastName'], "text"),
                       
GetSQLValueString($_POST['userLevel'], "int"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_securityAssist$securityAssist);
  
$Result1 mysql_query($updateSQL$securityAssist) or die(mysql_error());

  
$updateGoTo "visitoremailsearch.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}

$colname_getVisitors "-1";
if (isset(
$_POST['email'])) {
  
$colname_getVisitors = (get_magic_quotes_gpc()) ? $_POST['email'] : addslashes($_POST['email']);
}
mysql_select_db($database_securityAssist$securityAssist);
$query_getVisitors sprintf("SELECT * FROM visitors WHERE VisitorEmail = %s"GetSQLValueString($colname_getVisitors"text"));
$getVisitors mysql_query($query_getVisitors$securityAssist) or die(mysql_error());
$row_getVisitors mysql_fetch_assoc($getVisitors);
$totalRows_getVisitors mysql_num_rows($getVisitors);

mysql_select_db($database_securityAssist$securityAssist);
$query_rsUserLevel "SELECT * FROM groups ORDER BY GroupName ASC";
$rsUserLevel mysql_query($query_rsUserLevel$securityAssist) or die(mysql_error());
$row_rsUserLevel mysql_fetch_assoc($rsUserLevel);
$totalRows_rsUserLevel mysql_num_rows($rsUserLevel);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<h3>Update User: <?php echo $row_getVisitors['VisitorUserName']; ?><br />
VisitorID: <?php echo $row_getVisitors['VisitorID']; ?><br />
User Level: <?php echo $row_getVisitors['userLevel']; ?></h3>
<hr />
<form  action="<?php echo $editFormAction?>" method="POST" name="update">
<table>
 <tr> 
  <td>First name:</td><td>&nbsp;</td><td><input name="FirstName" type="text" size="30" value="<?php echo $row_getVisitors['VisitorFirstName']; ?>" /></td>
 </tr>
 <tr> 
  <td>Last name:</td><td>&nbsp;</td><td><input name="LastName" type="text" size="30" value="<?php echo $row_getVisitors['VisitorLastName']; ?>" /></td>
 </tr>
 <tr>
  <td>User Level:</td>
  <td></td>
  <td><select name="userLevel">
    <?php
do {  
?>
    <option value="<?php echo $row_rsUserLevel['GroupID']?>"<?php if (!(strcmp($row_rsUserLevel['GroupID'], $row_getVisitors['userLevel']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsUserLevel['GroupID']?></option>
    <?php
} while ($row_rsUserLevel mysql_fetch_assoc($rsUserLevel));
  
$rows mysql_num_rows($rsUserLevel);
  if(
$rows 0) {
      
mysql_data_seek($rsUserLevel0);
      
$row_rsUserLevel mysql_fetch_assoc($rsUserLevel);
  }
?>
  </select>
  </td>
 </tr>
</table>

<table>
 <tr>
  <td><input type="submit" value="Save" />
    <input name="id" type="hidden" value="<?php echo $row_getVisitors['VisitorID']; ?>" /></td>
 </tr>
<input type="hidden" name="MM_update" value="update" />
</table>
</form>
</body>
</html>
<?php
mysql_free_result
($getVisitors);

mysql_free_result($rsUserLevel);
?>



Attached are the two files for your convenience. Enjoy!

Tom :)

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...