General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 9th, 2004, 12:31 AM
munnan munnan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 2 munnan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Log-in Redirect Help Needed !!!!

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

Reply With Quote
  #2  
Old January 9th, 2004, 12:41 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
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");

Reply With Quote
  #3  
Old January 9th, 2004, 12:59 AM
munnan munnan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 2 munnan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old January 9th, 2004, 01:26 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
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:
 $sql "SELECT * FROM auth WHERE UserName=".$_SESSION['MM_Username'];
$result mysql_query($sql$crestnew) or die(mysql_error());
$data mysql_fetch_assoc($result);
header ("Location: ".$data['Urlredirect']); 


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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Log-in Redirect Help Needed !!!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT