Jump to content


Photo

LOG-IN REDIRECT HELP NEEDED


  • Please log in to reply
1 reply to this topic

#1 munnan

munnan
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 09 January 2004 - 06:15 AM

Dear Forum Members,
I use dreamweaver mx for developing php/mysql based

applications,dreamweaver uses mouse clicks to process any request e.g.

making record set ,making repeating region ,insert behaviour ...so on.
the problem which I am facing right now is that dreamweaver mx has by

default user authentication behaviour suppplied with it,that behaviour

actually just checks that is a user name and password exsist in the

mysql database table ,if it finds one ,dreamweaver let the user log-in

to a login-successfull page (what ever I define) but the problem is

for every user and password that exsists it only allow one

login-successfull page and one login-failiure page,the problem comes

here ,I actually want to redirect specific user to specific directory.
I have made a (Urlredirect) column in that authantication table,
Due to dreamweaver usage I only know to press some buttons for the

application development.but the problem is boyond that now.cause it

needed some hand coding , I am also giving the code of login page

below,


/////

<?php require_once('Connections/crestnew.php'); ?>
<?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$FF_LoginAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING']) &&

$HTTP_SERVER_VARS['QUERY_STRING']!="") $FF_LoginAction .=

"?".htmlentities($HTTP_SERVER_VARS['QUERY_STRING']);
if (isset($HTTP_POST_VARS['UserName'])) {
$FF_valUsername=$HTTP_POST_VARS['UserName'];
$FF_valPassword=$HTTP_POST_VARS['Pass'];
$FF_fldUserAuthorization="";
$FF_redirectLoginSuccess="user1.php";
$FF_redirectLoginFailed="loginfail.php";
$FF_rsUser_Source="SELECT UserName, Pass ";
if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," .

$FF_fldUserAuthorization;
$FF_rsUser_Source .= " FROM auth WHERE UserName='" . $FF_valUsername

. "' AND Pass='" . $FF_valPassword . "'";
mysql_select_db($database_crestnew, $crestnew);
$FF_rsUser=mysql_query($FF_rsUser_Source, $crestnew) or

die(mysql_error());
$row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
if(mysql_num_rows($FF_rsUser) > 0) {
// username and password match - this is a valid user
$MM_Username=$FF_valUsername;
session_register("MM_Username");
if ($FF_fldUserAuthorization != "") {
$MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
} else {
$MM_UserAuthorization="";
}
session_register("MM_UserAuthorization");
if (isset($accessdenied) && false) {
$FF_redirectLoginSuccess = $accessdenied;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = false;
header ("Location: $FF_redirectLoginSuccess");
exit;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = true;
header ("Location: $FF_redirectLoginFailed");
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR...ml4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;

charset=iso-8859-1">
</head>

<body>
<form name="form1" method="POST" action="<?php echo

$FF_LoginAction?>">
<table width="100%" border="1">
<tr>
<td colspan="2"><div align="center">LOG-IN</div></td>
</tr>
<tr>
<td width="18%">Username</td>
<td width="82%"><input name="UserName" type="text" id="UserName"

size="50"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="Pass" type="password" id="Pass" size="50"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="LOG-IN">
</div></td>
</tr>
</table>
</form>
</body>
</html>


//

well that's it PLS,PLS,PLS any body help mw out in this problem,
I have made a "Urlredirect" field in mysql database authantication

table.I want to redirect specific user to his own directory like user1

should redirect to www.abdc.com/dir1 while user2 must be redirect to

www.abdc.com/dir2 and so on...
I would realy appreciate if any help me in this respect,
thanking you in anticipation
Munnan Sabir
munnans@yahoo.com

#2 gizmola

gizmola
  • Administrators
  • Advanced Member
  • 4,664 posts
  • LocationLos Angeles, CA USA

Posted 09 January 2004 - 06:22 AM

Don't crosspost. Read the forum posting guidelines, link in my sig.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users