-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.php
More file actions
37 lines (31 loc) · 1003 Bytes
/
Copy pathfunction.php
File metadata and controls
37 lines (31 loc) · 1003 Bytes
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
<?php
$hn = 'localhost';
$db = 'logindata';
$un = 'johnson';
$pw = 'johnsonpwd';
$conn = new mysqli($hn, $un, $pw, $db);
if($conn->connect_error) die("check your input parameters");
function createTable($name, $query){
query_Mysql("create table if not exists $name($query)");
echo "Table $name already existed.<br>";
}
function query_Mysql($query){
global $conn;
$result = $conn->query($query);
if(!$result) die("execute command error");
return $result;
}
function destroySession(){
$_SESSION = array();
if(session_id() != "" || isset($_COOKIE[session_name()]))
setcookie(session_name(), '', time() - 2592000, '/');
session_destroy();
}
function sanitizeString($var){
global $conn;
$var = strip_tags($var);
$var = htmlentities($var);
$var = stripslashes($var);
return $conn->real_escape_string($var);
}
?>