Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending user to right page dependent on input

Status
Not open for further replies.

WebGodiva

Technical User
Jun 21, 2000
263
US
I have a log in page where the user has three options;<br>user name<br>password<br>office code<br><br>I have set up the database so only managers have an office code.<br><br>When the normal user logs in I want them to go to the index.cfm page but when a manager logs in using his/her office code I want them to go to the managers page.<br><br>My question is - is this possible from one login page and if so, how would I set it up. <br><br>I'm new to coldfusion so I'm trying to blunder my way through this but I'm totally stuck at this point - I can only get them to go to the same page.<br><br>Any help would be appreciated.
 
&quot;When the normal user logs in I want them to go to the index.cfm page but when a manager logs in using his/her office code I want them to go to the managers page.&quot;<br><br>-&gt; when you check for the login information then you can add something like :<br>&lt;cfif isdefined(&quot;myquery.office_code&quot;)&gt;<br>&nbsp;&nbsp;&lt;cflocation=&quot;manager.cfm&quot;&gt;<br>&lt;cfelse&gt;<br>&nbsp;&nbsp;&lt;cflocation=&quot;index.cfm&quot;&gt;<br>&lt;/cfif&gt;<br>
 
thanks, I'll give this a try and let you know.&nbsp;&nbsp;I appreciate your quick response.
 
Iza, your response was helpful.&nbsp;&nbsp;I am able to send anyone who enters to the other page (index.cfm) if they do not enter an office code.&nbsp;&nbsp;<br><br>The problem that I'm experiencing now is that when you type in any password on the entry screen it autmatically dumps you into the index.cfm page.&nbsp;&nbsp;It doesn't seem to be verifying against the database at that point.<br><br>the query is:<br><br>&lt;cfquery name=&quot;CheckRequired&quot; datasource=&quot;user&quot; dbtype=&quot;ODBC&quot;&gt;<br>SELECT * <br>FROM Users<br>WHERE User='#Form.UserID#' <br>AND Pass='#Form.Password#'<br>AND Officecode='#form.OfficeCode#'<br>&lt;/cfquery&gt;<br><br>and the variables User, Pass and Officecode should be passed from the form and queried against the database.&nbsp;&nbsp;It doesn't seem to be doing that. <br><br>The code I added that you gave me:<br><br>&lt;cfif CheckRequired.form&gt;<br>&lt;cfset session.authenticated=1&gt;<br>&lt;cflocation url=&quot;managers.cfm&quot; addtoken=&quot;yes&quot;&gt;<br>&lt;cfelse&gt;<br>&lt;cfset session.authenticated=1&gt;<br>&lt;cflocation url=&quot;index.cfm&quot; addtoken=&quot;yes&quot;&gt;<br>&lt;/cfif&gt;<br><br>seems to be working but even if you don't enter a correct password you get into the index.cfm.&nbsp;&nbsp;Any ideas.&nbsp;&nbsp;I hate to be a pest, but as you can tell, I'm new to all of this and having a real hard time trying to figure out what is going wrong.&nbsp;&nbsp;Any help you could give would be greatly appreciated.<br><br><br>
 
&quot;The problem that I'm experiencing now is that when you type in any password on the entry screen it autmatically dumps you into the index.cfm page.&nbsp;&nbsp;It doesn't seem to be verifying against the database at that point.&quot;<br><br>--&gt; i don't see in your code where you actually check if the password is the correct one !! (=&gt; where do you check for the CheckRequired query result ??)<br>did you send ALL the code ??<br>you should have something somewhere that looks like : <br>&lt;cfif CheckRequired.recordcount eq 1&gt; <br>&nbsp;&nbsp;&lt;!---- then the psswd is correct ----&gt; some code here &lt;cfelse&gt; <br>&nbsp;&nbsp;&lt;!---- the password is NOT correct ---&gt; some code here <br>&lt;/cfif&gt;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top