-
Notifications
You must be signed in to change notification settings - Fork 1
/
crypt.php
69 lines (55 loc) · 1.2 KB
/
crypt.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* used to decrypt/encrypt strings produced by the encodify/decodify functions*/
<?php
class ifier {
protected $key = 'V01GJhIuqvxF%4TUKg45v6<4';
public $options;
function encodify($url) {
$url = trim($url);
$url = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($this->key), $url, MCRYPT_MODE_CBC, md5(md5($this->key)));
$url = base64_encode($url);
$url = rawurlencode($url);
return $url;
}
function decodify($url) {
$url = rawurldecode($url);
$url = base64_decode($url);
$url = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($this->key), $url, MCRYPT_MODE_CBC, md5(md5($this->key)));
return $url;
}
// finish this
function absolutify($input) {
if (!$input) {
return $input;
}
}
}
// Initiate class
$ifier = new ifier();
if (@$_GET['dec']) {
$dec = $_GET['dec'];
}
if (@$_GET['enc']) {
$enc = $_GET['enc'];
}
?>
<html>
<head>
<title>Ifier!</title>
</head>
<body>
<form method="get" action="crypt.php">
<p>Encode:</p>
<input type="text" value="" name="dec">
<br><p>Decode:</p>
<input type="text" value="" name="enc">
<br>
<input type="submit" value="Submit">
</form>
<? if (@$enc) {
echo $ifier->decodify($enc) . "<br>";
}
if (@$dec) {
echo $ifier->encodify($dec) . "<br>";
}?>
</body>
</html>