Entertainment, CodeSeptember 29, 2008 2:43 pm


-     powerful feature of ColdFusion MX that allows developers to introduce object oriented programming techniques

-     collection of functions that relate to a given entity,

-     like for example, a Customer.

-     You could create a customer.cfc that is responsible for the programming logic regarding your customer records. (CRUD functionality) 

 

Benefits

 

Security

-      You can restrict access to a ColdFusion component and it’s functions

Performance

-      ColdFusion Components are faster.

-      They are compiled.

Extensibility

-     It can share methods with other ColdFusion components.

Reusability

-     Standalone piece of code that accepts input and provides output.

-     Once you’ve called a component in a page, you can reuse it without having to call it again in that page.

 

CodeSeptember 20, 2008 2:14 am

<cfif IsDefined(’FORM.btnLogin’)>
<cfquery name="qValidUser" datasource="webfillers">
EXEC sp_login @USERNAME=’#FORM.username#’, @PASSWORD = ‘#FORM.password#’
</cfquery>
<cfif qValidUser.RecordCount EQ 1>
<cfset Session.PERSONID = #qValidUser.PERSONID#>
<cfset Session.USERNAME = #qValidUser.USERNAME#>
<cfset Session.FIRSTNAME = #qValidUser.FIRSTNAME#>
<cfset Session.LASTNAME= #qValidUser.LASTNAME#>
<cfset Session.PERSONTYPE = #qValidUser.PERSONTYPE#>
<cflocation url = "index.cfm">
<cfelse>
    INVALID account
</cfif>
</cfif>
<cfform name="loginform" metiod = "post">
    Username : <cfinput type="text" name="username" required="yes" message="please enter username">
    <br>
    Passoword : <cfinput type="password" name="password" required="yes" message="please enter password">
    <cfinput type="submit" name="btnLogin" value="login">
</cfform>