Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Member Account Page Problem

New Here ,
Jul 12, 2009 Jul 12, 2009

Copy link to clipboard

Copied

Hello Dreamweaver Professional. I am currently having some problems with my app developement. I have a user/member sections for my client and within it he would like to have an "Member Accout" page that the member's can go and update there personal info. So I created a "Record Set" to the members table in MySQL database. So when the member logs in to the "Member Section" they have a button that is visible to them. It says "Member Account". The code that I link to the account page is the following:

memaccount.php?id=<?php echo $row_rsMembers['id']; ?>

The frustrating thing is that when they go to that page the 1st record information appears in my Update Form, not there info. I also used the "Record Update Form Wizard" on my account page.In the "Member Account" page I created the record set that has the following filter:

id = URL "id"

If you would like to look at the website it is www.patsentriders.org on the login page you can use the following:

Username - test

Password - test

What could be done to fix this problem? (I am using Dreamweaver CS3)

TOPICS
Server side applications

Views

936
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2009 Jul 12, 2009

Copy link to clipboard

Copied

The link is using ID #1, so it probably is not being passed to the member.php page correctly. This could be related to the error message that is displayed:

Warning:  session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /hermes/bosweb/web091/b913/sl.greywolf135/public_html/mems/member.php:1) in /hermes/bosweb/web091/b913/sl.greywolf135/public_html/mems/member.php on line 5

This message could indicat that you are using a redirect after the page headers have already been sent. We would have to review the code on the form processing script to see what is happening, but you should check to make sure that nothing that would send the header data to the browser is in your code prior to the redirect. Search the web for 'Cannot send session cache limiter - headers already sent' for more causes and fixes.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 12, 2009 Jul 12, 2009

Copy link to clipboard

Copied

Hey bergent. Here is the form processing the script:

<?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['username1'])) {
  $loginUsername=$_POST['username1'];
  $password=$_POST['password1'];
  $MM_fldUserAuthorization = "level";
  $MM_redirectLoginSuccess = "member.php";
  $MM_redirectLoginFailed = "login.php?failed=Either your Username or Password is incorrect. Or you do not have the correct access level.";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_Members, $Members);
  
  $LoginRS__query=sprintf("SELECT username, password, level FROM members WHERE username=%s AND password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  
  $LoginRS = mysql_query($LoginRS__query, $Members) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
   
    $loginStrGroup  = mysql_result($LoginRS,0,'level');
   
    //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 );
  }
}
?>

I used the "Login In User" server behavior from Dreamweaver. I also have the registration form on the same page as the login form. And with that the registration form is using the "Insert Record" server behavior. Could that be causing the issue too?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2009 Jul 12, 2009

Copy link to clipboard

Copied

The problem is that you are sending html to the browser before calling the session start. If you want to combine the form and script on the same page, you need to have the script first, before ANY html.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 12, 2009 Jul 12, 2009

Copy link to clipboard

Copied

I thought I did because the script that you see is on top of the <HTML> tag.

Is that were it should go?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2009 Jul 12, 2009

Copy link to clipboard

Copied

Can you paste the entire page code?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 13, 2009 Jul 13, 2009

Copy link to clipboard

Copied

LATEST

Hey bergent,

here is the entire code for you...

<?php require_once('../Connections/Members.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_insert"])) && ($_POST["MM_insert"] == "register")) {
  $insertSQL = sprintf("INSERT INTO members (fname, lname, bikename, username, password, address, city, `state`, postal, country, phone, alt_phone, email1, `comment`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['fname'], "text"),
                       GetSQLValueString($_POST['lname'], "text"),
                       GetSQLValueString($_POST['bikername'], "text"),
                       GetSQLValueString($_POST['username2'], "text"),
                       GetSQLValueString($_POST['password2'], "text"),
                       GetSQLValueString($_POST['address'], "text"),
                       GetSQLValueString($_POST['city'], "text"),
                       GetSQLValueString($_POST['state'], "text"),
                       GetSQLValueString($_POST['postalcode'], "text"),
                       GetSQLValueString($_POST['country'], "text"),
                       GetSQLValueString($_POST['phone'], "text"),
                       GetSQLValueString($_POST['alt_phone'], "text"),
                       GetSQLValueString($_POST['email1'], "text"),
                       GetSQLValueString($_POST['comment'], "text"));

  mysql_select_db($database_Members, $Members);
  $Result1 = mysql_query($insertSQL, $Members) or die(mysql_error());

  $insertGoTo = "login.php?submit=Thank you for submitting your info. Your info is being process. Look to be contacted by email within 2 days.";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_Members, $Members);
