-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.php
57 lines (50 loc) · 1.54 KB
/
common.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
<?php
session_start();
//error_reporting(0);
echo "<meta charset=\"UTF-8\">";
/*/////////////////////////////
사이트 설정관한 모든것이 있는 파일입니다.
/////////////////////////////*/
$site_title = "Teamplate";
//Site Path
$_PATH_ = "/";
//Connect database
$connect = mysqli_connect("localhost", "root", "dladydtjdtjd1", "template_1");
mysqli_query($connect, "SET NAMES utf8");
mysqli_query($connect, "set session character_set_connection=utf8");
mysqli_query($connect, "set session character_set_results=utf8");
mysqli_query($connect, "set session character_set_client=utf8");
//Check user login
$id = $_SESSION['user_id'];
$pw = $_SESSION['user_pw'];
$user = mysqli_fetch_array(mysqli_query($connect, "select * from users where user_id='".$id."' and user_pw='".md5($pw)."'"));
function login_check() {
if(!isset($_SESSION['user_id']) || !isset($_SESSION['user_pw']) || $user[0] == null || preg_match('/\'|\"|\`| | |\||[!#$%^&*()?+=\/]/i', $id) || preg_match('/\'|\"|\`| | |\|/i', $pw)) {
return false;
}
return true;
}
//User Info
if($user[0] == null) {
$user_lv = 0;
} else {
$user_id = $user['user_id'];
$user_pw = $user['user_pw'];
$user_lv = $user['user_level'];
$user_name = $user['user_name'];
$user_per = $user['user_per'];
$user_ip = $user['user_ip'];
}
//Alert Function
function alert($text) {
if($text == null) {
echo "<script>alert('Null Value');</script>";
return;
}
echo "<script>alert('".$text."');</script>";
}
//Change Page Function
function page($page) {
echo("<script>location.replace('".$page."');</script>");
}
?>