Jump to content


Photo

Dreamweaver login and Session Help


  • Please log in to reply
2 replies to this topic

#1 badronald

badronald
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 September 2004 - 01:47 PM

Help me!
My problem is I set up a user login page using Dreamweaver's User Login. It works fine. I also have it saving the Username in a session that should be passed to the next page. It doesn't work!
I can either have the user authentication work or the session variable pass but not both. It seems to have something to do with the action for the submit button. Any ideas would be extremely useful. I do have session start on both pages.
Here is my code:

Here is my code.....Yeah I know I need to migrate away from dreamweaver.

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

// *** Validate request to login to this site.
session_start();

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}

if (isset($_POST['textfield'])) {
$loginUsername=$_POST['textfield'];
$password=$_POST['textfield2'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "http://jenn.ultimate.../gutshort.php";
$MM_redirectLoginFailed = "http://jenn.ultimate...oginerror.htm";
$MM_redirecttoReferrer = false;
mysql_select_db($database_Jenn, $Jenn);

$LoginRS__query=sprintf("SELECT ID, dateofbirth FROM MOTHERSQIDS WHERE ID='%s' AND dateofbirth='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $Jenn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;

//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");


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


Here is the second page where the session variable should appear. Code edited to show important sections.

<?php session_start();
require_once('Connections/Jenn.php'); ?>
<?php
session_register("$Username");
$Username = $HTTP_POST_VARS['textfield'];
?>


<title></title>

<link rel="stylesheet" type="text/css" href="/perseus/SURVEYS/GUTS/santa_fe_sunrise.css" />


</head>

<body onload="">

<input type="hidden" name="QID_1" value="<?php echo $_SESSION['$Username']; ?>"

#2 olaf

olaf
  • Members
  • Pip
  • Newbie
  • 2 posts
  • LocationThe Netherlands

Posted 03 September 2004 - 09:56 PM

session_register("$Username");
$Username = $HTTP_POST_VARS['textfield'];

this is your problem.. . this makes no sense you registered already the session.
Later !

Olaf

Free PHP classes :: ... need a website template?

#3 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 03 September 2004 - 11:25 PM

May also help if you get into the habit of using session_start() at the very top of your pages and also correcting the cache on IE browser 6.0. Refer to php freaks membership tutorial.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users