Page 1 of 1

Warning

Posted: Wed Feb 15, 2012 6:21 am
by Vilash
hi trying to work on captcha images...m getting the following error could some1 please correct the script.....?
Warning: require_once(captcha/recaptchalib.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\udupipages\captcha\contact-us.php on line 69


this s my code

<?php
require_once('captcha/recaptchalib.php');
$privatekey = "your_private_key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$con = mysql_connect( "localhost", "login", "login123" );
if(!$con)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db("test",$con);
$applieddate = date('d-m-y');
$sql = "INSERT INTO contact( Name, Email,Phone,Company,City,State,Country,Zip,Comments,Date)
VALUES ('$_POST[Name]', '$_POST[Email]', '$_POST[Phone]', '$_POST[Company]', '$_POST[City]', '$_POST[State]','$_POST[Country]', '$_POST[Zip]', '$_POST[Comments]','$applieddate' )" or die(mysql_error());


if(!mysql_query($sql,$con))
{
die('Error:' . mysql_error());
}

echo "<strong>Thanx for contacting us</strong>" . "<br />";

mysql_close();
?>
</body>
</html>

Re: Warning

Posted: Wed Feb 15, 2012 7:54 am
by G l a z z
The error its self explanatory, did you read the error ??

Code: Select all

Warning: require_once(captcha/recaptchalib.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\udupipages\captcha\contact-us.php on line 69
It means that the file 'captcha/recaptchalib.php' doesn't exist on your web site root folder.

And btw wrong forum section!

Re: Warning

Posted: Thu Feb 16, 2012 1:14 am
by Vilash
bt i have included those files....

Re: Warning

Posted: Thu Feb 16, 2012 6:20 am
by Celauran
Vilash wrote:bt i have included those files....
Precisely the problem. You're requiring a file that doesn't exist.

Re: Warning

Posted: Thu Feb 16, 2012 10:51 pm
by Vilash
hey m getting this notice now....
Notice: Undefined index: recaptcha_challenge_field in C:\wamp\www\udupipages\registration.php on line 8

Re: Warning

Posted: Fri Feb 17, 2012 2:36 am
by jraede
A notice isn't really an error. It's just there to warn you when you have undefined variables or indexes of arrays, and maybe some other stuff. I usually turn them off. You can do error_reporting(E_ALL^E_NOTICE); at the top of your script, or turn it off in the php.ini file.

Re: Warning

Posted: Fri Feb 17, 2012 3:38 am
by Vilash
how to turn them off

Re: Warning

Posted: Fri Feb 17, 2012 3:50 am
by Vilash
bt m getting The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol) error though i type correct captcha

Re: Warning

Posted: Fri Feb 17, 2012 5:03 am
by Vilash
can anyone help me making form validation for my script....

<h1> Contact us</h1>
<form id="register" name="register" method="post" action="thanks1.php">
<table width="470" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="122">Name:<span style="color:#F00">*</span></td>
<td width="324"><input type="text" name="Name" id="name" /> </td>
</tr>
<tr>
<td>Email:<span style="color:#F00">*</span></td>
<td><input type="text" name="Email" id="email" /></td>
</tr>
<tr>
<td>Phone:<span style="color:#F00">*</span></td>
<td><input type="text" name="Phone" id="textfield3" /></td>
</tr>
<tr>
<td>Company:</td>
<td><input type="text" name="Company" id="textfield4" /></td>
</tr>
<tr>
<td>City:</td>
<td><input type="text" name="City" id="textfield5" /></td>
</tr>
<tr>
<td>State:</td>
<td><input type="text" name="State" id="textfield6" /></td>
</tr>
<tr>
<td>Country:<span style="color:#F00">*</span></td>
<td><input type="text" name="Country" id="textfield7" /></td>
</tr>
<tr>
<td>Zip:</td>
<td><input type="text" name="Zip" id="textfield8" /></td>
</tr>
<tr>
<td>Comments:</td>
<td><textarea name="Comments" cols="30" rows="5" id="textfield9"></textarea></td>
</tr>



<tr>
<td>&nbsp;</td>
<td><label>
<?php
require_once('recaptchalib.php');
$publickey = "6LfArs0SAAAAAOnQZ7xgMtjNFedLEBV8BVV6PgVh"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>

<input type="submit" name="button" id="button" value="Submit" />
</label></td>
</tr>
</table>
</form>

Re: Warning

Posted: Fri Feb 17, 2012 6:04 am
by Celauran
jraede wrote:You can do error_reporting(E_ALL^E_NOTICE); at the top of your script, or turn it off in the php.ini file.
A better idea, of course, is to actually correct your code.