A Tricky way to skip CFFLUSH tag if used in Header Files

0

Hi, There are some things and some coding points where we encounter such situations when we need to do some tricks to make the workaround..

As you guys must be aware of that CFLUSH Tag once used in the code will let use the Ajax Functionality within the Page, as written in the livedocs

So if need to use the functionality of ajax, there is a way to do it, just pass a variable within the URL like this


<cfif not findnocase("urlvalue",cgi.script_name)>
	<cfflush/>
</cfif>

as I told, a Trick to skip the calling of ajax tags, but by most the not best solution ever!

Hope you find it good

:)

Upload your Files using Coldfusion (A way with CF 8)

0

we will split this tutorial in few Parts like this!

1. Create a Upload Form
2. Upload a File
2.1 Check to See if Uploading Image is not too Big in size, we will try here to make a check through javascript & server side.
2.2 Check to See if the Image size is not extensively large.
3. Change the Extension of the JPEG for rendering easily in the webpage and with less Processing time.
4. Re-size the Image If required (Optional)
5. Let’s Also Include the Watermark Option to watermark the JPEG Image (Optional)
6. Redirect to the User to the End Page to View the Uploaded Image
7. End of the Tutorial

Let’s now begin with our Part-1 Link!


<html>
<head>
<title>Welcome to Upload Functionality</title>
<script language="javascript">
function LimitAttach(form, file) {
    extArray = new Array(".jpg",".png",".gif",".bmp",".tiff",".pct",".pcd");
    allowSubmit = false;
    if (!file) return;
    while (file.indexOf("\\") != -1)
    file = file.slice(file.indexOf("\\") + 1);
    ext = file.slice(file.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) {
    if (extArray[i] == ext) { allowSubmit = true; break; }
    }
    if (allowSubmit) return true;
    else
    alert("Please only upload files that end in types:  "
    + (extArray.join("  ")) + "\nPlease select a new "
    + "file to upload and submit again.");
    return false;
}
</script>
</head>
<body>
<form method="post" action="upload.cfm" enctype="multipart/form-data">
<table align="left" width="410">
<tr><td>
    <input type="file" name="uploadfile" id="uploadfile" tabindex="1">
</td></tr>
<tr><td>
    <select name="checkforoptions" id="checkforoptions">
 <option value="none">(Select One)...</option>
 <option value="1">Resize {800^600}</option>
 <option value="2">Watermark</option>
    </select>
<tr><td>
    <input type="submit" name="createupload" id="createupload" tabindex="2" value="Create New Upload"  onclick='return LimitAttach(this.form, this.form.uploadfile.value)'>
</td></tr>
</table>
</form>
</body>
</html>

Let's now begin with our Part-2 Link!  The Page is Called as <Upload.cfm>

<cfset accept = "image/jpg,image/jpeg,image/png,image/gif,image/pjpeg,image/bmp,image/pct,image/pcd,image/tiff">
<cfset files = "jpg,bmp,jpeg,pjpeg,bmp,png,gif,tiff,pct,pcd">

<!--- Wrap Around the cftry/catch block --->
<cftry>
<cfif  structKeyExists(FORM,"createupload")>
 <!--- A Server side validation Check --->
 <cfif len(form.uploadfile) IS 0>
  <cfset n = "Error! Please Upload Image File">
 <cfelse>
  <cfset path = getDirectoryFromPath(getCurrentTemplatePath())>
  <cfscript>
  info = StructNew();
  info.directory = "uploadImages";
  </cfscript>
  <cfif not directoryexists(info.directory)>
   <cfdirectory action="create" name="#path##info.directory#">
  </cfif>
  <cfset newPath = "#path##info.directory#">
  <cftry>
   <cffile action="upload" accept="#accept#" filefield="uploadfile"
   destination="#newpath#\" nameconflict="makeunique">
             <cfset uploadfile = cffile.ServerFile>
   <cfset imageName = cffile.serverfileName>
   <cfif IsImageFile("#newPath#\#uploadfile#")>
    <!--- Check if File Size is not much bigger --->
    <cfif cffile.filsesize GT 500000>
     <cffile action="delete" file="#newPath#\#uploadfile#">
    </cfif>
    <!--- Check if File width & height is not too much big. --->
    <cfset MyImage = ImageRead("#newPath#\#uploadfile#")>
    <cfset info = ImageInfo(MyImage)>
    <cfif info.width GT 2048 AND info.height GT 2048>
     <cffile action="delete" file="#newPath#\#uploadfile#">
    </cfif>
    <!--- Now we have Checked the Details we need, Now we will go ahead and Convert the file if needed. --->
    <cfif cffile.serverfileext IS 'jpg'>
    <cfelse>
    <cfimage action="convert"
    source="#MyImage#" destination="#newPath#\#imageName#.jpg" overwrite="true">
    <cfset MyImage = #imageName#.jpg>
    </cfif>

    <! --- Now we are in the process of Resizing the Image before we Proceed Further, This is Optional, So we can Skip That if the Value is not defined in the  HTML Form--->
    <cfif isDefined('form.checkforoptions') AND form.checkforoptions EQ 1>
     <cfset imageResize(MyImage,"800","600")>
     <cfset ImageWrite(myImage,"#newPath#\")>
    <cfelseif isDefined('form.checkforoptions') AND form.checkforoptions EQ 2>
     <cfset Watermark = ImageNew("",100,20,"rgb","##F0F0F0")>
     <cfset ImageSetDrawingColor(watermark,"##666666")>
     <cfset ImageDrawRect(Watermark,0,0,
     (Watermark.GetWidth() - 1),(Watermark.GetHeight() - 1))>
     <cfset ImageSetAntialiasing(watermark,"on")>
     <cfset setAttr = {Font="verdana",size="5",style="italic"}>
     <cfset ImageDrawText(Watermark,"Gavy Randhawa",11,14,setAttr)>
     <cfset ImageSetDrawingTransparency(MyImage,50)>
     <cfset ImagePaste(MyImage,Watermark,(MyImage.GetWidth()-watermark.GetWidth() - 3),(MyImage.GetHeight()-watermark.GetHeight() - 3))>
     <cfset ImageWrite(myImage,"#newPath#\")>
    </cfif>
    <cflocation="thanks.cfm?img=#tobase64(MyImage)#" addtoken="no">
   </cfif>
  <cfcatch>
   <cfset n = "Error! Unhandled Exception Occurred, reverting back">
   <cfif fileExists("#newPath#\#uploadfile#")>
    <cffile action="delete" file="#newPath#\#uploadfile#">
   </cfif>
  </cfcatch>
  </cftry>

 </cfif>
</cfif>
<cfcatch type="any">
<cfset n = "Error! #cfcatch.detail# #cfcatch.message#">
</cfcatch>
</cftry>

Now Our Thanks.cfm Page, We are Passing The Image Name in a Url So we need just a Path to Find the image and Show to the User


<html>
<head>
<title>Hello! The Upload ha been a Success</title>
</head>
<body>
<table align="center" width="70%">
<tr><td>Uploaded Image</td></tr>
<tr><td>
<cfif isDefined('url.img')>
 <img src="UploadImages/#ToString(ToBinary(url.img))#" border="0"/>
<cfelse>
 <div align="center">Warning! You landed this Page without any Uploading, This is a Wrong Page Instead</div>
</cfif>
</td></tr>
</table>
</body>
</html>

Cfschedular and its Problems

0

Hi Today i was doing some work on the much talked Tag for Coldfusion.

This is quit a Nice Tag if it is used Properly and it can do a lot of things!.. My This post will be all about the the usage of this tag in the following scenarios!

  • Create a Scheduled Task
  • Checked for Existing Scheduled Task
  • Run the task if the Task already Exists

For this thing to happen i came across varios IDEAS/options

  • Create a Task using the Update Command and then search for the task name, if it already Exists run that task or if it does not exists create new one!
  • Use the java Feature “ServiceFactory” to find out the way that the specific Task name exists and if yes, use it but it has its own concers.
  • a) Cannot be run on Shared Host -  unreliable
  • b) Securiy Concerns
  • Another Option was to use the UDF fom the cflib.org site to use the isScheduledTask Tag which refers to the neo.xml file which has all the information about the Scheduled in WDDX format.
  • a) That was also not an proper way to access a file which might have unauthorized access to it.
  • b) It may wrk on a Shared or it may not work on that
  • Next issues was the Coldfusion on Clusture Environment, so that was an issue if to create manually, that needs to be configured on various clusters – Well i have not good knowledge about Clusters. :)
  • So the Las & final way was to use the <cftry> – <cfcatch> Block.

