├── .gitattributes
├── .gitignore
├── .htaccess
├── README.md
├── app
├── admin
│ ├── common.php
│ ├── ctrl
│ │ ├── index.php
│ │ ├── movie.php
│ │ ├── server.php
│ │ ├── setting.php
│ │ └── user.php
│ └── tpl
│ │ ├── index
│ │ └── index.html
│ │ ├── movie
│ │ ├── edit.html
│ │ └── index.html
│ │ ├── public
│ │ ├── footer.html
│ │ ├── header.html
│ │ └── left.html
│ │ ├── server
│ │ ├── edit.html
│ │ └── index.html
│ │ ├── setting
│ │ ├── notice.html
│ │ └── update.html
│ │ └── user
│ │ ├── feedback.html
│ │ └── index.html
├── cache
│ └── tpl
│ │ └── index.html
├── common.php
├── common
│ └── ctrl
│ │ └── auth.php
├── index
│ ├── common.php
│ ├── ctrl
│ │ ├── api.php
│ │ ├── index.php
│ │ └── login.php
│ └── tpl
│ │ ├── index
│ │ ├── error.html
│ │ └── index.html
│ │ └── login
│ │ ├── footer.html
│ │ ├── header.html
│ │ ├── login.html
│ │ └── register.html
└── user
│ ├── common.php
│ ├── ctrl
│ ├── api.php
│ ├── index.php
│ ├── money.php
│ └── movie.php
│ └── tpl
│ ├── index
│ ├── feedback.html
│ ├── index.html
│ ├── readme.html
│ └── serverlist.html
│ ├── money
│ ├── recharge.html
│ ├── statistics.html
│ └── vip.html
│ ├── movie
│ └── index.html
│ └── public
│ ├── footer.html
│ └── header.html
├── assets
├── css
│ ├── admin.css
│ ├── amazeui.datatables.min.css
│ ├── amazeui.min.css
│ ├── app.css
│ ├── app.less
│ ├── fullcalendar.min.css
│ ├── fullcalendar.print.css
│ └── honeySwitch.css
├── fonts
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.ttf
│ ├── fontawesome-webfont.woff
│ └── fontawesome-webfont.woff2
├── i
│ ├── app-icon72x72@2x.png
│ ├── examples
│ │ ├── admin-chrome.png
│ │ ├── admin-firefox.png
│ │ ├── admin-ie.png
│ │ ├── admin-opera.png
│ │ ├── admin-safari.png
│ │ ├── adminPage.png
│ │ ├── blogPage.png
│ │ ├── landing.png
│ │ ├── landingPage.png
│ │ ├── loginPage.png
│ │ └── sidebarPage.png
│ ├── favicon.png
│ └── startup-640x1096.png
├── img
│ ├── a5.png
│ ├── k.jpg
│ ├── logo.png
│ ├── logoa.png
│ ├── logob.png
│ ├── user01.png
│ ├── user02.png
│ ├── user03.png
│ ├── user04.png
│ ├── user05.png
│ ├── user06.png
│ └── user07.png
└── js
│ ├── amazeui.datatables.min.js
│ ├── amazeui.min.js
│ ├── app.js
│ ├── dataTables.responsive.min.js
│ ├── echarts.min.js
│ ├── fullcalendar.min.js
│ ├── honeySwitch.js
│ ├── jquery.min.js
│ ├── moment.js
│ └── theme.js
├── icf
├── config.php
├── functions.php
├── index.php
├── lib
│ ├── db.php
│ ├── http.php
│ ├── model.php
│ ├── route.php
│ ├── smtp.php
│ └── view.php
└── loader.php
├── index.html
├── index.php
├── openvpn-stushare
├── .gitignore
├── README.md
├── openvpn-stushare.sln
└── openvpn-stushare
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── FeedBackWindow.xaml
│ ├── FeedBackWindow.xaml.cs
│ ├── Functions.cs
│ ├── LoginWindow.xaml
│ ├── LoginWindow.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ ├── Settings.settings
│ └── app.manifest
│ ├── Resources
│ ├── Newtonsoft.Json.dll
│ ├── vpn.ico
│ ├── vpn_success.ico
│ └── vpn_wait.ico
│ ├── bin
│ └── Release
│ │ ├── Newtonsoft.Json.dll
│ │ ├── openvpn-stushare.exe
│ │ ├── openvpn-stushare.exe.config
│ │ └── openvpn-stushare.pdb
│ ├── openvpn-debug
│ ├── ca.crt
│ ├── openvpn.exe
│ └── user.ovpn
│ ├── openvpn-stushare.csproj
│ ├── openvpn-stushare.csproj.user
│ └── vpn2.ico
├── pay
├── __init__.py
├── function.py
├── wxpay.py
└── zfbpay.py
├── radius
├── ctrl.py
└── main.py
├── sql.sql
└── static
├── css
├── admin.css
├── index.css
└── login.css
├── email_template.html
├── image
├── avatar.jpg
├── bg.jpg
├── bg2.jpg
├── bg3.jpg
├── demo.png
├── down.png
├── email_bg.jpg
├── logo.png
├── logo_m.png
├── m_bg2.jpg
├── sk.jpg
├── sw.jpg
└── user.png
└── js
├── jquery-1.8.3.min.js
├── jquery-3.1.1.min.js
└── jquery.fullPage.min.js
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.js linguist-language=php
2 | *.css linguist-language=php
3 | *.html linguist-language=php
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /app/cache/tpl/*.php
2 | .idea
3 | cookie.txt
4 | var.html
5 | var1.html
6 | .vscode
7 | *.zip
8 | *.apk
9 | *.exe
10 |
--------------------------------------------------------------------------------
/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Options +FollowSymlinks
3 | RewriteEngine On
4 |
5 | RewriteCond %{REQUEST_FILENAME} !-d
6 | RewriteCond %{REQUEST_FILENAME} !-f
7 | RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # stuShare
2 | [校园网分享计划](https://github.com/CodFrm/stuShare)
3 |
4 |
5 | # 搭建openVPN+STURadius认证
6 |
7 | STURadius 为本项目定制radius(233)
8 |
9 | ## 配置openVPN
10 | ### 安装openVPN
11 | CentOS
12 |
13 | yum install openvpn
14 |
15 | ### 生成服务器证书
16 | ```
17 | wget https://github.com/OpenVPN/easy-rsa/archive/master.zip
18 |
19 | unzip master.zip
20 |
21 | mv easy-rsa-mater/ easy-rsa/
22 |
23 | cp -R easy-rsa/ /etc/openvpn/
24 |
25 | cd /etc/openvpn/easy-rsa/easyrsa3/
26 |
27 | cp vars.example vars
28 | ```
29 | `nano vars 修改下面字段,然后修改,最后wq保存`
30 | ```
31 | set_var EASYRSA_REQ_COUNTRY "CN"
32 |
33 | set_var EASYRSA_REQ_PROVINCE "BJ"
34 |
35 | set_var EASYRSA_REQ_CITY "BeiJing"
36 |
37 | set_var EASYRSA_REQ_ORG "stuShare"
38 |
39 | set_var EASYRSA_REQ_EMAIL "admin@icodef.com"
40 |
41 | set_var EASYRSA_REQ_OU "stuShare"
42 |
43 | cd /etc/openvpn/easy-rsa/easyrsa3/
44 |
45 | ./easyrsa build-ca
46 |
47 | ./easyrsa gen-req server nopass
48 |
49 | ./easyrsa sign server server
50 |
51 | ./easyrsa gen-dh
52 | ```
53 | `修改server.conf配置`
54 | ```
55 | cp /usr/share/doc/openvpn-2.3.14/sample/sample-config-files/server.conf /etc/openvpn
56 | ```
57 |
58 | ### 配置STURadius
59 | 认证程序在radius文件夹中
60 |
61 | main.py 修改mysql配置
62 | ```
63 | 配置openvpn的radius插件
64 | wget http://www.nongnu.org/radiusplugin/radiusplugin_v2.1a_beta1.tar.gz
65 |
66 | tar xf radiusplugin_v2.1a_beta1.tar.gz
67 |
68 | cd radiusplugin_v2.1a_beta1
69 |
70 | yum install libgcrypt-devel -y
71 |
72 | make
73 |
74 | cp radiusplugin.so /etc/openvpn/
75 |
76 | cp radiusplugin.cnf /etc/openvpn/
77 |
78 | ```
79 |
80 | `配置radius文件`
81 |
82 | `导入数据库文件`
83 |
84 | `开启nat转发和iptables配置`
85 |
86 | `firewall不知道配置,推荐关闭firewall开启iptables`
87 |
88 | ```
89 | iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j MASQUERADE
90 |
91 | iptables -Z
92 |
93 | iptables -F
94 |
95 | iptables -X
96 | ```
97 |
98 | ## 将本项目克隆至本地
99 |
100 | git clone https://github.com/CodFrm/stuShare.git
101 |
102 | 在 icf/config.php 中修改配置
103 |
104 | ### 微信支付监控
105 | python 启动 stuShare中的wspay.py文件,还需配置回调url
106 |
107 | 进行安装,然后就完成啦
108 |
--------------------------------------------------------------------------------
/app/admin/common.php:
--------------------------------------------------------------------------------
1 | assign('title', '首页');
19 | V()->display();
20 | }
21 |
22 | public function logout() {
23 | setcookie('token', '', 0, '/');
24 | header('Location: ' . url('index/login/login'));
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/app/admin/ctrl/movie.php:
--------------------------------------------------------------------------------
1 | assign('title', '影视管理');
20 | $rec = DB('video as a|user as b')->select(['a.uid=b.uid', 'father_vid' => -1,'__order by'=>'status,vid desc', '__limit' => (($page - 1) * $total) . ','.$total]);
21 | $movie_list = $rec->fetchAll();
22 | $count=DB('video')->find(['father_vid' => -1],'count(*)')['count(*)'];
23 | V()->assign('page',$page);
24 | V()->assign('pageAll',ceil($count/$total));
25 | V()->assign('movie_list', $movie_list);
26 | $online=DB('ip')->find(['ip_time'=>[time()-60,'>'],'type'=>1],'count(*)')['count(*)'];
27 | V()->assign('online', $online);
28 |
29 | $online=DB('ip')->find(['ip_time'=>[time()-60,'>'],'type'=>1],'count(*)')['count(*)'];
30 | V()->assign('online', $online);
31 | $up=DB('ip')->find(['ip_time'=>[strtotime(date('Y/m/d 00:00:00')),'>'],'ip_time<'.strtotime(date('Y/m/d 23:59:59')),'type'=>1],'count(*)')['count(*)'];
32 | V()->assign('up',$up);
33 | $yesterday=DB('ip')->find(['ip_time'=>[strtotime(date('Y/m/d 00:00:00'))-86400,'>'],'ip_time<'.(strtotime(date('Y/m/d 23:59:59'))-86400),'type'=>1],'count(*)')['count(*)'];
34 | V()->assign('yesterday',$yesterday);
35 | V()->display();
36 | }
37 | public function edit($vid = 0, $fvid = 0) {
38 | V()->assign('title', '影视管理');
39 | V()->assign('fvid', $fvid ?: $vid);
40 | $msg = [];
41 | if (!($msg = DB('video')->find(['vid' => $vid]))) {
42 | $msg['name'] = '';
43 | $msg['vid'] = '';
44 | $msg['pay'] = '';
45 | $msg['introduction'] = '';
46 | $msg['url'] = '';
47 | $msg['image_url'] = '';
48 | $msg['release_time'] = '';
49 | $msg['type'] = '';
50 | $msg['mark'] = '';
51 | $msg['status'] = 0;
52 | if ($fvid > 0) {
53 | $msg['father_vid'] = $fvid;
54 | } else {
55 | $msg['father_vid'] = -1;
56 | }
57 |
58 | }
59 | $msg['child'] = [];
60 | if ($rec = DB('video')->select(['father_vid' => $vid])) {
61 | $msg['child'] = $rec->fetchAll();
62 | }
63 | V()->assign('video', $msg);
64 | V()->display();
65 | }
66 |
67 | public function post($vid = 0, $fvid = 0) {
68 | $retJson = ['code' => -1, 'msg' => '错误,vid不存在'];
69 | if ($fvid > 0 and $vid>0) {//更新子集
70 | $ret = isExist($_POST, [
71 | 'name' => ['msg' => '请输入影视名字', 'sql' => 'name'],
72 | 'url'=> ['msg' => '请输入下载链接', 'sql' => 'url'],
73 | 'status'=> ['msg' => '请输入集数', 'sql' => 'status']], $sql);
74 | $sql['pay']=input('post.pay');
75 | if ($ret === true) {
76 | $retJson = ['code' => 1, 'msg' => '成功'];
77 | DB('video')->update($sql,['vid'=>$vid]);
78 | } else {
79 | $retJson['msg'] = $ret;
80 | }
81 | } else if ($vid > 0) {//更新集
82 | $ret = isExist($_POST, [
83 | 'name' => ['msg' => '请输入影视名字', 'sql' => 'name'],
84 | 'image_url'=> ['msg' => '请输入图片链接', 'sql' => 'image_url']], $sql);
85 | $sql['type']=input('post.type');
86 | $sql['pay']=input('post.pay');
87 | $sql['mark']=input('post.mark');
88 | $sql['status']= input('post.status')=='true'?:0;
89 | $sql['introduction']=input('post.introduction');
90 | $sql['release_time']=input('post.release_time');
91 | $sql['url']=input('post.url');
92 | if ($ret === true) {
93 | $retJson = ['code' => 1, 'msg' => '成功'];
94 | DB('video')->update($sql,['vid'=>$vid]);
95 | } else {
96 | $retJson['msg'] = $ret;
97 | }
98 | }else if($fvid>0){//添加子集
99 | $ret = isExist($_POST, [
100 | 'name' => ['msg' => '请输入影视名字', 'sql' => 'name'],
101 | 'url'=> ['msg' => '请输入下载链接', 'sql' => 'url'],
102 | 'status'=> ['msg' => '请输入集数', 'sql' => 'status']], $sql);
103 | $sql['pay']=input('post.pay');
104 | $sql['father_vid']=$fvid;
105 | if ($ret === true) {
106 | $retJson = ['code' => 1, 'msg' => '成功'];
107 | DB('video')->insert($sql);
108 | } else {
109 | $retJson['msg'] = $ret;
110 | }
111 | } else {//添加集
112 | $ret = isExist($_POST, [
113 | 'name' => ['msg' => '请输入影视名字', 'sql' => 'name'],
114 | 'image_url'=> ['msg' => '请输入图片链接', 'sql' => 'image_url']], $sql);
115 | $sql['type']=input('post.type');
116 | $sql['pay']=input('post.pay');
117 | $sql['mark']=input('post.mark');
118 | $sql['status']= input('post.status')=='true'?:0;
119 | $sql['introduction']=input('post.introduction');
120 | $sql['release_time']=input('post.release_time');
121 | $sql['uid']=$_COOKIE['uid'];
122 | if ($ret === true) {
123 | $retJson = ['code' => 1, 'msg' => '成功'];
124 | DB('video')->insert($sql);
125 | } else {
126 | $retJson['msg'] = $ret;
127 | }
128 | }
129 | return json($retJson);
130 | }
131 |
132 | public function delete($vid){
133 | DB('video')->delete(['vid'=>$vid]);
134 | $retJson = ['code' => 0, 'msg' => '删除成功'];
135 | header('Location: '.$_SERVER['HTTP_REFERER']?:url('admin/movie/index'));
136 | return json($retJson);
137 | }
138 | }
--------------------------------------------------------------------------------
/app/admin/ctrl/server.php:
--------------------------------------------------------------------------------
1 | assign('title','服务器管理');
19 | $data = DB('server')->select()->fetchAll();
20 | V()->assign('server_list', $data);
21 | V()->display();
22 | }
23 |
24 | public function edit($svid = 0) {
25 | $data = ['name'=>'','ip'=>'','config'=>'','svid'=>0];
26 | if ($svid > 0) {
27 | $data = DB('server')->find(['svid' => $svid]);
28 | }
29 | V()->assign('smsg', $data);
30 | V()->display();
31 | }
32 |
33 | public function post($svid = 0) {
34 | $retJson = ['code' => -1, 'msg' => '错误,svid不存在'];
35 | $ret = isExist($_POST, [
36 | 'name' => ['msg' => '请输入主机名', 'sql' => 'name'],
37 | 'config' => ['msg' => '请输入配置文件', 'sql' => 'config'],
38 | 'ip' => ['msg' => '请输入服务器ip', 'sql' => 'ip']], $sql);
39 | if ($ret === true) {
40 | if ($svid > 0) {
41 | DB('server')->update($sql, ['svid' => $svid]);
42 | $ret = '修改成功';
43 |
44 | } else {
45 | DB('server')->insert($sql, ['svid' => $svid]);
46 | $ret = '增加成功';
47 | }
48 | $retJson['code'] = 1;
49 | }
50 | $retJson['msg'] = $ret;
51 | return json($retJson);
52 | }
53 |
54 | public function delete($svid) {
55 | DB('server')->delete(['svid' => $svid]);
56 | $retJson = ['code' => 0, 'msg' => '删除成功'];
57 | header('Location: ' . $_SERVER['HTTP_REFERER'] ?: url('admin/server/index'));
58 | return json($retJson);
59 | }
60 | }
--------------------------------------------------------------------------------
/app/admin/ctrl/setting.php:
--------------------------------------------------------------------------------
1 | assign('title', '更新设置');
19 | $setting['pc_update_v'] = config('pc_update_v');
20 | $setting['pc_update_u'] = config('pc_update_u');
21 | $setting['movie_update_v'] = config('movie_update_v');
22 | $setting['movie_update_u'] = config('movie_update_u');
23 | V()->assign('setting', $setting);
24 | V()->display();
25 | }
26 |
27 | public function u_setting() {
28 | if (input('post.pc_update_u')) {
29 | config('pc_update_u', input('post.pc_update_u'));
30 | }
31 | if (input('post.pc_update_v')) {
32 | config('pc_update_v', input('post.pc_update_v'));
33 | }
34 | if (input('post.movie_update_u')) {
35 | config('movie_update_u', input('post.movie_update_u'));
36 | }
37 | if (input('post.movie_update_v')) {
38 | config('movie_update_v', input('post.movie_update_v'));
39 | }
40 | return json(['code' => 1, 'msg' => '修改成功']);
41 | }
42 |
43 | public function notice() {
44 | V()->assign('title', '通知设置');
45 | $setting['pc_notice_msg'] = config('pc_notice_msg');
46 | $setting['pc_notice_time'] = date('Y/m/d H:i:s', config('pc_notice_time'));
47 | $setting['movie_notice_msg'] = config('movie_notice_msg');
48 | $setting['movie_notice_time'] = date('Y/m/d H:i:s', config('movie_notice_time'));
49 | V()->assign('setting', $setting);
50 | V()->display();
51 | }
52 |
53 | public function notice_setting() {
54 | if (input('post.pc_notice_msg')) {
55 | config('pc_notice_msg', input('post.pc_notice_msg'));
56 | config('pc_notice_time', time());
57 | }
58 | if (input('post.movie_notice_msg')) {
59 | config('movie_notice_msg', input('post.movie_notice_msg'));
60 | config('movie_notice_time', time());
61 | }
62 | return json(['code' => 1, 'msg' => '修改成功']);
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/app/admin/ctrl/user.php:
--------------------------------------------------------------------------------
1 | assign('title', '影视管理');
20 | $rec = DB('user as a')->select(['__order by'=>'uid desc', '__limit' => (($page - 1) * $total) . ','.$total]);
21 | $user_list = $rec->fetchAll();
22 | $count=DB('user')->find([],'count(*)')['count(*)'];
23 | V()->assign('page',$page);
24 | V()->assign('pageAll',ceil($count/$total));
25 | V()->assign('user_list', $user_list);
26 | V()->display();
27 | }
28 |
29 | public function edit($uid){
30 |
31 | }
32 | public function delete($uid){
33 | DB('user')->delete(['uid'=>$uid]);
34 | $retJson = ['code' => 0, 'msg' => '删除成功'];
35 | header('Location: '.$_SERVER['HTTP_REFERER']?:url('admin/user/index'));
36 | return json($retJson);
37 | }
38 |
39 | public function feedback($page=1){
40 | $total=50;
41 | V()->assign('title', '用户反馈');
42 | $rec = DB('feedback as a')->select(['__order by'=>'time desc', '__limit' => (($page - 1) * $total) . ','.$total],'*',
43 | 'join :user as b on a.uid=b.uid');
44 | $feed_list = $rec->fetchAll();
45 | $count=DB('user')->find([],'count(*)')['count(*)'];
46 | V()->assign('page',$page);
47 | V()->assign('pageAll',ceil($count/$total));
48 | V()->assign('feed_list', $feed_list);
49 | V()->display();
50 | }
51 | public function look($uid=0,$time=0){
52 | DB('feedback')->update(['`type`=-`type`'],['uid'=>$uid,'time'=>$time]);
53 | header('Location: '.$_SERVER['HTTP_REFERER']?:url('admin/movie/index'));
54 | }
55 | }
--------------------------------------------------------------------------------
/app/admin/tpl/index/index.html:
--------------------------------------------------------------------------------
1 | {include 'public/header'}
2 |
3 |
4 |
5 |
6 |
7 | {include 'public/footer'}
--------------------------------------------------------------------------------
/app/admin/tpl/movie/index.html:
--------------------------------------------------------------------------------
1 | {include 'public/header'}
2 |
3 |
4 |
109 | {include 'public/footer'}
--------------------------------------------------------------------------------
/app/admin/tpl/public/footer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |