我正在开发一个注册表,因为我想放置CAPTCHA.我生成一个随机字符串,但如何将其转换为图像其他明智的我如何开发CAPTCHA代码或任何参考.谢谢
新的演示代码:
我试图从AOL获取验证码图像,并且我一直收到错误418.
unit imageunit;
///
/// https://new.aol.com/productsweb/
///
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL,
IdSSLOpenSSL, IdIntercept, IdZLibCompressorBase, IdCompressorZLib,
IdCookieManager, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP,jpeg,GIFImg, ExtCtrls, PerlRegEx;
type
TForm2 = class(TForm)
IdHTTP1: TIdHTTP;
IdCookieManager1: TIdCookieManager;
IdCompressorZLib1: TIdCompressorZLib;
IdConnectionIntercept1: TIdConnectionIntercept;
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
Panel1: TPanel;
Image1: TImage;
Panel2: TPanel;
Button1: TButton;
PerlRegEx1: TPerlRegEx;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation …Run Code Online (Sandbox Code Playgroud) 我很想知道在我的电子邮件和联系表单上防止DoS攻击的好方法.
我有一个"与朋友分享"功能,它打开了我创建的一个表单,但我宁愿不加入CAPTCHA.
我在这里看到了一个jQuery + PHP解决方案:http://docs.jquery.com/Tutorials : Safer_Contact_Forms_Without_CAPTCHAs#PHP_File
它看起来是一个很好的解决方案,我只是想帮助将PHP翻译成C#.我猜测ASHX文件最好用.
如果还有其他(更好的?)解决方案,我很乐意听到它们.
我正在使用commonlibrary中的Captcha类(http://commonlibrarynet.codeplex.com/).我的代码工作和一切,但现在我正在尝试编写单元测试.
我的验证规则是:
RuleFor(x => x.CaptchaUserInput)
.NotEmpty()
.Must((x, captchaUserInput) => Captcha.IsCorrect(captchaUserInput, x.CaptchaGeneratedText))
.WithMessage("Invalid captcha code");
Run Code Online (Sandbox Code Playgroud)
在我的设置代码中,我尝试执行以下操作:
A.CallTo(() => Captcha.IsCorrect()).Returns(true);
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误消息:
SetUp : FakeItEasy.Configuration.FakeConfigurationException :
The current proxy generator can not intercept the specified method for the following reason:
- Static methods can not be intercepted.
at FakeItEasy.Configuration.DefaultInterceptionAsserter.AssertThatMethodCanBeInterceptedOnInstance(Metho dInfo method, Object callTarget)
at FakeItEasy.Configuration.FakeConfigurationManager.CallTo(Expression`1 callSpecification)
at ProdMaster.Hosts.Web.Tests.Unit.Controllers.AccountControllerTests.SetUp() in AccountControllerTests.cs: line 44
Run Code Online (Sandbox Code Playgroud)
所以问题实际上是如何使用FakeItEasy伪造静态方法.
TIA,
大卫
captcha unit-testing common-library fluentvalidation fakeiteasy
我有关于http://code.google.com/p/django-simple-captcha/项目的问题.我按照程序安装验证码,表格有效,但浏览器不加载图片.该怎么办?
我的模式:
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'main.views.main', name="main_page"),
url(r'^registration$', 'main.views.registration', name="registration"),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
# Captcha
url(r'^captcha/', include('captcha.urls')),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^files/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)
Run Code Online (Sandbox Code Playgroud) 我注意到有些用户通过下载多个文件(例如同时500个文件)来重载我的网站并在较短的时间内打开更多页面,我想显示验证码,如果用户检测到意外导航.
我知道如何实现Captcha,但我无法弄清楚使用(PHP)检测流量滥用的最佳方法是什么?
我有注册网页,但在最后一个验证码显示..
我无法从图像中读取文本.我要提一下代码和输出..
@Test
public void loginTest() throws InterruptedException {
System.out.println("Testing");
driver.get("https://customer.onlinelic.in/ForgotPwd.htm");
WebElement element = driver.findElement(By.xpath("//*[@id='forgotPassword']/table/tbody/tr[5]/td[3]/img"));
System.out.println(" get the instance ");
String elementTest = element.getAttribute("src");
System.out.println("Element : " + elementTest);
}
Run Code Online (Sandbox Code Playgroud)
输出:错误
例外在线程"主" org.openqa.selenium.NoSuchElementException:无法找到元素:{ "方法": "的xpath", "选择器":"// [@ ID = 'forgotPassword'] /表/ tbody的/ TR [ 5]/td [3]/img"}命令持续时间或超时:60.02秒有关此错误的文档,请访问:http://seleniumhq.org/exceptions/no_such_element.html 构建信息:版本: '2.35.0',修订版: '8df0c6b',时间: '2013年8月12日15时43分19秒' 信息:os.name: 'Windows 7的',os.arch: 'AMD64' ,os.version: '6.1',java.version: '1.6.0_26' 会话ID:5f5b2e1a-56a4-49ad-8fd3-2870747a7768驱动信息:org.openqa.selenium.firefox.FirefoxDriver能力[{平台= XP,acceptSslCerts = TRUE,javascriptEnabled = TRUE,browserName =火狐,旋转=假,locationContextEnabled = TRUE,版本= 23.0.1,cssSelectorsEnabled = TRUE,databaseEnabled = TRUE,handlesAlerts = TRUE,browserConnectionEnabled = TRUE,nativeEvents = TRUE,webStorageEnabled = …
根据我的标题,我如何在PHP中刷新Google的recaptcha插件的重新搜索图像.可能吗?
我意识到没有第二次尝试相同图像的插件,所以我的看法是每次用户输入和失败时,我将需要使用jquery刷新图像.
我不想也不需要刷新页面,因为我使用.post来检查验证码输入.
以下是我的Javascript代码.
if($("input[name='recaptcha_response_field']").val().length<=0){
formOkay=0;
alert('Captcha helps prevent Spamming. Captcha Cannot be empty');
return false;
}else{
$.post('/external_scripts/recaptcha-php-1.11/jpost/verification.php',$("form[name='registration']").serialize(),function(data){
if(data==0){
formOkay=0;
alert('Captcha is Wrong');
return false;
}else{
..CARRY ON WITH FORM SUBMISSION
Run Code Online (Sandbox Code Playgroud) 我已经从谷歌安装了最新的recaptcha,但它总是在提交后返回false并且总是返回"invalid-input-secret"错误,即使从前端视图验证总是正确的.这可能是什么原因.顺便说一句,我正在使用phalcon框架测试localhost xampp中的所有内容.这是我检查验证码的部分:
protected function validate_data($post, $ip){
$validation = new Validation();
$validation->add(
'user_name',
new PresenceOf(
array(
'message' => 'The Username is required'
)
)
);
$validation->add(
'email',
new PresenceOf(
array(
'message' => 'The e-mail is required'
)
)
);
$validation->add(
'password',
new PresenceOf(
array(
'message' => 'The Password is required'
)
)
);
$validation->add(
'cpassword',
new PresenceOf(
array(
'message' => 'The Confirmation Password is required'
)
)
);
$validation->add(
'email',
new Email(
array(
'message' => 'The e-mail is not valid'
) …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的网站(用PHP和Wordpress开发)中植入Google的reCaptcha V2。
我正在尝试验证用户是否在提交之前检查了此验证码。
这是我的验证:
<?php
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
$privatekey = $secret;
$captcha = $_POST['g-recaptcha-response'];
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = array(
'secret' => $privatekey,
'response' => $captcha,
'remoteip' => $_SERVER['REMOTE_ADDR']
);
$curlConfig = array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $data
);
$ch = curl_init();
curl_setopt_array($ch, $curlConfig);
$response = curl_exec($ch);
curl_close($ch);
$jsonResponse = json_decode($response);
if ($jsonResponse->success == true) {
$succMsg = 'Your contact request have submitted successfully.';
echo "<script>alert(\"OK\")</script>";
}
else {
$errMsg = 'Robot verification …Run Code Online (Sandbox Code Playgroud) captcha ×10
php ×4
jquery ×3
asp.net ×2
abuse ×1
c# ×1
delphi ×1
django ×1
fakeiteasy ×1
indy ×1
indy10 ×1
java ×1
phalcon ×1
python ×1
recaptcha ×1
selenium ×1
unit-testing ×1
verification ×1
web-traffic ×1
wordpress ×1