$query_rsMembers = "SELECT * FROM members";
$rsMembers = mysql_query($query_rsMembers, $Members) or die(mysql_error());
$row_rsMembers = mysql_fetch_assoc($rsMembers);
$totalRows_rsMembers = mysql_num_rows($rsMembers);
?>
<?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['username1'])) {
  $loginUsername=$_POST['username1'];
  $password=$_POST['password1'];
  $MM_fldUserAuthorization = "level";
  $MM_redirectLoginSuccess = "member.php";
  $MM_redirectLoginFailed = "login.php?failed=Either your Username or Password is incorrect. Or you do not have the correct access level.";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_Members, $Members);
  
  $LoginRS__query=sprintf("SELECT username, password, level FROM members WHERE username=%s AND password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  
  $LoginRS = mysql_query($LoginRS__query, $Members) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
   
    $loginStrGroup  = mysql_result($LoginRS,0,'level');
   
    //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 );
  }
}
?>
<!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" dir="ltr" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Patriot Sentinel Riders | Login</title>

<style type="text/css">

.contentContainer
{
padding    : 10px;
}

.style4 {
padding : 10px;
text-align: left;
}
.style5 {
padding : 10px;
text-align: center;
}

</style>

<style type="text/css">
.style1 {
margin-top: 19px;
}
.style2 {
text-align: left;
}
</style>

<link href="../styles/style1.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style6 { font-size: medium;
font-weight: bold;
color: #FF0000;
}
-->
</style>
</head>

<body>

<!-- Begin Container -->
<div id="container">

<!-- Begin Masthead -->
<div id="masthead">
  <h1>PATRIOT SENTINEL RIDERS VMC</h1>
  <table><tr><td><img src="../images/patsent logo25.jpg" width="119" height="151" /></td><td>
  <h3 class="style2"><font size="3">The Patriot Sentinel Riders VMC are a non-profit
  veteran&#39;s motorcycle club with a belief in strong family values and
  community service. We support all military and non-military
  organizations that believe in giving back and making a difference. 
  We only request honor and respect to any mission or event that pertains
  to any military veteran whether active or inactive.</font></h3>
   </td></tr></table>
</div>
<!-- End Masthead -->
   
<!-- Begin Navigation -->
<div id="navigation">
  <ul>
   <li><a href="../index.php">Home</a></li>
    <li><a href="../about.php">About</a></li>
    <li><a href="../news.php">News</a></li>
    <li><a href="../calendar.php">Calendar</a></li>
    <li><a href="../photo_gallery.php">Photo Gallery</a></li>
   <li><a href="../information_links.php">Links</a></li>
    <li><a href="../faq.php">FAQ</a></li>
    <li><a href="../contact.php">Contact</a></li>
   <li><a href="member.php">Members Only       </a></li>
   </ul>
</div>
<!-- End Navigation -->


