-
Notifications
You must be signed in to change notification settings - Fork 9
/
macro1.php
50 lines (50 loc) · 1.44 KB
/
macro1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types=1);
/**
* MCCodes v2 by Dabomstew & ColdBlooded
*
* Repository: https://github.com/davemacaulay/mccodesv2
* License: MIT License
*/
global $ir, $h, $set;
require_once('globals.php');
if (!$set['validate_on'] || $ir['verified'])
{
echo 'What are you doing on this page? Go somewhere else.';
$h->endpage();
exit;
}
if (!isset($_GET['refer']) || !is_string($_GET['refer']))
{
echo 'Invalid usage.';
$h->endpage();
exit;
}
unset($_SESSION['captcha']);
$chars =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
$len = strlen($chars);
$_SESSION['captcha'] = '';
for ($i = 0; $i < 6; $i++)
{
$_SESSION['captcha'] .= $chars[rand(0, $len - 1)];
}
$valid_csrf = request_csrf_code('validation');
echo "<h3>Validation</h3><hr />
Enter the text you see in the image into the box below.
<form action='macro2.php' method='post'>";
if (isset($_GET['code']))
{
echo "<font color='red'><b>Invalid code or blank</b></font><br />";
}
$_GET['refer'] =
addslashes(
htmlentities(stripslashes($_GET['refer']), ENT_QUOTES,
'ISO-8859-1'));
echo "
<img src='captcha_verify.php' alt='CAPTCHA - refresh if invisible' /><br />
Text: <input type='text' name='captcha' /><br />
<input type='hidden' name='verf' value='{$valid_csrf}' />
<input type='hidden' name='refer' value='{$_GET['refer']}' />
<input type='submit' value='Verify' /></form>";
$h->endpage();