Just wrap the Whole Scheduled Info in a cftry – catch  and ue it. Like run the cfschedule in the cftry and in the cfcatch write the update for cfschedule. This will make sur that if the task exists, it will run else it will fail and if fails, we catch it and in catch we are making ir, so no worries. it works

It will work on each and every shared host and each environment.

Cheers

Valley Crossing at Fort (SiahGarh) with friends

0

Hi yesterday (21/11/2010), I went to fort Sia Grah with my fiends, we had a long 6 or 7 km way to the top of mountain. It was a steep mountain and we enjoyed a lot climbing on top of the hill. There we did the valley Crossing. Here is the video of the Valley crossing of mine and pic of us.

Check out

Photo of my Friends

Making CKEDITOR Work With CFFM File Manager

3

Hi I was yesterday trying to work with the new CKeditor. I was using the fckeditor before but that really troubles a lot when you upload images..

So i thought let’s give CKeditor a Chance, I downloaded the latest version of CKeditor from the official website of CKeditor:

CKEditor

Now we will download the cffm Filemanager by Rickroot from here:

CFFM

Now we here do a simple tweek which will make out ckeditor work with textarea:

we just need the following funda to work:

I am using the CKeditor in my admin Folder. there i have a folder named CKEditor.
Now i open the config.js file of the ckeditor and add the following


CKEDITOR.editorConfig = function( config )
{
    config.toolbar = 'MyToolbar';
	config.toolbar = 'MyToolbar2';
    config.toolbar_MyToolbar =
    [
        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
        ['Image','Flash','Table','HorizontalRule'],
        '/',
        ['Styles','Format'],
        ['Link','Unlink','Anchor']
    ];

    config.toolbar_MyToolbar2 =
    [
        ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Scayt','RemoveFormat'],
        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
        '/',
        ['Styles','Format'],
        ['Bold','Italic','Strike'],
        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
        ['Link','Unlink','Anchor'],
        ['Maximize']
    ];
};

I created two of my custom toolbars to use. While it come with two modes, Basic and Full. so i created my own to not to use full but little part of the toolbars.

Now we are done with adding our custom toolbars.

we just need to call the following config.js file through the script tag into our page as:


<strong><script type="text/javascript" src="ckeditor/ckeditor.js"></script></strong>

Now suppose we have a textarea defined as:


<textarea name="comments" cols="45" rows="5" class="inputstyle" id="comments" tabindex="2"><cfoutput>#comments#</cfoutput></textarea>
    <script language="javascript1.2">
	CKEDITOR.replace( 'comments',
		{
			filebrowserBrowseUrl : 'cffm/cffm.cfm?editorType=cke&EDITOR_RESOURCE_TYPE=file',
			filebrowserImageBrowseUrl : 'cffm/cffm.cfm?editorType=cke&EDITOR_RESOURCE_TYPE=image',
			filebrowserFlashBrowseUrl : 'cffm/cffm.cfm?editorType=cke&EDITOR_RESOURCE_TYPE=flash',
			filebrowserUploadUrl : 'cffm/cffm.cfm?action=QuickUpload&editorType=cke&EDITOR_RESOURCE_TYPE=file',
			filebrowserImageUploadUrl : 'cffm/cffm.cfm?action=QuickUpload&editorType=cke&EDITOR_RESOURCE_TYPE=image',
			filebrowserFlashUploadUrl : 'cffm/cffm.cfm?action=QuickUpload&editorType=cke&EDITOR_RESOURCE_TYPE=flash',
			toolbar : 'MyToolbar'
		}
	);
	</script>

