Part of the EllisLab Network
   
 
Simple Captcha: Session ID as identifier?
Posted: 16 July 2008 12:10 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  42
Joined  06-25-2008

Hi!

I built a captcha library which randomly generates a simple mathematical question that the user is required to answer correctly to submit the form. When the user loads the controller, a new captcha is generated and the answer is stored in a database table along with the session ID which is the identifier used to fetch the correct answer once the user has pressed submit.

So my question is, is the session ID a smart way to associate a user with an answer, seeing as (if I understand it correctly) the session ID is changed every five minutes or so?

Best regards,
Erik Brännström

 Signature 

Skivsamlingen [CI]
Last.fm || My records

Profile
 
 
Posted: 16 July 2008 01:08 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  840
Joined  02-05-2007

I think you answered your own question. Why not just store the answer directly in the session? Alternatively, just store the numbers in hidden fields to avoid using the session.

 Signature 

“I am the terror that flaps in the night”

Profile
 
 
Posted: 16 July 2008 01:15 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  13
Joined  10-09-2007

use reCAPTCHA.net

its free, its awesome, its high tech… and you’re helping to digitize books!

Profile
 
 
Posted: 16 July 2008 01:17 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  42
Joined  06-25-2008

It is interesting that the easiest solution seldom is the one that springs to mind smile

Just one follow up question. The captcha is plain text and can easily be answered by a fairly simple automated process, which isn’t really a problem for my part. I’m just wondering if the CI Sessions are stored in cookies and if this information is easily accessible for such bots? I’m simply wondering for possible future security reasons.

Thanks for your answer!

 Signature 

Skivsamlingen [CI]
Last.fm || My records

Profile
 
 
Posted: 16 July 2008 01:27 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  42
Joined  06-25-2008
mdgross - 16 July 2008 01:15 PM

use reCAPTCHA.net

its free, its awesome, its high tech… and you’re helping to digitize books!

I did actually, however I found that it was a bit too high tech for my needs smile

The site I’m working on is in Swedish, which is not supported by default with reCaptcha and I didn’t feel up to the task of fixing that myself. This solution also loads faster and will never cause the slightest problem when I finally get around to internationalizing the site.

 Signature 

Skivsamlingen [CI]
Last.fm || My records

Profile
 
 
Posted: 16 July 2008 01:40 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  443
Joined  12-13-2007

I think the best way to go would to be using the standard session flashdata feature to store the answer on the page with the form and accessing it on the submit page. No need to worry about DB calls or session IDs changing..

 Signature 

PX Webdesign | The Lab | Personal Blog

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120611 Total Logged-in Users: 46
Total Topics: 126647 Total Anonymous Users: 1
Total Replies: 665756 Total Guests: 502
Total Posts: 792403    
Members ( View Memberlist )