-
Notifications
You must be signed in to change notification settings - Fork 0
/
embed_visibility.php
61 lines (49 loc) · 1.33 KB
/
embed_visibility.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
58
59
60
61
<?php
$lines_setting;
if($user_found){
global $lines_setting;
global $user_name;
$lines_setting = file("./setting/".$user_name.".csv");
foreach($lines_setting as $line){
$data = explode(',',$line);
$data[1] = str_replace("\n","",$data[1]);
if($data[0] === "visibility"){
if($data[1] === "0"){
if(isset($_SESSION["id"])){
if($_SESSION["id"] !== $user_name){
allow_user_check_func();
}
}else{
$user_found = false;
$user_name = "";
}
}
}
}
}
function allow_user_check_func(){
global $user_name;
global $lines_setting;
global $user_found;
$allow_user_check = false;
foreach($lines_setting as $line){
$data = explode(',',$line);
$data[1] = str_replace("\n","",$data[1]);
if($data[0] == "allow_u"){
foreach(explode('($s)',$data[1]) as $user_line){
if($_SESSION["id"] === $user_line){
$allow_user_check = true;
}
}
if($allow_user_check === false){
$user_found = false;
$user_name = "";
}
}
}
}
if($user_found === false){
echo("404 Not found :(");
exit();
}
?>