summaryrefslogtreecommitdiffstats
path: root/www/_main.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/_main.inc.php')
-rw-r--r--www/_main.inc.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/www/_main.inc.php b/www/_main.inc.php
new file mode 100644
index 0000000..9068d69
--- /dev/null
+++ b/www/_main.inc.php
@@ -0,0 +1,33 @@
+<?php
+
+function db_escape($s) { return mysql_escape_string($s); }
+
+function db_connect() {
+ mysql_pconnect('localhost', 'sse_ro', 'Shu5ahdo');
+ mysql_select_db('sse');
+}
+
+function split_q($q) {
+ $q = preg_replace('/[^a-zA-Z0-9_\s]/', '', trim($q));
+ return preg_split('/\s/', $q, -1, PREG_SPLIT_NO_EMPTY);
+}
+
+function stripslashes_deep($value) {
+ if (!is_array($value)) return stripslashes($value);
+ $n = array();
+ foreach ($value as $k => $v) {
+ $n[stripslashes($k)] = stripslashes_deep($v);
+ }
+ return $n;
+}
+
+if (get_magic_quotes_gpc()) {
+ $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
+ $_POST = array_map('stripslashes_deep', $_POST);
+ $_GET = array_map('stripslashes_deep', $_GET);
+ $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
+}
+
+$num_default = 25;
+
+?> \ No newline at end of file