-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsubmit.php
More file actions
180 lines (127 loc) · 4.93 KB
/
submit.php
File metadata and controls
180 lines (127 loc) · 4.93 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
/*
+ ----------------------------------------------------------------------------+
| PHPDirector.
| $License: GNU General Public License
| $Website: phpdirector.co.uk
+----------------------------------------------------------------------------+
*/
require('header.php');
$part = $_GET["part"]; //Gets which part it is on
if ($part == null){
$part = "1"; //If part isnt set goto part 1
}
if ($part == "1"){
//Display Images page
$smarty->display('submit.tpl');
//PART 2
}elseif ($part == "2"){
//Source
$videourl = $_POST['videourl'];
$smarty->assign('id', $videourl);
if ($videourl == null){
$smarty->assign('error', 'Please Do Not Submit Blank Links');
$smarty->display('error.tpl');
exit;
}
$check = explode(".", $videourl);
$source = $check[1];
$source2 = between('http://', '.', $videourl);
if ($source2 !== "http://video."){ //google
if ($source2 !== "http://www."){
$smarty->assign('error', 'Invalid Link, Try http://<b>www</b>...');
$smarty->display('error.tpl');
exit;
}
}
$extensionwhere = count($check) -1; // Gets which point the conent after the last . is eg .wmv
$extension = $check[$extensionwhere];// Returns eg wmv
if ($source == "youtube"){ //youtube
include("processes/process_youtube.inc.php");
}elseif ($source == "google"){ //google
include("processes/process_googlevideo.inc.php");
}elseif ($source == "dailymotion"){ //dailymotion
include("processes/process_dailymotion.inc.php");
}elseif ($extension == "wmv"){ //wmv
include("processes/wmv.inc.php");
}else{
$smarty->assign_by_ref('error', 'Invalid Source');
$smarty->display('error.tpl');
exit;
}
$smarty->assign('source', $source);
//Source End
//ALLREADY EXIST?
if ($videoid !== null){
$fileresult = mysql_query("SELECT file FROM pp_files WHERE file='$videoid' LIMIT 0 , 1")or die(mysql_error());
$rowfile = mysql_fetch_array($fileresult);
if ($rowfile['file'] == $videoid){
$smarty->assign('error', 'This Video Has Allready Been Submitted');
$smarty->display('error.tpl');
exit;
}
}
//Categories
$catresult = mysql_query("SELECT * FROM pp_categories WHERE disable='0'") or die("Error: " . mysql_error());
//Gets Categories
while ($catrow2 = mysql_fetch_array($catresult)){
$result11[] = $catrow2;
}
//pass the results to the template
$smarty->assign('cat', $result11);
//Display Images page
$smarty->display('submit2.tpl');
}elseif ($part == "3"){
$insertthumb = $_POST["picture"];
$inserttitle = $_POST["titletext"];
$insertauthor = $_POST["authortext"];
$insertdes = safe_sql_insert($_POST["descriptiontext"]);
$insetycat = $_POST["category"];
$videoid = $_POST["videoid"];
$source = $_POST["vidtype"];
$file2 = $_POST["file2"];
$fileresult = mysql_query("SELECT file FROM pp_files WHERE file='$videoid' LIMIT 0 , 1")or die(mysql_error());
$rowfile = mysql_fetch_array($fileresult);
if ($rowfile['file'] == $videoid){
$smarty->assign('error', 'This Video Has Allready Been Submitted');
$smarty->display('error.tpl');
exit;
}
//Generate Id//
function pdid(){
// define possible characters
$possible = "0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZabcdfghjkmnpqrstvwxyz";
// set up a counter
$i = 0;
// add random characters to $password until $length is reached
while ($i < rand(5,12)) {
// pick a random character from the possible ones
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
// we don't want this character if it's already in the pdid
if (!strstr($password, $char)) {
$pdid .= $char;
$i++;
}
}
$checkexists = mysql_query("SELECT `id` FROM `pp_files` WHERE `id` = '$pdid'");
if (mysql_num_rows($checkexists) !== 0){
$pdid = pdid();
}
return $pdid;
}
$pdid = pdid();
//genid end//
//TAGS//
$tag1 = $_POST["tagstext1"];
$tag2 = $_POST["tagstext2"];
$tag3 = $_POST["tagstext3"];
$tag4 = $_POST["tagstext4"];
$tag5 = $_POST["tagstext5"];
$sql = mysql_query("INSERT INTO `phpdirector`.`pp_tags` (`id`, `name`, `video_id`) VALUES (NULL, '".$_POST["tagstext1"]."', '".$pdid."'), (NULL, '".$_POST["tagstext2"]."', '".$pdid."'), (NULL, '".$_POST["tagstext3"]."', '".$pdid."'), (NULL, '".$_POST["tagstext4"]."', '".$pdid."'), (NULL, '".$_POST["tagstext5"]."', '".$pdid."');");
///TAGS_end//
mysql_query("INSERT INTO pp_files (id, name, video_type, creator, description, date, file, file2, approved, ip, picture, category) VALUES ('$pdid', '$inserttitle', '$source' , '$insertauthor', '$insertdes', CURDATE(), '$videoid', '$file2', '0', '$ip', '$insertthumb', '$insetycat')") or die(mysql_error());
$smarty->assign('error', 'Thanks for Submitting '.$inserttitle);
$smarty->display('error.tpl');
exit;
}
?>