Welcome Guest, Not a member yet? Register   Sign In
Captcha Validation
#1

[eluser]0077[/eluser]
I'm new in CI. It's impressive but I got a lot of trouble. I made a registration form and I put Captcha in it using javascript but I don't know how to validate. I would like to try CI way of making captcha and validating but I don't know where to start. Can anybody teach me?
#2

[eluser]LuckyFella73[/eluser]
First of all welcome to the CI forums!

Quote:I would like to try CI way of making captcha and validating but I don’t know where to start.
I guess the best place to start is starting to read the CI user guide, especially the
sections "Controllers", "Views" and "Models".

To solve your problem read the section "Captcha Helper":
http://ellislab.com/codeigniter/user-gui...elper.html

In case you have problems to implement that code into your project, post your code
and we will try to help you.
#3

[eluser]DuncanCox[/eluser]
Hey I also facing the same problem but not getting the solution.I hope somebody help me. I read all the document in the help option on Captcha but still unable to find the solution.
#4

[eluser]LuckyFella73[/eluser]
You can't expect somebody doing the complete coding for you now.
But you can post the code you have right now, tell us
what error message you get or where the code isn't working
like expected. Then we should be able to help you finding
a solution.
#5

[eluser]0077[/eluser]
Thanks! I'm new to codeigniter and I only knew few but I'm eager to learn.
#6

[eluser]0077[/eluser]
Hi there, here's my code and it's quite long and complicated so i'll show you the part were captcha validation is needed..

I use secureimage files in my captcha image. but i don't know how to validate. I use the captcha plugins of codeigniter but it destroy my whole code.. hope you can help me. I'm fresh in codeigniter and I wanna learn.
#7

[eluser]LuckyFella73[/eluser]
@ 0077

It's pretty hard to read the code in an email. When posting here you have
to escape "<scr+ipt" tags for example.

What I see is not a codeigniter approach so I can't really help you with that.
All in all it should be possible to use the CI captcha helper without
destroying your page. What exaxtly happens when you try to use the CI helper?
#8

[eluser]0077[/eluser]
Actually I got a lot of trouble on how to insert in my code. What I have sent you is just a part because the error occurred when I try to attach my file in posting.
#9

[eluser]0077[/eluser]
@luckyfella73

I would like to thank you for your willingness to help a newbies like me,

When I made my program I use codeigniter, but upon validation I use javascript. Jut what I have sent to you...

It's pretty to explain when I don't know how to show you my codes.
#10

[eluser]LuckyFella73[/eluser]
That is what you just send to me - now everybody can try to help you Wink

But like I mentioned - this is no CI way to use the captcha validation.
You allways should validate server-side so I recommend to try it the CI way!


Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Online Ticketing System: Development Environment&lt;/title&gt;
&lt;base href="&lt;?php echo base_url() ?&gt;" /&gt;

&lt;link rel="stylesheet" href="css/screen.css" type="text/css" media="screen"
title="default" /&gt;


<scr+ipt src="js/jquery/jquery-1.5.2.min.js"
type="text/java+script"></scr+ipt>
<scr+ipt type="text/java+script">
$(document).ready(function(){
$(".loading_icon").hide();

$('#submit-button').click(function() {

$('.loading_icon').fadeIn(4000);
var card_type = $('#card_type').val();
var card_number = $('#card_number').val();
var expiration_date = $('#expiration_date').val();
var cvc2_cvv2_code = $('#cvc2_cvv2_code').val();
var security_code =$('#security_code').val();

if(card_type=="" || card_type==null)
{
alert("Please select Card Type");
return false;
}
if(card_number=="" || card_number==null)
{
alert("Please enter your Card Number");
return false;
}
if(expiration_date=="" || expiration_date==null)
{
alert("Please enter the Card Expiration Date");
return false;
}
if(cvc2_cvv2_code=="" || cvc2_cvv2_code==null)
{
alert("Please enter the CVC2/CVV2 Code of your card");
return false;
}
if(isNaN(cvc2_cvv2_code) || cvc2_cvv2_code<0)
{
alert("Invalid CodenPlease enter valid CVC2/CVV2 Code");
return false;
}
if(security_code=="" || security_code==null)
{
alert("Please enter Security Code");
return false;
}

if(terms_and_conditions.checked == false)
{
alert("You need to agree to Terms and Conditions before you can proceed to
payment");
return false;
}
else{
$.post('&lt;?php echo base_url(); ?&gt;fare_details/add_contact_information',
{
'card_type': card_type,
'card_number': card_number,
'expiration_date': expiration_date,
'cvc2_cvv2_code': cvc2_cvv2_code,
'security_code': security_code
}, function(data){
if(data == 'saved')
{
$(".loading_icon").fadeOut(30);
win+dow.locat+ion.href = "&lt;?php echo base_url(); ?&gt;summary";
}
}, "json");
}
});
});
</scr+ipt>
&lt;/head&gt;

&lt;body&gt;

<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td height="25" width="150"><strong>Type of Card</strong></td>
<td width="5">&nbsp;</td>
<td width="200">
<select name="card_type" id="card_type">
<option value="">Select</option>
<option value="Visa">Visa</option>
<option value="Mastercard">Mastercard</option>
</select>
</td>
</tr>
<tr>
<td height="25"><strong>Credit Card Number:</strong></td>
<td>&nbsp;</td>
<td>&lt;input style="width:200px;" type="text" name="card_number"
id="card_number"/&gt;&lt;/td>
</tr>
<tr>
<td height="25"><strong>Expiration Date:</strong></td>
<td>&nbsp;</td>
<td>&lt;input style="width:200px;" type="text" name="expiration_date"
id="expiration_date"/&gt;&lt;/td>
</tr>
<tr>
<td height="25"><strong>CVC2/CVV2 Code:</strong></td>
<td>&nbsp;</td>
<td>&lt;input style="width:200px;" type="text" name="cvc2_cvv2_code"
id="cvc2_cvv2_code"/&gt;&lt;/td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td height="25" colspan="2">
</td>
<td>
<img id="captcha" src="../securimage/securimage_show.php" alt="CAPTCHA
Image" height="26"/>
<a src =
'../securimage/securimage_show.php?'>[ Next
Image ]</a>
</td>
</tr>
<tr>
<td height="25"><strong>Security Code:</strong></td>
<td>&nbsp;</td>
<td>&lt;input style="width:200px;" type="text" name="security_code"
id="security_code"/&gt;&lt;/td>
</tr>

<tr>
<td colspan="11">
<div id="submit-button">
<button style="height:25px; width:80px;" type="submit" name="continue">
Continue
</button>
<a href="index.php">
&lt;input style="height:25px; width:60px;" type="button"&gt;
</a>
</div>
<div class="loading_icon"></div>
</td>
</tr>
</table>




Theme © iAndrew 2016 - Forum software by © MyBB