Jump to content

Dreamweaver login and Session Help


Recommended Posts

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.ultimateinsult.net/perseus/SURVEYS/GUTS/gutshort.php";

$MM_redirectLoginFailed = "http://jenn.ultimateinsult.net/perseus/SURVEYS/GUTS/momloginerror.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']; ?>"

Link to comment
https://forums.phpfreaks.com/topic/1947-dreamweaver-login-and-session-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.