forked from saggim/Tiny-Tiny-IRC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippet.php
48 lines (35 loc) · 1.18 KB
/
snippet.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
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) ."/include");
/* remove ill effects of magic quotes */
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ?
array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
require_once "functions.php";
require_once "sessions.php";
require_once "db-prefs.php";
require_once "sanity_check.php";
require_once "version.php";
require_once "config.php";
require_once "prefs.php";
require_once "users.php";
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$key = db_escape_string($_REQUEST['key']);
$result = db_query($link, "SELECT snippet FROM ttirc_snippets WHERE ".DB_KEY_FIELD." = '$key'");
header("Content-Type: text/plain; charset=utf-8");
if (db_num_rows($result) != 0) {
$text = db_fetch_result($result, 0, "snippet");
print $text;
} else {
print "Snippet not found.";
}
db_close($link);
?>