-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.php
54 lines (53 loc) · 1 KB
/
library.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
<?
function fir($file){
$fo = fopen($file, "r");
$data = @fread($fo, filesize($file));
fclose($fo);
return $data;
}
function fia($file,$data){
$fd = @fopen($file, 'a');
fwrite($fd, $data);
fclose($fd);
}
function fiw($file,$data){
$fd = @fopen($file, 'w');
fwrite($fd, $data);
fclose($fd);
}
function cook($par,$val=false){
if($val!=""){
setcookie($par, $val, time()+60*60*24*30*6,"/");
}else{
setcookie($par, "", time(),"/");
}
}
$access=0;
if($_COOKIE["user"]!="" || $pass!=""){
if($pass=="") $pass=$_COOKIE["user"];
$userDataF=$path."users/q".$pass.".txt";
if(file_exists($userDataF)){
$access=1;
$userAccess=fir($userDataF);
if(strpos($userAccess,"view")===false){
$accessView=0;
}else{
$accessView=1;
}
if(strpos($userAccess,"edit")===false){
$accessEdit=0;
}else{
$accessEdit=1;
}
if(strpos($userAccess,"api")===false){
$accessApi=0;
}else{
$accessApi=1;
}
if(strpos($userAccess,"history")===false){
$accessHistory=0;
}else{
$accessHistory=1;
}
}
}