<!-- Begin Content -->
<div id="content">
 
   <h2>
      This is the login and registration page for you regular members and the prospect members.
       
        <br />
        </h2>
      <form id="login" name="login" method="POST" action="<?php echo $loginFormAction; ?>">
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="3" summary="Member login form">
          <tr>
            <td colspan="2" align="center"><?php echo $failed; ?> <?php echo $access; ?></td>
          </tr>
          <tr>
            <td align="right">Username:</td>
            <td><input type="text" name="username1" id="username1" accesskey="u1" tabindex="1" /></td>
          </tr>
          <tr>
            <td align="right">Password:</td>
            <td><input type="password" name="password1" id="password1" accesskey="p1" tabindex="2" /></td>
          </tr>
          <tr>
            <td align="right"><input name="id" type="hidden" id="id" value="<?php echo $row_rsMembers['id']; ?>" /></td>
            <td><input type="submit" name="submit" id="submit" value="Login" accesskey="s1" tabindex="3" /></td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td> </td>
          </tr>
        </table>
      </form>
      <p></p>
      <form id="register" name="register" method="POST" action="<?php echo $editFormAction; ?>">
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="3" summary="Member registration form">
          <tr>
            <td colspan="2" align="center"><?php echo $submit; ?> </td>
          </tr>
          <tr>
            <td align="right"><span class="style6">*</span> Firts Name:</td>
            <td><input type="text" name="fname" id="fname" accesskey="f" tabindex="4" /></td>
          </tr>
          <tr>
            <td align="right"><span class="style6">*</span> Last Name:</td>
            <td><input type="text" name="lname" id="lname" accesskey="l" tabindex="5" /></td>
          </tr>
          <tr>
            <td align="right">Biker Name:</td>
            <td><input type="text" name="bikername" id="bikername" accesskey="b" tabindex="6" /></td>
          </tr>
          <tr>
            <td align="right"><span class="style6">*</span> Email Address:</td>
            <td><input type="text" name="email1" id="email1" accesskey="e" tabindex="7" /></td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td> </td>
          </tr>
          <tr>
            <td align="right"><span class="style6">*</span> Username:</td>
            <td><input type="text" name="username2" id="username2" accesskey="u2" tabindex="8" /></td>
          </tr>
          <tr>
            <td align="right"><span class="style6">*</span> Password:</td>
            <td><input type="password" name="password2" id="password2" accesskey="p2" tabindex="9" /></td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td> </td>
          </tr>
          <tr>
            <td align="right">Address:</td>
            <td><input type="text" name="address" id="address" accesskey="a" tabindex="10" /></td>
          </tr>
          <tr>
            <td align="right">City:</td>
            <td><input type="text" name="city" id="city" accesskey="ci" tabindex="11" /></td>
          </tr>
          <tr>
            <td align="right">State:</td>
            <td><input type="text" name="state" id="state" accesskey="s" tabindex="12" /></td>
          </tr>
          <tr>
            <td align="right">Postal Code:</td>
            <td><input type="text" name="postalcode" id="postalcode" accesskey="pc" tabindex="13" /></td>
          </tr>
          <tr>
            <td align="right">Country:</td>
            <td><input name="country" type="text" id="country" accesskey="co" tabindex="14" value="United States" /></td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td> </td>
          </tr>
          <tr>
            <td align="right"><span class="style6">*</span> Phone Number:</td>
            <td><input type="text" name="phone" id="phone" accesskey="ph1" tabindex="15" /></td>
          </tr>
          <tr>
            <td align="right">Alternate Phone:</td>
            <td><input type="text" name="alt_phone" id="alt_phone" accesskey="ph2" tabindex="16" /></td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td> </td>
          </tr>
          <tr>
            <td align="right" valign="top">Comment:</td>
            <td><textarea name="comment" id="comment" cols="30" rows="5" accesskey="cm" tabindex="17"></textarea></td>
          </tr>
          <tr>
            <td align="right" valign="top"><span class="style6">*</span> Captcha:</td>
            <td> </td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td><input type="submit" name="submit2" id="submit2" value="Submit" accesskey="s2" tabindex="19" />
              
            <input type="reset" name="rest" id="rest" value="Reset" accesskey="rs" tabindex="20" /></td>
          </tr>
          <tr>
            <td align="right"> </td>
            <td> </td>
          </tr>
        </table>
        <input type="hidden" name="MM_insert" value="register" />
      </form>
      <h2><br />
        <br />
      </h2>
  </div>

     <!-- End Content -->
     <!-- Begin Footer -->
    
       
       
<div id="footer">
  <p><a href="../index.php">Home</a> | <a href="../about.php">About</a> |
  <a href="../news.php">News</a> | <a href="../calendar.php">Calendar</a>
  | <a href="../photo_gallery.php">Photo Gallery</a> |
  <a href="../information_links.php">Links</a> |
  <a href="../faq.php">FAQ</a> | <a href="../contact.php">Contact</a>
  | <a href="member.php">Members Only</a> | <a href="../admin/admin_regmem.php">Admin</a></p>
<p class="style1">
Copyright © 2008 Patriot Sentinel Riders VMC | <a href="mailto:curtis_elam@yahoo.com">Webmaster</a></p>
  </div>
<!-- End Footer --></div>
<!-- End Container -->
</body>

</html>
<?php
mysql_free_result($rsMembers);
?>

I hope that this will help you out. I know it is a lot. Thanks again for your help

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines