-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
35 lines (34 loc) · 1.04 KB
/
index.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
<?php
header('Access-Control-Allow-Origin:*');error_reporting("E_ALL");ini_set("display_errors", 1);
header('Content-Type:application/json; charset=utf-8');
$d = isset($_GET['d']) ? $_GET['d'] : "";
$url = isset($_GET['url']) ? $_GET['url'] : "";
$pwd = isset($_GET['pwd']) ? $_GET['pwd'] : "";
$type = isset($_GET['type']) ? $_GET['type'] : "";
include('lanzou.clsss.php');
if(!empty($d) && empty($url)){$arr = explode('-',$d);$url=$arr[0];$pwd=$arr[1];$type='down';}
$lz = new lanzou;
if($type=='check'){
$info= $lz->checkurl();
$res=array('status'=>1,'info'=>$info);ajaxReturn($res);
}else{
$res=$lz->getUrl($url,$pwd);
if($res['status']==0)ajaxReturn($res);
switch($type){
case "down":
header("Location:".$res['info']);die;
break;
default:
ajaxReturn($res);
break;
}
}
function ajaxReturn($array){
$content=json_encode($array,JSON_UNESCAPED_UNICODE);
if(empty($_GET['callback'])){
echo $content;exit;
}else{
echo $_GET['callback']."(".$content.")";exit;
}
}
?>