Skip to content

Commit ef54081

Browse files
committed
添加了php用户验证
1 parent 4f87c54 commit ef54081

File tree

7 files changed

+2163
-0
lines changed

7 files changed

+2163
-0
lines changed

conf/conf.d/http3.conf

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# 添加了php的fast-cgi的集成配置
2+
3+
http {
4+
include mime.types;
5+
default_type application/octet-stream;
6+
7+
#通过ip设置访问权限
8+
#allow 192.168.0.0/24;
9+
#allow 127.0.0.1;
10+
#deny all;
11+
12+
sendfile on;
13+
keepalive_timeout 65;
14+
15+
#gzip on;
16+
17+
server {
18+
listen 80;
19+
server_name localhost;
20+
21+
location / {
22+
root html;
23+
index index.html index.htm;
24+
}
25+
26+
#error_page 404 /404.html;
27+
28+
# redirect server error pages to the static page /50x.html
29+
#
30+
error_page 500 502 503 504 /50x.html;
31+
location = /50x.html {
32+
root html;
33+
}
34+
35+
# rtmp stat
36+
location /stat {
37+
rtmp_stat all;
38+
rtmp_stat_stylesheet stat.xsl;
39+
}
40+
location /stat.xsl {
41+
root html;
42+
}
43+
# rtmp control
44+
location /control {
45+
rtmp_control all;
46+
}
47+
48+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
49+
#
50+
#location ~ \.php$ {
51+
# proxy_pass http://127.0.0.1;
52+
#}
53+
54+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
55+
#
56+
location ~ \.php$ {
57+
root html;
58+
fastcgi_pass 127.0.0.1:9000;
59+
fastcgi_index index.php;
60+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
61+
include fastcgi_params;
62+
}
63+
64+
# deny access to .htaccess files, if Apache's document root
65+
# concurs with nginx's one
66+
#
67+
#location ~ /\.ht {
68+
# deny all;
69+
#}
70+
71+
}
72+
73+
}

conf/conf.d/rtmp4.conf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#����������Լ���IPΪ��192.168.31.230���Է���IPΪ:192.168.31.232��
2+
3+
rtmp{
4+
server{
5+
listen 1935;
6+
chunk_size 8192;
7+
8+
application live1 {
9+
allow publish all;
10+
deny publish all;
11+
allow play all;
12+
deny play all;
13+
live on;
14+
meta copy;
15+
#pull rtmp://127.0.0.1/live/test;
16+
push rtmp://127.0.0.1/live2/test2;
17+
18+
on_publish http://localhost/auth.php;
19+
#on_play http://localhost/auth.php;
20+
notify_method get;
21+
}
22+
application live2 {
23+
allow publish 192.168.0.0/24;
24+
allow publish 127.0.0.1;
25+
deny publish all;
26+
27+
allow play 192.168.0.0/24;
28+
deny play all;
29+
live on;
30+
meta copy;
31+
}
32+
33+
}
34+
}

html/auth.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
// www.server.com/auth.php?user=luowei&pass=luoweipassword
3+
4+
//check if querystrings exist or not
5+
if (empty($_GET['user']) || empty($_GET['pass'])) {
6+
//no querystrings or wrong syntax
7+
//echo "wrong query input";
8+
header('HTTP/1.0 404 Not Found');
9+
exit(1);
10+
} else {
11+
//querystring exist
12+
$username = $_GET['user'];
13+
$password = $_GET['pass'];
14+
}
15+
16+
$saveduser = 'luowei';
17+
$savedpassword = 'luoweipassword';
18+
19+
//check pass and user string
20+
if (strcmp($password, $savedpassword) == 0 && strcmp($username, $saveduser) == 0) {
21+
echo "Password and Username OK! ";
22+
23+
} else {
24+
//echo "password or username wrong! ";
25+
header('HTTP/1.0 404 Not Found'); //kein stream
26+
}
27+
28+
?>

html/phpinfo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<html>
2+
3+
<body>
4+
5+
<?php
6+
echo '<h1>PHP Works !</h1><hr/>';
7+
phpinfo();
8+
?>
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)