Add exams from exam156 to exam199
This commit is contained in:
BIN
exam164/HappySwirly-KVB7l.ttf
Normal file
BIN
exam164/HappySwirly-KVB7l.ttf
Normal file
Binary file not shown.
31
exam164/generate.php
Executable file
31
exam164/generate.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
header('Content-type: image/jpeg');
|
||||
|
||||
$text = $_SESSION['secure'];
|
||||
$font_size = 30;
|
||||
|
||||
$image_width = 120;
|
||||
$image_height = 40;
|
||||
|
||||
$image = imagecreate($image_width,$image_height);
|
||||
imagecolorallocate($image, 255, 255, 255);
|
||||
$text_color = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
for ($x = 1; $x <= 30; $x++) {
|
||||
$x1 = rand(1,100);
|
||||
$y1 = rand(1,100);
|
||||
$x2 = rand(1,100);
|
||||
$y2 = rand(1,100);
|
||||
|
||||
imageline($image,$x1,$y1,$x2,$y2,$text_color);
|
||||
}
|
||||
|
||||
|
||||
$font_filename = '/var/www/nikola/practice/exam164/HappySwirly-KVB7l.ttf'; // mora cela putanja
|
||||
|
||||
imagettftext($image, $font_size, 0, 15, 30,$text_color,$font_filename,$text);
|
||||
imagejpeg($image);
|
||||
|
||||
?>
|
||||
27
exam164/index.php
Executable file
27
exam164/index.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
|
||||
if(!isset($_POST['secure'])){
|
||||
$_SESSION['secure'] = rand(1000, 9999);
|
||||
}else {
|
||||
if($_POST['secure'] == $_SESSION['secure']){
|
||||
echo 'You are not robot';
|
||||
} else {
|
||||
echo 'Try again';
|
||||
$_SESSION['secure'] = rand(1000, 9999);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<br>
|
||||
<img src="generate.php"/><br>
|
||||
|
||||
<form action="index.php" method="POST">
|
||||
Write a number from picture:
|
||||
<input type="text" size="6"name="secure">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
Reference in New Issue
Block a user