Fixed captcha and various improvements
This commit is contained in:
parent
26732d5cd8
commit
d032d1e427
4 changed files with 56 additions and 54 deletions
|
@ -27,8 +27,7 @@ class captcha{
|
|||
function getCaptcha(){
|
||||
global $config;
|
||||
if($config['captcha']==1) {
|
||||
//return '<div id="mcaptcha__widget-container"><label mcaptcha_url="https://'.$config['mcaptcha_url'].'/widget/?sitekey='.$config['mcaptcha_sitekey'].'" for="mcaptcha__token" id="mcaptcha__token-label"><input type="text" name="mcaptcha__token" id="mcaptcha__token" /></label></div><script src="https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-rc2/dist/index.js"></script>';
|
||||
return '<input type="text" name="shift" id="mcaptcha__token"><label data-mcaptcha_url="https://'.$config['mcaptcha_url'].'/widget/?sitekey='.$config['mcaptcha_sitekey'].'" for="mcaptcha__token" id="mcaptcha__token-label">mCaptcha authorization token.<a href="https://mcaptcha.org/docs/user-manual/how-to-mcaptcha-without-js/">Instructions</a>.</label><input type="text" name="mcaptcha__token"><div id="mcaptcha__widget-container"></div><script src="https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-rc2/dist/index.js"></script>';
|
||||
return '<label data-mcaptcha_url="https://'.$config['mcaptcha_url'].'/widget/?sitekey='.$config['mcaptcha_sitekey'].'" for="mcaptcha__token" id="mcaptcha__token-label">mCaptcha authorization token.<a href="https://mcaptcha.org/docs/user-manual/how-to-mcaptcha-without-js/">Instructions</a>.<input type="text" name="mcaptcha__token" id="mcaptcha__token" /></label><div id="mcaptcha__widget-container"></div> <script src="https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-rc2/dist/index.js"></script>';
|
||||
} else if ($config['captcha']==2) {
|
||||
return '<script src="https://www.google.com/recaptcha/api.js"></script><div class="g-recaptcha" data-sitekey="'.$config['recaptcha_sitekey'].'"></div>';
|
||||
} else {
|
||||
|
@ -37,9 +36,8 @@ class captcha{
|
|||
}
|
||||
|
||||
function validate($response){
|
||||
global $config;
|
||||
global $config,$functions;
|
||||
if($config['captcha']==1) {
|
||||
var_dump($response);
|
||||
if(isset($response['mcaptcha__token']) && $response['mcaptcha__token']!=''){
|
||||
$token = $response['mcaptcha__token'];
|
||||
} else {
|
||||
|
@ -65,19 +63,17 @@ class captcha{
|
|||
|
||||
// schließe den cURL-Handle und gebe die Systemresourcen frei
|
||||
curl_close($ch);
|
||||
var_dump($fh);
|
||||
if(!$fh){
|
||||
return false;
|
||||
}else{
|
||||
$response = json_decode($fh, true);
|
||||
if($response["valid"] !== true){
|
||||
$cresp = json_decode($fh, true);
|
||||
if($cresp["valid"] === true){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else if($config['captcha']==2) {
|
||||
var_dump($response);
|
||||
if(isset($response['g-recaptcha-response']) && $response['g-recaptcha-response']!=''){
|
||||
$data = $response['g-recaptcha-response'];
|
||||
} else {
|
||||
|
@ -95,12 +91,11 @@ class captcha{
|
|||
|
||||
// schließe den cURL-Handle und gebe die Systemresourcen frei
|
||||
curl_close($ch);
|
||||
|
||||
if(!$fh){
|
||||
return false;
|
||||
}else{
|
||||
$response = json_decode($fh, true);
|
||||
if($response["success"] !== true){
|
||||
$cresp = json_decode($fh, true);
|
||||
if($cresp["success"] === true){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
$module["session"]["name"]="Sessionmanagement Module";
|
||||
$module["session"]["ver"]="0.9.0";
|
||||
$module["session"]["ver"]="0.9.1";
|
||||
/**
|
||||
* Project: astat - simple site engine
|
||||
* File: /inc/sessions.class.php
|
||||
* File: /inc/sessions.class.php
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -187,8 +187,15 @@ class session {
|
|||
if((isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])) || $https){
|
||||
$https = true;
|
||||
}
|
||||
setcookie($name, $data, $validto, $path, $domain,$httponly,$https);
|
||||
|
||||
$arr_cookie_options = array (
|
||||
'expires' => $validto,
|
||||
'path' => $path,
|
||||
'domain' => $domain, // leading dot for compatibility or use subdomain
|
||||
'secure' => $https, // or false
|
||||
'httponly' => $httponly, // or false
|
||||
'samesite' => 'Strict' // None || Lax || Strict
|
||||
);
|
||||
setcookie($name, $data, $arr_cookie_options);
|
||||
}
|
||||
|
||||
function update_session($sid, $uid=''){
|
||||
|
|
|
@ -11,7 +11,7 @@ class module_text extends admin_module{
|
|||
$info["name"]="Textverwaltung";
|
||||
$info["file"]="text";
|
||||
$info["author"]="astat";
|
||||
$info["version"]="1.0.0";
|
||||
$info["version"]="1.0.1";
|
||||
$info["url"]="http://www.astat.org";
|
||||
return $info;
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ class module_text extends admin_module{
|
|||
`text` text NOT NULL,
|
||||
`date` int(11) NOT NULL default '0',
|
||||
`author` int(11) NOT NULL default '0',
|
||||
`eid` int(11) NOT NULL,
|
||||
`edittime` int(11) NOT NULL,
|
||||
`eid` int(11) NULL default NULL,
|
||||
`edittime` int(11) NULL default NULL,
|
||||
`menue` int(11) NOT NULL default '0',
|
||||
`title` varchar(80) NOT NULL default '',
|
||||
`url` varchar(120) NOT NULL,
|
||||
|
|
|
@ -7,47 +7,47 @@
|
|||
<span style="text-align:center; display:block;">
|
||||
{$emsg}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="row add-bottom">
|
||||
<div class="six columns add-bottom">
|
||||
<form class="registerform" action="/register.php" method="post">
|
||||
<fieldset>
|
||||
<strong><img src="themes/default/images/icons/user.png" style="border:none;"/> Nickname:<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/><br /></strong>
|
||||
<input type="text" value="{$data.username}" name="username" size="20" maxlength="25" />
|
||||
<strong><img src="themes/default/images/icons/key.png" style="border:none;"/> Passwort:<img src="themes/default/images/icons/bullet_star.png" style="border:none;" /></strong><br />
|
||||
<input type="password" name="password" size="20" maxlength="20" />
|
||||
<strong><img src="themes/default/images/icons/cake.png" style="border:none;"/> Geburtstag:<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/></strong><br />
|
||||
<input type="text" value="{$data.birthday}" name="birthday" id="birthday" size="10" maxlength="10" style="display:initial;"/> <img src="themes/default/images/icons/date.png" onclick="displayCalendar(document.getElementById('birthday'),'dd.mm.yyyy',this)"/><br/>
|
||||
<strong><img src="themes/default/images/icons/map.png" style="border:none;"/> Herkunft:</strong><br />
|
||||
<input type="text" value="{$data.from}" name="from" size="20" maxlength="40" />
|
||||
</div>
|
||||
<div class="six columns add-bottom">
|
||||
<strong><img src="themes/default/images/icons/email.png" style="border:none;"/> E-Mail:<img src="themes/default/images/icons/bullet_star.png" style="border:none;" /></strong><br />
|
||||
<input type="text" value="{$data.email}" name="email" size="20" maxlength="40" />
|
||||
<strong><img src="themes/default/images/icons/key.png" style="border:none;" /> Passwort wiederholen:<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/></strong><br />
|
||||
<input type="password" name="cpassword" size="20" maxlength="25" />
|
||||
<strong><img src="themes/default/images/icons/user_orange.png" style="border:none;"/> Realname:<br /></strong>
|
||||
<input type="text" value="{$data.realname}" name="realname" size="20" maxlength="25" />
|
||||
<strong><img src="themes/default/images/icons/female.png" style="border:none;"/>/<img src="themes/default/images/icons/male.png" style="border:none;" /> Geschlecht:<br /></strong>
|
||||
<select name="gender">
|
||||
<option value="N/A">N/A</option>
|
||||
<option value="Weiblich">Weiblich</option>
|
||||
<option value="Männlich">Männlich</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row add-bottom">
|
||||
<div class="twelve columns">
|
||||
</div>
|
||||
<form class="registerform" action="/register.php" method="post">
|
||||
<fieldset>
|
||||
<div class="row add-bottom">
|
||||
<div class="six columns add-bottom">
|
||||
<strong><img src="themes/default/images/icons/user.png" style="border:none;"/> Nickname:<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/><br /></strong>
|
||||
<input type="text" tabindex="1" value="{$data.username}" name="username" size="20" maxlength="25" />
|
||||
<strong><img src="themes/default/images/icons/key.png" style="border:none;"/> Passwort:<img src="themes/default/images/icons/bullet_star.png" style="border:none;" /></strong><br />
|
||||
<input type="password" tabindex="3" name="password" size="20" maxlength="20" />
|
||||
<strong><img src="themes/default/images/icons/cake.png" style="border:none;"/> Geburtstag:<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/></strong><br />
|
||||
<input type="text" tabindex="5" value="{$data.birthday}" name="birthday" id="birthday" size="10" maxlength="10" style="display:initial;"/> <img src="themes/default/images/icons/date.png" onclick="displayCalendar(document.getElementById('birthday'),'dd.mm.yyyy',this)"/><br/>
|
||||
<strong><img src="themes/default/images/icons/map.png" style="border:none;"/> Herkunft:</strong><br />
|
||||
<input type="text" tabindex="7" value="{$data.from}" name="from" size="20" maxlength="40" />
|
||||
</div>
|
||||
<div class="six columns add-bottom">
|
||||
<strong><img src="themes/default/images/icons/email.png" style="border:none;"/> E-Mail:<img src="themes/default/images/icons/bullet_star.png" style="border:none;" /></strong><br />
|
||||
<input type="text" tabindex="2" value="{$data.email}" name="email" size="20" maxlength="40" />
|
||||
<strong><img src="themes/default/images/icons/key.png" style="border:none;" /> Passwort wiederholen:<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/></strong><br />
|
||||
<input type="password" tabindex="4" name="cpassword" size="20" maxlength="25" />
|
||||
<strong><img src="themes/default/images/icons/user_orange.png" style="border:none;"/> Realname:<br /></strong>
|
||||
<input type="text" tabindex="6" value="{$data.realname}" name="realname" size="20" maxlength="25" />
|
||||
<strong><img src="themes/default/images/icons/female.png" style="border:none;"/>/<img src="themes/default/images/icons/male.png" style="border:none;" /> Geschlecht:<br /></strong>
|
||||
<select tabindex="8" name="gender">
|
||||
<option value="N/A">N/A</option>
|
||||
<option value="Weiblich">Weiblich</option>
|
||||
<option value="Männlich">Männlich</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row add-bottom">
|
||||
<div class="twelve columns">
|
||||
<input type="checkbox" value="1" name="agreed" id="agreed" /><strong> Ich stimme den <a href="/text/nutzungsbedingungen.html">Nutzungsbedingungen</a> zu und bestätige mindestens 16 Jahre alt zu sein.</strong><img src="themes/default/images/icons/bullet_star.png" style="border:none;"/>
|
||||
{if $captcha != ""}
|
||||
<legend>Captcha<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/></legend>
|
||||
{$captcha}
|
||||
{/if}
|
||||
</fieldset>
|
||||
|
||||
<img src="themes/default/images/icons/bullet_star.png" style="border:none;"/> Pflichtfelder<br />
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="sid" value="{$sid}" />
|
||||
<input type="submit" class="button" name="submit" value="Register" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue