-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
48 lines (38 loc) · 1.35 KB
/
functions.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 //functioon.php
$dbhost = 'localhost'; //Unlikely to require changing
$dbname = 'anexistingdb'; //Modify these...
$dbuser = 'blaccconnect'; //..variables acording
$dbpass = 'apassword'; //...to your installation
$appname = "B.L.A.C.C. Connet"; //...and preference
mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
mysql_select_db($dbname)or die(mysql_error());
function createTable($name,$query) {
queryMysql("Create TABLE IF NOT EXIST $name($query)");
echo "TABLE $name create or already exists.<br />";
}
function queryMysql($query) {
$result = mysql_query($query) or die(mysql_error());
return $result;
}
function destorySession() {
$_SESSION=array();
if (session_id() != "" || isset($_COOKIE[session_name()]))
setcookie(session_name(), '', time()-2592000, '/');
session_destory();
}
function sanitizeString($var) {
$var = strip_tags($var);
$var = htmlentities($var);
$var = stripslashes($var);
return mysql_real_escape_string($var);
}
function showProfile($user) {
if (file_exists("$user.jpg"))
echo "<img scr='$user.jpg' align='left' />";
$result = queryMysql("SELECT * FROM profiles WHERE user='$user'");
if (mysql_num_rows($result)) {
$row = mysql_fetch_row($result);
echo stripslashes($row[1]) . "<br clear='left' /><br/>";
}
}
?>