![]() |
| Domain sub folder links .. please help |
|
luckywilly
|
Hi, I currently have a site with members and each member wants a direct link to their own information page. The way that I was hoping to do it is something like this : http://www.domain.com/username .. the way that i thought of is creating a subfolder for each member and just place a index.cfm file that queries the database to show their information. Can anyone know of a way that i can just points to one file and queries the database accordingly depending on the username, without have to create subfolders ? I mean if no subfolder there would be an error message .. Can anyone help ?? Thank You
|
||||||||||||
|
|
|||||||||||||
|
MBMunday
|
I don't see a need at all to create subfolder for each member. You can use ColdFusion's session variables to see who the user is and query the database accordingly. Do you already have a password protected area/login form using ColdFusion?
Here is some old login code that I've used in the past (There may be a better way to do it now, but I know this works): Login page: <CFPARAM name="LoginSubmit" default=""> <CFPARAM name="username" default=""> <CFPARAM name="pwd" default=""> <!--- check form variables to see if user is in db ---> <CFIF LoginSubmit EQUAL "Login"> <CFQUERY name="login" DATASOURCE="#dsn#"> SELECT * FROM users WHERE UserName='#username#' AND Pwd = '#pwd#' </CFQUERY> <!--- set users session variables ---> <CFIF Login.recordcount gt 0> <CFSET session.user="#login.username#"> <CFSET session.accesslevel="#login.accesslevel#"> <CFSET session.fullname="#login.firstname# #login.lastname#"> <CFSET session.name="#login.firstname#"> <CFSET session.userID="#login.userID#"> </CFIF> Along with your other code and your Application.cfm file, create a session based on the users details once they login. The above query accesses all the users information (via the SELECT * ) from the db, so you can create a session for that user. Then, when you want to create query for the user to retrieve their specific information, do something like this: <cfquery name="getUserData" datasource="#dsn#"> Select * FROM users WHERE userid = #session.userID# </cfquery> Note - this is VERY IMCOMPLETE code, so if this little tidbit doesn't help you, or confuses you, send me an Private Message or an email and I'll provide you with a much more detailed example. MB |
||||||||||||
|
|
|||||||||||||
|
waterswing
|
Hello,
I've done what you are asking, with creating subfolders for each user, and beleive me, you don't want to do that. It's a nightmare to maintain. What you want to do is to check if you can your own error pages - and put the necasary logic in there. |
||||||||||||
|
|
|||||||||||||
| Domain sub folder links .. please help |
|
||
|


