forked from sirkris/phpMeow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimal.image.phpmeow.php
More file actions
71 lines (59 loc) · 1.43 KB
/
animal.image.phpmeow.php
File metadata and controls
71 lines (59 loc) · 1.43 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
* phpMeow - A Cute and Fuzzy Alternative to CAPTCHA
* Created by Kris Craig. April - July, 2011.
*
* phpMeow is the first fully-functional, secure
* implementation of KittenAuth in PHP.
*
* This software is open-source and you're free to
* use and/or distribute it as you see fit. See
* LICENSE file for more information.
*
* Get the latest version at: http://www.github.com/sirkris/phpmeow
*/
foreach ( $_GET as $getvar => $getval )
{
$$getvar = $getval;
}
require( "config.phpmeow.php" );
$session = new phpmeow_session();
$session->start();
if ( $_SESSION[$getkey] != NULL )
{
$im = @imagecreatefromjpeg( $_SESSION[$getkey] );
phpmeow_animal::render( $im );
phpmeow_block::destroy( $getkey );
}
else
{
$imagedir = new phpmeow_imagedir();
$animals = $imagedir->load_cute_fuzzy_animals( $phpmeow_animalsdir );
/* If you're not calling this script client-side, it should be safe not to encrypt. --Kris */
if ( $_GET["ue"] == 1 )
{
$image = $imgpath;
}
else
{
/* Less efficient, but hella more secure. --Kris */
$encryption = new phpmeow_encryption();
$image = NULL;
foreach ( $animals as $animal => $files )
{
foreach ( $files as $fkey => $file )
{
if ( strcmp( $encryption->encrypt_string( $file, TRUE ), $imgpath ) == 0 )
{
$image = $file;
break;
}
}
if ( $image != NULL )
{
break;
}
}
}
phpmeow_animal::create( $image, $xmod, $ymod );
}