View Full Version : Really need help on how on using coldfusion... Lots of problems and is confused...
helLO
09-26-2002, 08:44 AM
i would like to know how to make a login and password on my web... so that when the user ID and the password are right... the user is able to access my menu on the web... and if the user ID and password are wrong... It'll then tell the user that the user ID and password are wrong and prompt the user to re-type...
I would also like to know how to link from the login page to my menu page after the user had logged in and from my menu page's small links to view,edit, add and delete my ms access database by using a pop-up window(When clicked "...add..." icon, it'll pop up a mini-window)...
My "adding11.cfm" file got errors, but i'm not sure how to solve it... The output for the date is wrong(not the date i typed)... Why is it like this?
If possible, i would like to use coldfusion to solve the above problems...
Thanks... Really need help...
so that when the user ID and the password are right... the user is able to access my menu on the web... and if the user ID and password are wrong... It'll then tell the user that the user ID and password are wrong and prompt the user to re-type...
Well the basic concept is this:
new person registers at your site > enters new infomation including user/pass into database.
person goes to login page and enters user/pass > this login form could post that info to a .cfm page which selects 'user' and 'pass' from the database where they match what the user has typed in. If it doesn't find a match then obviously user and pass are wrong.
you could use a simple CFIF statement to either re-direct them depending on wether they have logged in or failed..
you also need to look at sessions, cookies and the the like which i am just staring to learn and play with now..
these tuts may or may not be helpfull.
http://hotwired.lycos.com/webmonkey/00/48/index2a.html?tw=programming
http://www.developerfusion.com/show/1811/1/
http://www.hotscripts.com/Detailed/8273.html
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20079009.html
http://www.cfvault.com/index.cfm/mode/DisplayTutorial/TuUUID/7F4D0522-EC4C-11D3-85030050DABEAE1B/Tutorial_Page/1
I am just about to try a similar thing for an exercise, make a register/login system with search etc just available to members and such.
how are you going with it?
mat,
BigDaddy
10-09-2002, 10:57 PM
I noticed on adding11.cfm the date field is 3 characters long, with a seperate month and year field. This page then submits to adding12.cfm. I see that you have output for date, but this is probably outputing only the 3 characters, or whatever is entered in the text box, right?
You probably need to set date as a variable at the top of adding12.cfm to be comprised of month/date/year, in the order you want it.
Just a thought--it's been a year since I looked at any cold fusion code and I don't even have cold fusion installed on my desktop machine anymore, so I wasn't able to really experiment on it. I'm an ASP guy now.
helLO
10-11-2002, 10:05 AM
Thanks...
I'm still stuck at the adding part... and still trying...
*sigh*
You want the login cfm page to check if the user/pass is correct right? this means looking into the database and seeing if the user/pass entered in the input boxes matches what is in the database table.
so a very simple example is attached
what it does is on the login.html page > enter a username and a password - then this login .html page sends the user/pass to login.cfm which checks the database to see if there are any matches, if there are then it sends the user to the 'welcome.html' otherwise it sends them to 'error.html'
login.cfm code:
<cfquery name="checkLogin" datasource="your datasource name" username="your username" password="your pass"> // change the datasource, user + pass to yours.
SELECT *
FROM users
WHERE user = '#inputUser#' AND pass = '#inputPass#'
</cfquery>
//^ it's selecting all data from the database table called 'users' and checking to see if there are any matches for what the user has typed in (inputUser, inputPass)
// you'll have to create a simple database table called users with two columns 'user' & 'pass' put some names in both columns.
<cfif checkLogin.recordCount is 1> // did it find any matches?
<cflocation url = "welcome.html"> // if so go to welcome
<cfelse>
<cflocation url = "error.html"> // if not go to error
</cfif>
helLO
10-12-2002, 03:12 AM
Thanks... what abt the add part... do u have any ideas on how to settle it and its errors?
How would i prevent user to just type the URL of my pages... ( which mean that the user went into my contents without even going through the login page)
helLO
10-12-2002, 04:26 AM
Thanks... what abt the add part... do u have any ideas on how to settle it and its errors?
How would i prevent user to just type the URL of my pages... ( which mean that the user went into my contents without even going through the login page)
your date output prob. as BigDadday pointed out.
you have this :
Date Joined(DD/MM/YYYY):<b> #date# </b>
you sent it 3 variables(name="date" ...name="month" ..name="year") not just 'date'
so if you want to output them then you need to specify the 3 variables names like so
Date Joined(DD/MM/YYYY):<b> #date# #month# #year# </b>
In terms of adding a new user to your database it's a matter of making a form which has input fields with variable names which you have already done
and then making a cfm page to submit the form to with something like
<CFQUERY NAME="addUser">
INSERT INTO yourTableName Values '#inputName#', '#inputPhone#', '#other form input field variables go here..
</CFQUERY>
helLO
10-12-2002, 06:07 AM
thanks... But I'm working with checkboxs... I'm thinking whether the stuffs i submitted(together with the checked checkboxs)is able to add into the database or not...
Furthermore, the errors have been occurring at the same place which is here (after i edited the day, month, year to date)
>>
<cfquery name="insert" datasource="ALLCONTACTS">
INSERT INTO students (ADMISSION, NAME, MOBILE, DATEJOINED, IT0201, IT0202, IT0203, IT0204, IT0205, IT0206, IT0207, IT0208, IT0209, IT0210, IT0211, IT0212, IT0213, IT0214, IT0215, IT0216, IT0217, IT0218, IT0225, IT0226, IT0250)
VALUES ('#ADMISSION#', '#NAME#', '#MOBILE#', #DATE#, '#IT0201#', '#IT0202#', '#IT0203#', '#IT0204#', '#IT0205#', '#IT0206#', '#IT0207#', '#IT0208#', '#IT0209#', '#IT0210#', '#IT0211#', '#IT0212#', '#IT0213#', '#IT0214#', '#IT0215#', '#IT0216#', '#IT0217#', '#IT0218#', '#IT0225#', '#IT0226#', '#IT0250#')
</cfquery>
>>
The errors that printed out is >>
Error Diagnostic Information
An error occurred while evaluating the expression:
#ADMISSION#
Error resolving parameter ADMISSION
ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either:
You have misspelled the parameter name, or
You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.
>>
where is the page that these varibles are on ? ('#ADMISSION#', '#NAME#', '#MOBILE#', #DATE#, '#IT0201#', '#IT0202#', '#IT0203#', '#IT0204#', '#IT0205#', '#IT0206#', '#IT0207#', '#IT0208#', '#IT0209#', '#IT0210#', '#IT0211#', '#IT0212#', '#IT0213#', '#IT0214#', '#IT0215#', '#IT0216#', '#IT0217#', '#IT)....
it's saying that it doesn't have that variable 'admission' so i'm thinking did you actually pass/post the variable to this cfm page?
whammy
10-15-2002, 02:18 AM
I don't know cold fusion, but from what I've seen it's similar/simpler than ASP (although it has a lot of propietary code)... try writing out the INSERT statement to your page that receives the variable.
Or, just try writing the actual variable that is giving you problems to the page, to see if it is even being passed to the page.
Then you have a starting point in debugging. :)
P.S. As BigDaddy has experience in ColdFusion (and a LOT of experience in debugging ;)), I'd guess that he may be correct in that the variable is not initialized on the receiving page, therefore it isn't getting a value.
helLO
10-17-2002, 05:25 AM
<cfquery name="insert" datasource="ALLCONTACTS">
INSERT INTO students (ADMISSION, NAME, MOBILE, DATEJOINED, IT0201, IT0202, IT0203, IT0204, IT0205, IT0206, IT0207, IT0208, IT0209, IT0210, IT0211, IT0212, IT0213, IT0214, IT0215, IT0216, IT0217, IT0218, IT0225, IT0226, IT0250)
VALUES ('#ADMISSION#', '#NAME#', '#MOBILE#', #DATE#, '#IT0201#', '#IT0202#', '#IT0203#', '#IT0204#', '#IT0205#', '#IT0206#', '#IT0207#', '#IT0208#', '#IT0209#', '#IT0210#', '#IT0211#', '#IT0212#', '#IT0213#', '#IT0214#', '#IT0215#', '#IT0216#', '#IT0217#', '#IT0218#', '#IT0225#', '#IT0226#', '#IT0250#')
</cfquery>
I placed these codes in the recieving and print out page... am i right by doing that?
BigDaddy
10-18-2002, 05:02 AM
Cold Fusion handles the sql a bit different. In ASP, we have to put the SQL statement in a variable. Whammy's suggestion to print out the SQL statment doesn't quite work the same as it would if it was ASP--if I remember correctly. I would have to say check to make sure that the variable
Admission is not recognized. Cold Fusion chokes on that, because it doesn't have a value for it.
All I can suggest is at the top of the page, place a <cfoutput>, giving you the value of "Admission". Then run the page, submit it, and when the new page loads, check the value of it to see if it is being given a value.
helLO
10-24-2002, 02:29 AM
thank you very much... Its worked...
But i'm having problem with editing... I can't make it working with checkboxes... there is no response in the checkboxes in the database... I tried changing the data types of the module codes from a checkbox form to text and vice versa... But it doesn't seem to work...
I attached the files... hope that all ppl who is wiling to help, can have a look and help me...
Thanks...
BigDaddy
10-24-2002, 04:51 AM
I don't have a lot of experience using Access. Most of my database experience is in Oracle or SQL Server, but I noticed your checkbox field names all start with the word "codes:".
I don't know if this is normal for Access or not, but I would guess your insert statement needs to have that in the field names.
I would actually suggest you modify your table field names to remove "codes:" from the beginning. Or, you need to modify your insert statement to include "CODES:" in front of each of the field names.
Example:
<cfquery name="insert" datasource="ALLCONTACTS">
INSERT INTO students (ADMISSION, NAME, MOBILE, DATEJOINED, CODES:IT0201, CODES:IT0202, CODES:IT0203, CODES:IT0204, CODES:IT0205, CODES:IT0206, CODES:IT0207, CODES:IT0208, CODES:IT0209, CODES:IT0210, CODES:IT0211, CODES:IT0212, CODES:IT0213, CODES:IT0214, CODES:IT0215, CODES:IT0216, CODES:IT0217, CODES:IT0218, CODES:IT0225, CODES:IT0226, CODES:IT0250)
VALUES ('#ADMISSION#', '#NAME#', '#MOBILE#', #DATE#, '#IT0201#', '#IT0202#', '#IT0203#', '#IT0204#', '#IT0205#', '#IT0206#', '#IT0207#', '#IT0208#', '#IT0209#', '#IT0210#', '#IT0211#', '#IT0212#', '#IT0213#', '#IT0214#', '#IT0215#', '#IT0216#', '#IT0217#', '#IT0218#', '#IT0225#', '#IT0226#', '#IT0250#')
</cfquery>
helLO
10-24-2002, 05:07 AM
sorry... I attached the old database... I had edited my attachments...
helLO
10-24-2002, 05:17 AM
thank you very much... Its worked...
But i'm having problem with editing... I can't make it working with checkboxes... there is no response in the checkboxes in the database... I tried changing the data types of the module codes from a checkbox form to text and vice versa... But it doesn't seem to work...
I attached the files... hope that all ppl who is wiling to help, can have a look and help me...
Thanks...
BigDaddy
10-24-2002, 02:29 PM
I've never used checkboxes myself in an access database. Why don't you set the value to 1 or 0 instead? Set the value to 1 if the check boxes on the form are checked, and 0 if not.
whammy
10-25-2002, 12:00 AM
No cold fusion know-how here, but FYI, the SQL in Access is almost exactly like the SQL in SQL Server.
There are a few minor differences...
helLO
10-28-2002, 03:55 AM
I tried changing it to "1" and "0"... But it doen't work...
Darknight
11-14-2002, 08:33 PM
If the check box is not checked on the form, the form.checkboxname var will not be available to the action page.
try this
<cfif isdefined("form.checkboxname")>
<cfset Set_checkboxname = 1>
<cfelse>
<cfset Set_checkboxname = 0>
</cfif>
then use the Set_checkboxname var not the form.checkboxname var
this way your sql will always have a value to use :)
As for logins.
Are you using a 'application.cfm' page?
This page is run every time a .cfm page in that dir or its subdir is pulled.
So in the 'application.cfm' page you can check to see if the user is logged in, and it wont matter if they skipped the login.cfm.
I like to put a redirect if the fail that takes them right back to the login page.
Try a cflocation tag.
This is also a great way to log how many failed attempts a user has made. You can limit them to # failed attempts before you stop showing them the login.cfm.
Hope this helps
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.