Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Cellophile
PersonaLink
Commits
3b0bbbc8
Commit
3b0bbbc8
authored
May 16, 2021
by
Cellophile
🎨
Browse files
Replace captcha.php
parent
3fc2767e
Changes
1
Hide whitespace changes
Inline
Side-by-side
captcha/captcha.php
View file @
3b0bbbc8
<?php
session_start
();
$_SESSION
[
'captcha'
]
=
mt_rand
(
1000
,
99999
);
$img
=
imagecreate
(
85
,
28
);
$font
=
'fonts/28DaysLater.ttf'
;
for
(
$s
=
''
,
$i
=
0
,
$z
=
strlen
(
$a
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
)
-
1
;
$i
!=
5
;
$x
=
rand
(
0
,
$z
),
$s
.
=
$a
{
$x
},
$i
++
);
$_SESSION
[
'captcha'
]
=
$s
;
$img
=
imagecreate
(
130
,
50
);
$input
=
array
(
"fonts/28DaysLater.ttf"
,
"fonts/Allrightsreserved.ttf"
,
"fonts/BrokenGlass.ttf"
,
"fonts/NewspaperCutoutWhiteOnBlac-Rg.ttf"
);
$choixfont
=
array_rand
(
$input
,
2
);
$font
=
$input
[
$choixfont
[
0
]];
$colorbackground
=
imagecolorallocate
(
$img
,
255
,
255
,
255
);
$textcolor
=
imagecolorallocate
(
$img
,
0
,
0
,
0
);
imagettftext
(
$img
,
2
3
,
0
,
6
,
3
0
,
$textcolor
,
$font
,
$_SESSION
[
'captcha'
]);
imagettftext
(
$img
,
3
0
,
0
,
10
,
4
0
,
$textcolor
,
$font
,
$_SESSION
[
'captcha'
]);
header
(
'content-type:image/jpeg'
);
imagejpeg
(
$img
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment