Popravek izgleda strani za cakalno vrsto (kliki na minuto)
This commit is contained in:
parent
7b65aaaa37
commit
ff0c2391c1
70
function.php
70
function.php
@ -258,10 +258,68 @@ if (!function_exists('is_countable')) {
|
||||
|
||||
// Preverimo klike na minuto pri izpolnjevanju anekte da se ne zapolni sql
|
||||
if(!checkClicksPerMinute()){
|
||||
global $site_url;
|
||||
|
||||
http_response_code(425);
|
||||
echo '<h1>Service Unavailable.</h1>';
|
||||
$refresh_every = 5;
|
||||
|
||||
echo '<!DOCTYPE html>';
|
||||
echo '<html>';
|
||||
|
||||
echo '<head>';
|
||||
echo ' <title>Server Limit Reached</title>';
|
||||
echo ' <meta http-equiv="refresh" content="'.$refresh_every.'" />';
|
||||
echo ' <meta name="viewport" content="width=device-width, initial-scale=1.0" />';
|
||||
|
||||
echo ' <style>
|
||||
body{
|
||||
display: flex;
|
||||
align-content: center;
|
||||
height: 90vh;
|
||||
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
}
|
||||
.main{
|
||||
max-width: 1200px;
|
||||
margin: 50px auto;
|
||||
padding: 0 20px;
|
||||
|
||||
font-family: Montserrat, Arial, Sans-Serif !important;
|
||||
color: #505050;
|
||||
}
|
||||
h1{
|
||||
color: #1e88e5;
|
||||
text-align: center;
|
||||
margin: 30px 0;
|
||||
}
|
||||
hr{
|
||||
margin: 50px 0;
|
||||
|
||||
border: 0;
|
||||
border-top: 1px solid #ddeffd;
|
||||
}
|
||||
.loading{
|
||||
margin: 50px 0;
|
||||
text-align: center;
|
||||
}
|
||||
img{
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
</style>';
|
||||
echo '</head>';
|
||||
|
||||
echo '<body><div class="main">';
|
||||
echo ' <div class="loading"><img src="'.$site_url.'/public/img/icons/spinner.gif" /></div>';
|
||||
echo ' <h1>Dosežena omejitev strežnika</h1>';
|
||||
echo ' <h3>Prosimo, počakajte nekaj trenutkov. Trenutno je doseženo maksimalno število vnosov ankete na minuto.</h3>';
|
||||
echo ' <hr>';
|
||||
echo ' <h1>Server Limit Reached</h1>';
|
||||
echo ' <h3>Please wait a few moments. Currently, the maximum number of survey entries per minute has been reached.</h3>';
|
||||
echo '</div></body>';
|
||||
|
||||
echo '</html>';
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
@ -1148,9 +1206,11 @@ function root_dir($file = null)
|
||||
|
||||
// Pri izpolnjevanju ankete preverimo stevilo klikov na minuto - ce jih je prevec, respondenta zavrnemo, drugace se lahko sql zafila in streznik ni vec odziven
|
||||
function checkClicksPerMinute(){
|
||||
global $clicks_per_minute_limit;
|
||||
|
||||
// Stevilo klikov/minuto na anketo (izpolnjevanje), ki jih se pustimo preden zablokiramo dostop
|
||||
$click_minute_limit = 100;
|
||||
// Ce maximum na minuto ni nastavljen ignoriramo limit
|
||||
if(!isset($clicks_per_minute_limit) || $clicks_per_minute_limit == 0)
|
||||
return true;
|
||||
|
||||
// Preverimo ce gre za izpolnjevanje ankete
|
||||
if($_SERVER["SCRIPT_NAME"] != '/main/survey/index.php')
|
||||
@ -1179,7 +1239,7 @@ function checkClicksPerMinute(){
|
||||
}
|
||||
|
||||
// Click count je ok - pustimo naprej
|
||||
if($click_count < $click_minute_limit){
|
||||
if($click_count < $clicks_per_minute_limit){
|
||||
$sqlI = sisplet_query("UPDATE srv_clicks SET click_count=click_count+1 WHERE ank_id='".$_GET['anketa']."'");
|
||||
return true;
|
||||
}
|
||||
|
BIN
public/img/icons/spinner.gif
Normal file
BIN
public/img/icons/spinner.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Loading…
x
Reference in New Issue
Block a user