Added dependency net.intellivoid.khm

This commit is contained in:
Zi Xing 2022-02-05 16:30:54 -05:00
parent fe7d09730f
commit d333ad5961
2 changed files with 67 additions and 0 deletions

View File

@ -31,6 +31,12 @@
"version": "latest",
"source": "symfony@composer/uid",
"required": true
},
{
"package": "net.intellivoid.khm",
"version": "latest",
"source": "default@github/intellivoid/khm",
"required": true
}
],
"configuration": {

View File

@ -0,0 +1,61 @@
<?php
require 'ppm';
require 'net.intellivoid.vcaptcha';
$vcaptcha = new \vCaptcha\vCaptcha();
$instance = $vcaptcha->getCaptchaInstanceManager()->getInstance('33da77bc-13d8-474e-b293-5ed550a7b7b4');
if($instance->CaptchaType !== \vCaptcha\Abstracts\CaptchaType::None)
{
print("Captcha instance not supported");
exit();
}
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vcaptcha_challenge_field']))
{
try
{
$captcha = $vcaptcha->getCaptchaManager()->getCaptcha($_POST['vcaptcha_challenge_field']);
}
catch(\vCaptcha\Exceptions\CaptchaNotFoundException $e)
{
print("Captcha not found");
exit();
}
catch(Exception $e)
{
print("Error: " . $e->getMessage());
exit();
}
}
$captcha = $vcaptcha->getCaptchaManager()->createCaptcha($instance);
?>
<!DOCTYPE html>
<html>
<head>
<title>Captcha None</title>
</head>
<body>
<h2>Captcha None</h2>
<form action="captcha_none.php" method="POST">
<label for="fname">First name:</label>
<br/>
<input type="text" id="fname" name="fname" value="John">
<br/>
<label for="lname">Last name:</label>
<br/>
<input type="text" id="lname" name="lname" value="Doe">
<br/><br/>
<input type="hidden" id="vcaptcha_challenge_field" name="vcaptcha_challenge_field" value="<?PHP print($captcha->ID) ?>">
<input type="submit" value="Submit">
</form>
</body>
</html>