Jump to content


DW8 - Login User Error

  • Please log in to reply
No replies to this topic

#1 anakalia

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 October 2006 - 04:11 PM

I'm brand new here, I hope no one minds me jumping straight in, but I've been going crazy working on this project!
I'm more of a designer than a coder and have learnt php and MySQL from Foundation PHP for Dreamweaver 8 by David Powers.  This project I'm working on is a website for magazine users to login and manage their  subscription online.  They come across the page login.php and continue on to myhome.php. 
I had been using the session [MM_Username] to show the user's information when they logged in, but everytime, I would get the information for user 1, no matter what user logged in.  After going crazy with that for a while, I decided to try passing the user's id number via a URL Param (user_id) from the login.php page to the myhome.php.  But this is the error I get:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in login.php on line 53

And this is the code I'm working with (not all, but what I think is the important parts). The bold line is line 53:

mysql_select_db($database_userconn, $userconn);
$query_userid = "SELECT user_id, users.username FROM users";
$userid = mysql_query($query_userid, $userconn) or die(mysql_error());
$row_userid = mysql_fetch_assoc($userid);
$totalRows_userid = mysql_num_rows($userid);
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];

if (isset($_POST['username'])) {
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "user/myhome.php?user_id=<?php echo $row_userid['user_id']; ?>";
  $MM_redirectLoginFailed = "loginfailed.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_userconn, $userconn);
  $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  $LoginRS = mysql_query($LoginRS__query, $userconn) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    $loginStrGroup = "";
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    header("Location: " . $MM_redirectLoginSuccess );
  else {
    header("Location: ". $MM_redirectLoginFailed );

I appreciate any help I can get.  As I said, I'm more a designer than a coder, and it's driving me nuts.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users