So my CFFM Folder is just outside the ckeditor and within the admin panel. So the cffm and ckeditor folders are within the admin panel.

  1. As a Side note, you can always change the textareaname and the ckeditor calling instance name to match before the editor appears to you visually

I ran it and Uploaded files and Woot They work flawlessly

Cheers! Come back if some problem persists!

Using The ImageBackground Coldfusion Function

0

Hi This is a very Light Script which we can use to Create the Image Background Using Coldfusion’s Inbuild ImageSetBackgroundColor Function! Please note here that we can use this tag with only the ImageClearRect Function to provide us what exactly we are looking after:

Here is the code which has helped me in showing what the both above functions can do!


<cfimage source="images/j0439239.jpg" name="myImage">
<!--- Set the background color to green. --->
<cfset ImageSetBackgroundColor(myImage,"green")>
<!--- Draw four rectangles in the background color. --->
<cfoutput>
<cfloop from="1" to="100" index="i" step="9">
<cfset ImageClearRect(myImage,#i#,#i#,#i#,#i#)>
</cfloop>
</cfoutput>
<!--- Save the modified ColdFusion image to a file. --->
<cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes">
<!--- Display the source image and the new image. --->
<img src="images/j0439239.jpg">
<img src="test_myImage.jpeg">

The result will be like the below

Before Functions Applied

Now we will do the same after the Functions applied

So you see a Arrow has been Created I used a Step Attribute in a cfloop that made it bend, if you omit it, you will get the straight lines of the same diagram

and end of alll

Happy Coding

Never Purchase WhirlPool Products

0

Never Purchase Whirl Pool Products If and After You are very sure of what you are Purchasing, I ordered one Microwave and I got Damaged Product and No replacement has been Done till yet for me. Its been almost 15 days. So better off go to Other Companies for Purchasing Products.

Cheers

Coldfusion Hosting

0

I found hostingatoz.com as the best website for all kind of hosts. They are Quite Cheap, Good and Reliable Host.

i have my 100 websites running on hostingatoz.com

Detecting Browsers Using Coldfusion

0

Here we go.. First of all we will how we can call this Browser Function:

The calling is quite simple…


<cf_getBrowser /><BR>
<cfif browser.is_opera><BR>
<cfinclude template="opera.cfm"><BR>
<cfelseif browser.is_mozilla><BR>
<cfinclude template="mozilla.cfm"><BR>
<cfelseif browser.is_safari><BR>
<cfinclude template="safari.cfm"> <BR>
<cfelseif browser.is_ie><BR>
<cfinclude template="ie.cfm"><BR>
</cfif> <BR>
<cfoutput><BR>
You are using: #browser.name#, version #browser.version# <BR>
</cfoutput><BR>
<cfdump var="#browser#" />

The above will display the contents related to the specific Browser. You can use the contents of CSS in these include files.

So after now the meat of the Application. Credit goes to original Author here, i Just edited it a bit that’s All.


  <cfparam name = "version" default = "0"><BR>
  <cfparam name="attributes.useragent" default=""><BR>
  <cfif attributes.useragent is ""><BR>
  <cfset userAgent=cgi.HTTP_USER_AGENT><BR>
  <cfelse><BR>
  <cfset userAgent=attributes.useragent><BR>
  </cfif><BR>
  <cfset browser=StructNew()><BR>
  <!--- Initiating struct ---><BR>
  <cfset browser.name="Unknown"><BR>
  <cfset browser.version=0><BR>
  <cfset browser.is_ie=false><BR>
  <cfset browser.is_opera=false><BR>
  <cfset browser.is_webtv=false><BR>
  <cfset browser.is_lynx=false><BR>
  <cfset browser.is_links=false><BR>
  <cfset browser.is_konqueror=false><BR>
  <cfset browser.is_gecko=false><BR>
  <cfset browser.is_safari=false><BR>
  <cfset browser.is_mozilla=false><BR>
  <cfset browser.is_netscape=false><P></P>
<P><cfif userAgent neq ""><BR>
  <cfset browser.is_ie=iif(findnocase("MSIE", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_opera=iif(findnocase("Opera", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_webtv=iif(findnocase("webtv", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_lynx=iif(findnocase("Lynx", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_links=iif(findnocase("Links", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_konqueror=iif(findnocase("Konqueror",userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_gecko=iif(findnocase("gecko", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_safari=iif(findnocase("Safari", userAgent,1) is 0, de("false"), de("true"))><BR>
  <cfset browser.is_mozilla=false><BR>
  <cfset browser.is_netscape=iif(findnocase("Mozilla", userAgent,1) is 0, de("false"), de("true"))><BR>
  <!--- Detect Opera Netscape (Mozilla) spoofing, rule out Mozilla compatibles and spoofers ---><BR>
  <cfif browser.is_opera or browser.is_safari or (findnocase("compatible", userAgent,1) gt 0 or findnocase("spoofer", userAgent,1) gt 0)><BR>
  <cfset browser.is_netscape=false><BR>
  </cfif><BR>
  <!--- Detect Opera IE spoofing ---><BR>
  <cfif browser.is_ie and browser.is_opera><BR>
  <cfset browser.is_ie=false><BR>
  </cfif><BR>
  <!--- IE ---><BR>
  <cfif browser.is_ie is TRUE><BR>
  <cfset browser.name = "Internet Explorer"><BR>
  <cfset browser.version = val(mid(userAgent,findnocase("MSIE", userAgent,1)+4,4))><BR>
  <!--- Opera ---><BR>
  <cfelseif browser.is_opera is TRUE><BR>
  <cfset browser.name = "Opera"><BR>
  <cfset browser.version = val(mid(userAgent,findnocase("Opera", userAgent,1)+6,4))><BR>
  <!--- Mac OSX Safari ---><BR>
  <cfelseif browser.is_safari><BR>
  <cfset browser.name = "Safari"><BR>
  <cfset browser.version= val(mid(userAgent,find("Safari/",userAgent) + 7, 2))><BR>
  <cfset browser.is_gecko=false><BR>
  <!--- Netscape, Mozilla and Mozilla based browsers ---><BR>
  <cfelseif browser.is_netscape is true><BR>
  <cfif browser.is_gecko><BR>
  <!--- Nestcape >= 6.X (gecko based) ---><BR>
  <cfset nav6_pos=findnocase("Netscape", userAgent,1)><BR>
  <cfif nav6_pos gt 0><BR>
  <cfset startpos=nav6_pos+10><BR>
  <cfset browser.version=val(mid(userAgent,startpos,4))><BR>
  <cfset browser.name = "Netscape"><BR>
  <cfset browser.version = version><BR>
  <cfelse><BR>
  <cfset browser.is_netscape=false><BR>
  <cfset browser.is_mozilla=true><BR>
  <!--- Mozilla < 1.1 ---><BR>
  <cfset browser.version=val(mid(userAgent,findnocase(")",userAgent,1)-5,5))><BR>
  <!--- Mozilla (> 1.1) ---><BR>
  <cfif browser.version is 0><BR>
  <cfset parantes = structnew()><BR>
  <cfset parantes.start = find("(",userAgent)><BR>
  <cfset parantes.slutt = find(")",userAgent)><BR>
  <cfif (parantes.start gt 0) and (parantes.slutt gt parantes.start)><BR>
  <cfset browser.version = val(RemoveChars(listlast(mid(user_agent,parantes.start,parantes.slutt - parantes.start), ";"),1,4))><BR>
  </cfif><BR>
  </cfif><BR>
  <cfif Find("Firebird",userAgent) gt 0 or Find("Phoenix", userAgent) gt 0><BR>
  <cfset browser.name = "Mozilla Firebird"><BR>
  <cfelseif Find("Camino", userAgent) gt 0 or Find("Chimera", userAgent) gt 0><BR>
  <cfset browser.name = "Camino"><BR>
  <cfelse><BR>
  <cfset browser.name = "Mozilla"><BR>
  </cfif><BR>
  <cfset browser.geckobuild = val(mid(userAgent,find("Gecko",userAgent) + 6, 8))><BR>
  </cfif><BR>
  <cfelse><BR>
  <!--- Netscape <= 4.x ---><BR>
  <cfset versjon=Val(mid(userAgent,9,4))><BR>
  </cfif></P>
<P> <cfelseif browser.is_lynx><BR>
  <cfset browser.name = "Lynx"><BR>
  <cfset browser.version=Val(mid(userAgent,FindNoCase("Lynx",userAgent) + 5,6))></P>
<P> <cfelseif browser.is_links><BR>
  <cfset browser.name = "Links"><BR>
  <cfset browser.version=Val(mid(userAgent,9,4))></P>
<P> <cfelseif browser.is_konqueror><BR>
  <cfset browser.name = "Konqueror"><BR>
  <cfset browser.version=Val(mid(userAgent,FindNoCase("Konqueror",userAgent)+10,6))><BR>
  <!--- Unknown browser ---><BR>
  <cfelse><BR>
  <cfset browser.name = userAgent><BR>
  <cfset browser.version = 0><BR>
  </cfif><BR>
  </cfif><BR>
  <cfset caller.browser = browser>
  <BR>
  <cfset thistag.generatedcontent = ""><BR>
</P>

Captcha Code using Coldfusion 8 advanced technique

0

The Captcha Using Coldfusion 8 is quite Easy but what I we want to make it bit difficult for the user to read using Case Sensitiveness.

Here is how we will do it.

First of all we will list the files we need for the this Captcha Stuff. A captcha.cfm file and a Login.cfm file So here is a very easy and small code which we will make the use o the coldfusion captcha.

Captcha.cfm Code:


<cfset Str_Lower_Case_Alpha = "abcdefghijklmnopqrstuvwxyz" />
<!--- Set up available upper case values. This is done by converting the lower case string using "UCase". --->
<cfset Str_Upper_Case_Alpha = UCase( Str_Lower_Case_Alpha ) />
<!--- Set up available numbers. --->
<cfset Str_Numbers = "0123456789" />
<!--- Make a string that contains our lower case upper case and number values. --->
<cfset strAll = Str_Lower_Case_Alpha & Str_Upper_Case_Alpha & Str_Numbers />
<!--- Create the password array of 1-3 dimensions. Index array elements with square brackets: [ ]. --->
<cfset arrPassword = ArrayNew(1) />
<!--- Generate the password and put each random value in the password array string. --->
<!--- Select the random letter from our lower case set. --->
<cfset arrPassword[ 1 ] = Mid(Str_Lower_Case_Alpha,RandRange( 1, Len( Str_Lower_Case_Alpha ) ), 1 ) />
<!--- Select the random letter from our upper case set. --->
<cfset arrPassword[ 2 ] = Mid(Str_Upper_Case_Alpha, RandRange( 1, Len( Str_Upper_Case_Alpha ) ), 1 ) />
<!--- Select the random number from our number set. --->
<cfset arrPassword[ 3 ] = Mid(Str_Numbers,RandRange( 1, Len( Str_Numbers ) ),1) />
<!--- Create rest of the password. --->
<cfset arrPassword[ 4 ] = Mid(strAll,RandRange( 1, Len( strAll ) ),1) />
<cfset arrPassword[ 5 ] = Mid(strAll,RandRange( 1, Len( strAll ) ),1) />
<cfset arrPassword[ 6 ] = Mid(strAll,RandRange( 1, Len( strAll ) ),1) />
<!--- We don?t always want the first three characters to be of the same order (by type). --->
<!--- Therefore, let's use the Java Collections utility class to shuffle this array into a "random" order. --->
<cfset CreateObject( "java", "java.util.Collections" ).Shuffle(arrPassword ) />
<!--- Join all the characters into a single string. --->
<!--- We can do this by converting the array to a list and then just providing no delimiters (empty string delimiter). --->
<cfset strPassword = ArrayToList(arrPassword, "" ) />
<!--- The password is finished. --->
<cfset rndString = #strPassword#>
<cfset rndHash=Hash(#strPassword#)>

With a little bit of Modification code Provided by ScandicWeb and we will see what is going on now. Now our login.cfm Page:


<cfoutput>
<cfform method="post" action="#cgi.SCRIPT_NAME#" name="adminlogin" id="adminlogin">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td valign="center" align="center">
			<table class="border" border="0" cellpadding="1" cellspacing="2" width="500">
				<tr>
					<td>
						<table border="0" cellpadding="0" cellspacing="1" width="100%">
							<caption>
								Login
							</caption>
							<tr>
								<td colspan="2" class="default" align="center">You aren't logged in or your session has expired.<br/>
								Please enter your Username and Password below and click Login.</td>
							</tr>
						<cfif IsDefined('invalid')>
							<
<p>tr>
								<td align="center" colspan="2"><div class="darkred">#trim(invalid)#</div></td>
							</tr>
						</cfif>
							<tr>
								<td colspan="2" align="center"><div id='adminlogin_errorloc' class='error_strings' style='></div></td>
							</tr>
							<tr>
								<td class="default" align="right" width="160"><strong>Username: </strong></td>
								<td width="340" align="left"><cfinput type="text" name="j_username" message="Error! Please Provide username" tooltip="Provide Your Username" required="yes" class="inputstyle" id="j_username" tabindex="1" size="25" maxlength="100"></td>
							</tr>
							<tr>
								<td class="default" align="right" width="160"><strong>Password: </strong></td>
								<td width="340" align="left"><cfinput type="password" name="j_password" message="Error! Please Provide Password" tooltip="Password Required" required="yes" class="inputstyle" id="j_password" tabindex="2" size="25" maxlength="100"></td>								</tr>
							<tr>
								<td class="default"> </td>
								<td align="left">
									<SPAN style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"><cfinclude template="../captcha/captcha.cfm"></SPAN>
									<SPAN style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"><cfimage action="captcha" fontSize="25" width="200" height="50" text="#rndString#" </SPAN>
									<SPAN style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">fonts="Arial,Verdana,Courier New" difficulty="medium" quality="1"></SPAN><br>
									Case Sensitive Captcha Match Required</td>
							</tr>
							<tr>
								<td class="default" align="right"><strong>Verify Yourself:</strong>
									<SPAN style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"><cfinput type="hidden" name="userInput" value="#rndHash#"></SPAN></td>
								<td align="left"><SPAN style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"><cfinput type="text" name="regVerifyCaptcha" message="Error! Provide Captcha Value" tooltip="Provide Exact Text as above in Image" required="yes" class="inputstyle" id="regVerifyCaptcha" tabindex="3" size="25" maxlength="10"/></SPAN></td>
							</tr>
							<tr>
								<td align="right" class="default"> </td>
								<td align="left"><input type="checkbox" name="RememberMe" tabindex="4" value="Yes" <cfif IsDefined("cookie.j_username")> CHECKED</cfif>> Remember Me</td>
							</tr>
							<tr>
								<td align="center"> </td>
								<td align="left"><cfinput type="submit" name="submit" value="Login" class="tinyborder" tabindex="5">

									<cfinput type="reset" name="reset" value="Clear" class="tinyborder" tabindex="6"></td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</cfform>
</cfoutput>

So next we will check on the page where we check that is there is a match for the captcha


<cfif Hash(Form.regVerifyCaptcha) NEQ Form.userInput>
	<cfset invalid = "Error! Captcha Text Mismatching, Try again">
</cfif>

Here now you have a working captcha Code with Case Sensitive Captcha Login

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
Go to Top