first commit
This commit is contained in:
+166
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
// 创建桌面快捷方式
|
||||
$save_name = input('save_name');
|
||||
$save_url = input('save_url');
|
||||
if ($save_name && $save_url) {
|
||||
header("Content-Type: application/octet-stream");
|
||||
//$ua = $_SERVER["HTTP_USER_AGENT"];
|
||||
$filename = urldecode($save_name) . '.url';//生成的文件名
|
||||
$encoded_filename = urlencode($filename);
|
||||
$encoded_filename = str_replace("+", "%20", $encoded_filename);
|
||||
if (preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
|
||||
} elseif (preg_match("/Firefox/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
// header('Content-Disposition: attachment; filename*="utf8' . $filename . '"');
|
||||
header('Content-Disposition: attachment; filename*="' . $filename . '"');
|
||||
} else {
|
||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||
}
|
||||
return "
|
||||
[InternetShortcut]
|
||||
URL={$save_url}
|
||||
Prop3=19,2
|
||||
IconIndex=1
|
||||
";
|
||||
}
|
||||
// 请求类型
|
||||
switch (input('type')) {
|
||||
case 'checkweixin':
|
||||
$txt_url = input('txt_url');
|
||||
if (!preg_match('/(http:\/\/)|(https:\/\/)/i', $txt_url)) {
|
||||
$txt_url = 'http://' . $txt_url;
|
||||
}
|
||||
// 官方API接口
|
||||
$api = get_headers('http://mp.weixinbridge.com/mp/wapredirect?url=' . urlencode($txt_url), 1);
|
||||
if (isset($api['Location']['1'])) {
|
||||
if ($api['Location']['1'] == $txt_url) {
|
||||
$code = 0;
|
||||
$msg = '域名正常!';
|
||||
} else {
|
||||
$code = 1;
|
||||
$msg = '域名被拦截!';
|
||||
}
|
||||
}
|
||||
json(array(
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'status' => 1
|
||||
));
|
||||
break;
|
||||
case 'check_url':
|
||||
$page = input('page', 1);
|
||||
$url = input('url');
|
||||
$str = Fcurl($url);
|
||||
$count_str = '';
|
||||
$data = '';
|
||||
$list = array(array(), array(), 0);
|
||||
if ($str) {
|
||||
preg_match_all('/<a .*?href="(.*?)".*?>/is', $str, $ahref);
|
||||
$aLink = [];
|
||||
$title = preg_replace("/.*<title>(.*?)<\/title>.*/is", '\\1', $str);
|
||||
$url_p = 'http://' . preg_replace("/(http[s]?:)?(\/\/)?([\w.]+)[\w\/]*[\w.]*\??[\w=&\+\%]*/is", '\\3', $url);
|
||||
$id = 1;
|
||||
$aLink[] = array(
|
||||
'url' => $url_p,
|
||||
'title' => $title,
|
||||
'id' => $id
|
||||
);
|
||||
$arr = array();
|
||||
foreach ($ahref['1'] as $key => $vo) {
|
||||
$qdiv = substr($vo, 0, 1) != '#' && $vo != '/' && substr($vo, 0, 11) != 'javascript:';
|
||||
if ($qdiv && $vo != $url_p && !in_array($vo, $arr)) {
|
||||
$arr[] = $vo;
|
||||
if (substr($vo, 0, 2) == '//') {
|
||||
++$id;
|
||||
$aLink[] = array(
|
||||
'url' => 'http:' . $vo,
|
||||
'title' => '',
|
||||
'id' => $id
|
||||
);
|
||||
} else
|
||||
if (substr($vo, 0, 4) == 'http') {
|
||||
++$id;
|
||||
$aLink[] = array(
|
||||
'url' => $vo,
|
||||
'title' => '',
|
||||
'id' => $id
|
||||
);
|
||||
} else {
|
||||
if (substr($vo, 0, 1) == '/') {
|
||||
++$id;
|
||||
$aLink[] = array(
|
||||
'url' => $url_p . $vo,
|
||||
'title' => '',
|
||||
'id' => $id
|
||||
);
|
||||
} else {
|
||||
++$id;
|
||||
$aLink[] = array(
|
||||
'url' => $url_p . '/' . $vo,
|
||||
'title' => '',
|
||||
'id' => $id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$list = page($aLink, 20, $page);
|
||||
for ($i = 1; $i <= $list['1']; $i++) {
|
||||
$count_str .= '<li class="page-number "><a href="javascript:;" style="' . ($i == $page ? 'background:#ccc' : '') . '" onclick="get_data(' . $i . ')">' . $i . '</a></li>';
|
||||
}
|
||||
foreach ($list['0'] as $key => $vo) {
|
||||
$data .= '<tr class=""><td class="order">' . $vo['id'] . '</td><td class="title" id="tr_title_' . $vo['id'] . '">' . ($vo['title'] ? $vo['title'] : ' - ') . '</td><td class="owner" style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"><a class="green" href="' . $vo['url'] . '" target="_blank">' . $vo['url'] . '</a></td><td class="title" id="tr_' . $vo['id'] . '"> - </td></tr>';
|
||||
}
|
||||
}
|
||||
json(array(
|
||||
'status' => $str ? 1 : 0,
|
||||
'data' => $data,
|
||||
'obj' => $list['0'],
|
||||
'total_count' => $list['2'],
|
||||
'count_str' => $count_str
|
||||
));
|
||||
break;
|
||||
case 'single_url':
|
||||
$url = input('url');
|
||||
$str = '';
|
||||
if ($url) {
|
||||
$str = urltitlecode($url);
|
||||
}
|
||||
json($str);
|
||||
break;
|
||||
case 'camelcase':
|
||||
$id = input('id');
|
||||
$text = input('text');
|
||||
if ($id == 2) {
|
||||
$text = preg_replace_callback('/([^a-zA-Z][a-z])/', function ($m) {
|
||||
$str = str_replace('_', '', $m[0]);
|
||||
return strtoupper($str);
|
||||
}, ucfirst($text));
|
||||
} else {
|
||||
$text = preg_replace_callback('/(([A-Z]).*?([A-Z]))/', function ($m) {
|
||||
$str = str_replace($m['3'], '_' . $m['3'], $m[0]);
|
||||
return $str;
|
||||
}, ucfirst($text));
|
||||
$text = strtolower($text);
|
||||
}
|
||||
$data = array();
|
||||
$data['status'] = $text ? 1 : 0;
|
||||
$data['msg'] = $text;
|
||||
json($data);
|
||||
break;
|
||||
default:
|
||||
/*$ifpost = 0;
|
||||
$datafields = '';
|
||||
$post = input('post.');
|
||||
if ($post) {
|
||||
$ifpost = 1;
|
||||
$datafields = http_build_query($post);
|
||||
}
|
||||
$url = 'http://www.pcjson.com' . $_SERVER['REQUEST_URI'];
|
||||
$str = Fcurl($url, $ifpost, $datafields);
|
||||
return json_decode($str, true);*/
|
||||
json(array(
|
||||
'status' => 1,
|
||||
'msg' => null
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user