-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditstream_request.php
More file actions
151 lines (126 loc) · 6.37 KB
/
editstream_request.php
File metadata and controls
151 lines (126 loc) · 6.37 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
function deleteAll($directory, $empty = false) {
if(substr($directory,-1) == "/") {
$directory = substr($directory,0,-1);
}
if(!file_exists($directory) || !is_dir($directory)) {
return false;
} elseif(!is_readable($directory)) {
return false;
} else {
$directoryHandle = opendir($directory);
while ($contents = readdir($directoryHandle)) {
if($contents != '.' && $contents != '..') {
$path = $directory . "/" . $contents;
if(is_dir($path)) {
deleteAll($path);
} else {
unlink($path);
}
}
}
closedir($directoryHandle);
if($empty == false) {
if(!rmdir($directory)) {
return false;
}
}
return true;
}
}
function folder_exist($folder)
{
// Get canonicalized absolute pathname
$path = realpath($folder);
// If it exist, check if it's a directory
if($path !== false AND is_dir($path))
{
// Return canonicalized absolute pathname
die("Folder already exists! <a href='editstream.php'>Edit again with different name.</a>");
}
// Path/folder does not exist
return $path;
}
session_start();
$StreamIdentity = $_SESSION['StreamName'];
$StreamKey = $_SESSION['StreamKey'];
$StreamGame = $_SESSION['StreamGame'];
$_SESSION['Password_PlainText'] = mysql_escape_string(stripslashes($_POST['strmpass']));
$StreamID = mysql_escape_string(stripslashes($_POST['strmname']));
$StreamGM = mysql_escape_string(stripslashes($_POST['strmgame']));
$StreamPSW = mysql_escape_string(stripslashes(hash('sha512', $_POST['strmpass'])));
$StreamPURL = mysql_escape_string(stripslashes($_POST['strmpurl']));
$StreamURL = mysql_escape_string(stripslashes($_POST['strmurl']));
$StreamDESC = mysql_escape_string(stripslashes($_POST['strmdesc']));
$StreamChange = mysql_escape_string(stripslashes($_POST['strmchange']));
if (strpos($StreamID, '<?php') !== false || strpos($StreamID, '?>') !== false || strpos($StreamGM, '<?php') !== false || strpos($StreamGM, '?>') !== false || strpos($StreamPSW, '<?php') !== false || strpos($StreamPSW, '?>') !== false || strpos($StreamPURL, '<?php') !== false || strpos($StreamPURL, '?>') !== false ||strpos($StreamURL, '<?php') !== false || strpos($StreamURL, '?>') !== false || strpos($StreamDESC, '<?php') !== false || strpos($StreamDESC, '?>') !== false) {
die("Do not use PHP under your username/game/password/description/url as it will cause a break into the system! This message is to prevent you from exploiting the system with php. <a href='editstream.php'>Return back editing.</a>");
}
$c = mysql_connect("localhost", "user", "password");
$checkban = "SELECT * FROM `wolfstream`.`accounts` WHERE `stream_name` = '$StreamIdentity'";
$banforce = mysql_query($checkban, $c);
if($row = mysql_fetch_array($banforce)) {
$banned = (int) "{$row['banned']}";
$banreason = "{$row['banreason']}";
$isLOCKED = (int) "{$row['isLocked']}";
if($banned == 1) {
session_unset();
session_destroy();
die("Your account was suspended for $banreason. If your account was banned wrongly then please <a href='mailto:gamewolf10@gmail.com'>contact me</a> to make a ban appeal.");
}
if($banreason == "stream_e.stream_key_taken_away") {
die("Your stream key was taken away. If your account stream key was taken wrongly then please <a href='mailto:gamewolf10@gmail.com'>contact me</a> to make a stream key appeal. State your reasons why you want your stream key back.");
}
}
if($StreamID == "") {
if($StreamChange == "yes") {
$RandomKeyChange = hash('sha512', rand(1,9999999));
$editchange = "UPDATE `wolfstream`.`accounts` SET `stream_key` = '$RandomKeyChange' WHERE `stream_name` = '$StreamID'";
$e = mysql_query($editchange, $c);
deleteAll('E:\RTMP_SERVER\www\/'.$StreamID.'\/'.$StreamKey);//Change this directory to your RTMP www server.
if($isLOCKED == 0) {
mkdir('E:\RTMP_SERVER\www\/'.$StreamID.'\/'.$RandomKeyChange);//Change this directory to your RTMP www server.
}
$_SESSION['StreamKey'] = $RandomKeyChange;
mysql_close($c);
header("Location: editstream.php");
}
else
{
$editchange = "UPDATE `wolfstream`.`accounts` SET `stream_game` = '$StreamGM', `stream_pass` = '$StreamPSW', `background_pg` = '$StreamURL', `profile_picture` = '$StreamPURL', `description` = '$StreamDESC' WHERE `stream_name` = '$StreamIdentity'";
$e = mysql_query($editchange, $c);
}
$_SESSION['StreamKey'] = $StreamKey;
$_SESSION['StreamGame'] = $StreamGM;
mysql_close($c);
header("Location: editstream.php");
}else{
if($StreamChange == "yes") {
$RandomKeyChange = hash('sha512', rand(1,9999999));
$editchange = "UPDATE `wolfstream`.`accounts` SET `stream_key` = '$RandomKeyChange' WHERE `stream_name` = '$StreamID'";
$e = mysql_query($editchange, $c);
deleteAll('E:\RTMP_SERVER\www\/'.$StreamID.'\/'.$StreamKey);//Change this directory to your RTMP www server.
if($isLOCKED == 0) {
mkdir('E:\RTMP_SERVER\www\/'.$StreamID.'\/'.$RandomKeyChange);//Change this directory to your RTMP www server.
}
mkdir('E:\RTMP_SERVER\www\/'.$StreamID.'\/'.$RandomKeyChange);//Change this directory to your RTMP www server.
$_SESSION['StreamKey'] = $RandomKeyChange;
mysql_close($c);
header("Location: editstream.php");
}
else
{
$editchange = "UPDATE `wolfstream`.`accounts` SET `stream_name` = '$StreamID', `stream_game` = '$StreamGM', `stream_pass` = '$StreamPSW', `background_pg` = '$StreamURL', `profile_picture` = '$StreamPURL', `description` = '$StreamDESC' WHERE `stream_name` = '$StreamIdentity'";
$e = mysql_query($editchange, $c);
}
folder_exist('E:\RTMP_SERVER\www\/'.$StreamID);//Change this directory to your RTMP www server.
deleteAll('E:\RTMP_SERVER\www\/'.$StreamIdentity);//Change this directory to your RTMP www server.
mkdir('E:\RTMP_SERVER\www\/'.$StreamID);//Change this directory to your RTMP www server.
mkdir('E:\RTMP_SERVER\www\/'.$StreamID.'\/'.$StreamKey);//Change this directory to your RTMP www server.
$_SESSION['StreamName'] = $StreamID;
$_SESSION['StreamKey'] = $StreamKey;
$_SESSION['StreamGame'] = $StreamGM;
mysql_close($c);
header("Location: editstream.php");
}
?>