-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunction.php
More file actions
43 lines (40 loc) · 976 Bytes
/
function.php
File metadata and controls
43 lines (40 loc) · 976 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
38
39
40
41
42
<?php
include_once 'constant.php';
include_once 'config.php';
/**
* This function will check is the user authorized to the server.
* Will return 0 if not authorized.
*/
function checkAuth($mode=SU_WEB){
if($mode == SU_WEB){
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if(empty($_SESSION['uid']))
return 0;
else
return $_SESSION['uid'];
}
return -1;
}
function getUserFlag(){
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if(empty($_SESSION['uid']))
return SU_ANONYMOUS;
return $_SESSION['uflag'];
}
function processURL($url){
global $permittedSchema;
$pos = strpos($url,'://');
if($pos === false){
return SU_DEFAULT_SCHEMA.'://'.$url;
}
$schema = substr($url,0,$pos);
foreach($permittedSchema as $target){
if($schema == $target)
return $url;
}
return false;
}