|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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/html4/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 URL while user2 must be redirect to URL and so on... I would realy appreciate if any help me in this respect, thanking you in anticipation Munnan Sabir URL |
|
#2
|
||||
|
||||
|
Why not create another query...
SELECT the user directory FROM the table its in WHERE the user equals the person who logged in... then just header ("Location: $user_dir"); |
|
#3
|
|||
|
|||
|
Dear Moderator,
I told you in the post that I really don't know to code php, its all due to dreamweaver behaviours that facilitates me to develop the whole web site, PLS PLS do me a favour Give me the code of that serch technique ,you were talking abt, I have the following colums in mysql table table name : auth field 1: Sr_id (int(11) autoincrement field 2:UserName(varchar(100)) field 3:Pass(varchar(100)) field 4:Urlredirect(varchar(100)) that's the whole table, kindly code me that php for redirection It would be really nice act of you thanx |
|
#4
|
||||
|
||||
|
There's tonnes of threads on this forum alone that deal with selecting information from a database... I would advise reading some articles before getting Dreamweaver to write all the code for you... You'd be surprised at how easy it really is... to be honest, it looks like Dreamweaver is purposely making your code WAY to complex...
PHP Code:
Giving code to people with no apparent thurst for learning is strongly against my believes as a developer... Again, I strongly advise you not to use Dreamweaver to write your code for you... What I wrote in four lines, dreamweaver likely would have done in ten... that's inefficient... If you're intested in learning the actual language, Devarticles has many excellent beginner articles, and the online documentation at PHP.net is fantastic... Best of luck. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Log-in Redirect Help Needed !!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|