· 8 years ago · Jun 09, 2018, 07:56 AM
1<?
2
3class DB {
4
5 function connect ()
6 {
7
8 $dbuser = "rypedesigns";
9 $dbpass = "password";
10 $dbname = "rypedesigns";
11 $dbhost = "db.rypedesigns.com";
12
13 $this->id = mysql_connect($dbhost, $dbuser, $dbpass) or die("<br />Failed onConnect(DB); printing report..<br />" . mysql_error());
14 mysql_select_db($dbname, $this->id) or die ("<br />Failed onSelect('{$dbname}'); printing report..<br />" . mysql_error());
15 return $this->id;
16
17 }
18
19 function query ($query_inp)
20 {
21
22 global $DB;
23
24 if ( $this->qcount == 0 || $this->qcount == false ){
25
26 $this->qcount = 1;
27
28 }else{
29
30 ++$this->qcount;
31
32 }
33
34 $result = @mysql_query($query_inp, $this->id);
35
36 if ( $result !== false && $result !== NULL ){
37
38 $this->error = NULL;
39 $this->last_query = $query_inp;
40 return $this->result = $result;
41
42 }else{
43
44 $this->error = mysql_error();
45 $this->last_query = $query_inp;
46 return $this->result = false;
47
48 }
49
50 }
51
52 function result_field ($field)
53 {
54 global $field_row;
55
56 if ( is_null($field_row) || !is_numeric($field_row) )
57 { $field_row = 0; }
58
59 if ( $result_field = mysql_result($this->result, $field_row, $field) )
60 { unset($field_row); return $result_field; }
61
62 else{ unset($field_row); return "Error processing query on {$field}."; }
63
64 }
65
66 function free_result ()
67 {
68 if (is_resource($this->result))
69 { mysql_free_result($this->result); }
70 return $this->result;
71 }
72
73 function fetch($input)
74 {
75 $this->fetch_result = mysql_fetch_array($input, MYSQL_ASSOC);
76 return $this;
77 }
78
79 function runit ($iquery)
80 {
81
82 $i=0;
83 global $DB, $ikey;
84 if(!isset($ikey)) {$ikey = $i;}
85 unset($output);
86 $output = new stdClass();
87
88 while ($array = mysql_fetch_array($iquery, MYSQL_ASSOC))
89 {
90 $keys = $array["{$ikey}"];
91 $result["$keys"] = $array;
92 $i++;
93 }
94
95 foreach($result as $key => $val)
96 {
97 $output->$key;
98 foreach($val as $key1 => $val1)
99 { $output->$key->$key1 = $val1; }
100
101 }
102
103 unset($ikey);
104 return $output;
105
106 }
107
108 }
109
110////////////////////////////////////////////////////////////////////////
111
112class user
113 {
114
115
116 function redirect($url)
117 {
118 global $DB, $user, $modules;
119
120 // Ensure &s are taken care of
121 $url = str_replace( "&", "&", $url );
122
123 if ($ibforums->vars['header_redirect'] == 'refresh')
124 {
125 @header("Refresh: 0;url=".$url);
126 }
127 elseif ($ibforums->vars['header_redirect'] == 'html')
128 {
129 @flush();
130 echo("<html><head><meta http-equiv='refresh' content='0; url=$url'></head><body></body></html>");
131 exit();
132 }
133 else
134 {
135 @header("Location: ".$url);
136 }
137
138 $modules->footer();
139
140 }
141
142
143 function login()
144 {
145
146 global $DB, $user, $login_name, $login_pass, $login, $modules, $_COOKIE, $_GET, $_POST;
147
148 //if(!isset($login['name']) || !isset($login['pass'])) return;
149
150 $running_time = time();
151 $browser = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;";
152 $session_id = md5( uniqid(microtime()) );
153 $query = "SELECT * FROM `ibf_members` WHERE `name` = '" . $login_name . "' AND `password` = '" . $login_pass . "'";
154
155 $DB->query($query);
156
157 while($usermatch = mysql_fetch_array($DB->result, MYSQL_ASSOC)):
158
159 $this->id = $usermatch['id'];
160 $this->name = $usermatch['name'];
161 $this->mgroup = $usermatch['mgroup'];
162 $this->password = $usermatch['password'];
163 $this->ip = $_SERVER['REMOTE_ADDR'];
164 $this->anon = -1;
165 if(!is_null($usermatch['id']) || is_numeric($usermatch['id']))
166 {
167 setcookie("member_id", $usermatch['id'], time()+60*60*24*14, "/", "killerthps.com", 0);
168 setcookie("pass_hash", $login_pass, time()+60*60*24*14, "/", "killerthps.com", 0);
169 setcookie("session_id", $sesson_id, time()+60*60*24*14, "/", "killerthps.com", 0);
170 }
171 $endwhile = true;
172
173 endwhile;
174
175 $DB->free_result();
176
177 if($endwhile == true)
178 {
179
180 $DB->query("SELECT `ip_address` FROM `ibf_sessions` WHERE `ip_address` = '" . $_SERVER['REMOTE_ADDR'] . "'");
181
182 if($DB->result)
183 {
184
185 $DB->query("DELETE FROM `ibf_sessions` WHERE `ip_address` = '" . $_SERVER['REMOTE_ADDR'] . "'");
186
187 }
188
189 $DB->query("INSERT INTO `ibf_sessions`
190 (`id`, `member_name`, `member_id`, `ip_address`, `browser`, `running_time`, `login_type`, `location`, `member_group`, `in_forum`, `in_topic`)
191 VALUES ('" . $sesson_id . "', '" . $this->name . "', '" . $this->id . "', '" . $this->ip . "', '" . $browser . "', '" . $running_time . "', '0', 'idx', '" . $this->mgroup . "', '0', '0')");
192
193 }
194
195 if(!$this->name)
196 {
197
198 $this->id = "-1";
199 $this->name = "Anonymous";
200 $this->anon = "1";
201 $this->mgroup = "2";
202
203 $this->message = "<b style=\"font-weight: normal; color: #AAAAAA\">( Forum CP | </b><a href=\"/forums/\">Forum Index</a> ( <a href=\"http://killerthps.com/forums/?act=Reg&CODE=00\">Register</a> | <a href=\"http://killerthps.com/forums/?act=Reg&CODE=00\">Anonymous</a> | <a href=\"http://killerthps.com/forums/?act=Login&CODE=00\">Login</a> ) <a href=\"{$PHP_SELF}\">RePlayer Index</a><b style=\"font-weight: normal; color: #AAAAAA\"> | Replay CP )</b>";
204
205 }
206
207 $get = $_SERVER['QUERY_STRING'];
208
209 if(strpos($get, "Login") || strpos($get, "login"))
210 $get = "";
211
212 $redir = $PHP_SELF . "?" . $get;
213
214 if ($this->anon == -1)
215 $msg = "Successfully logged in as " . $this->name . " <a href=\"{$redir}\">Redirecting</a> ..";
216 else
217 $msg = "Login information didn't match any records; failed login.";
218
219
220 header("Refresh: 2;url={$redir}");
221
222 $modules->header();
223 $modules->message($msg);
224 $modules->footer();
225
226 return $this;
227
228
229
230 }
231
232/////////////////////////////////////////
233// USER INFO .. //
234/////////////////////////////////////////
235
236 function check()
237 {
238
239 global $DB, $modules, $_COOKIE;
240
241 if(isset($_COOKIE['pass_hash']) && $_COOKIE['member_id'] >= 1 && !isset($this->name))
242 {
243
244 $DB->query("SELECT `id`,`name`,`mgroup`,`password` FROM `ibf_members` WHERE `id` = '{$_COOKIE['member_id']}' AND `password` = '{$_COOKIE['pass_hash']}'");
245
246 while($row = mysql_fetch_array($DB->result, MYSQL_ASSOC))
247 {
248
249 if($row['name']!=="Guest" && strlen($row['name'])>=2 && $_COOKIE['member_id']==$row['id'])
250 {
251
252 if ( $row['mgroup'] =="4" )
253 { $adlink = "<a href=\"/admin/admin.php\">Admin CP</a> |"; }
254
255 $this->id = $row['id'];
256 $this->name = $row['name'];
257 $this->mgroup = $row['mgroup'];
258 $this->password = $row['password'];
259 $this->message = "<a href='/forums/index.php?showuser=" . $this->id . "'>" . $this->name . "</a></strong> [ <a href='/forums/index.php?act=Login&CODE=03'>Log Out</a> · <b><a href='/forums/admin.php' target='_blank'>Admin CP</a></b> · <b><a href='/forums/index.php?act=modcp&forum='>Mod CP</a></b> ]<br>
260 <b><a href='/forums/index.php?act=UserCP&CODE=00' title='Edit my settings, such as signature, avatar and more...'>My Controls</a></b> · <a href='/forums/index.php?act=Msg&CODE=01'>0 New Messages</a>
261 · <a href='/forums/index.php?act=Search&CODE=getnew'>View New Posts</a> · <a href='javascript:buddy_pop();' title='View posts since your last visit, moderator lists and more...'>My Assistant</a></td>";
262 // $this->message = "<a href=\"/forums/index.php?act=UserCP&CODE=00\">Forum CP</a> | <a href=\"/forums/\">Forum Index</a> <b id=\"11px\">( {$adlink} <a href=\"/forums/?showuser=".$this->id."\">".$row['name']."</a> | <a href=\"/forums/?act=Login&CODE=03\">Logout</a> )</b> <a href=\"/replays/\">RePlayer Index</a> | <a href=\"{$PHP_SELF}?act=ReplayCP\">Replay CP</a>";
263
264 }
265
266 }
267
268 }
269
270 else
271 {
272
273 $this->id = "-1";
274 $this->name = "Anonymous";
275 $this->anon = "1";
276 $this->mgroup = "2";
277 $this->message = "[ <a href='/forums/index.php?act=Login&CODE=00'>Log In</a> | <a href='/forums/index.php?act=Reg&CODE=00'>Register</a> ]<br>
278<a href='/forums/index.php?act=Reg&CODE=reval'>Resend Validation Email</a>";
279 // $this->message = "<b style=\"font-weight: normal; color: #AAAAAA\">( Forum CP | </b><a href=\"/forums/\">Forum Index</a> ( <a href=\"http://killerthps.com/forums/?act=Reg&CODE=00\">Register</a> | <a href=\"http://killerthps.com/forums/?act=Reg&CODE=00\">Anonymous</a> | <a href=\"http://killerthps.com/forums/?act=Login&CODE=00\">Login</a> ) <a href=\"{$PHP_SELF}\">RePlayer Index</a><b style=\"font-weight: normal; color: #AAAAAA\"> | Replay CP )</b>";
280
281 }
282 if($_SESSION):
283 $_SESSION['id'] = $this->id;
284 $_SESSION['name'] = $this->name;
285 $_SESSION['mgroup'] = $this->mgroup;
286 $_SESSION['message'] = $this->message;
287 endif;
288
289
290 }
291
292 function get_location()
293 {
294
295 if(strlen($_GET['act'])>=3)
296 { $current_module = " | <a href=\"" . $PHP_SELF . "?act=" . $_GET['act'] . "\">{$_GET['act']}</a>"; }
297 else { $current_module = NULL; }
298 $this->location = "« <a href=\"\">tRI</a>{$current_module} »";
299
300 }
301
302 }
303
304
305
306////////////////////////////////////////////////////////////////////////
307
308
309class modules
310 {
311
312/////////////////////////////////////////
313// HEADER .. //
314/////////////////////////////////////////
315
316 function header ()
317 {
318
319 global $DB, $user, $root;
320
321 require("/home/rypedesigns/rypedesigns.com/killerthps/includes/hdr.php");
322
323 /*
324 $nav_ph = "<!--NAVIGATION-->";
325 $links_ph = "<!--CAPSULE_BAR-->";
326 $DB->query("SELECT `value` FROM `killerthps_com` WHERE `resource` = 'header_bloo'");
327 $hdr1 = preg_replace("~\<!--NAVIGATION--\>~i", "{$user->location}", mysql_result($DB->result, 0));
328 $hdr2 = preg_replace("~\<!--USERLINKS--\>~i", "{$user->message}", $hdr1);
329 unset($hdr1);
330 return mysql_result($DB->result, 0);
331 */
332
333 }
334
335
336/////////////////////////////////////////
337// LOGIN .. //
338/////////////////////////////////////////
339
340 function Login ()
341 {
342
343 global $DB, $user, $_GET, $root;
344
345 if($_GET['act']=="Login")
346 require($root . "sources/login.php");
347
348 $this->footer();
349
350 }
351
352
353/////////////////////////////////////////
354// LOGOUT //
355/////////////////////////////////////////
356
357 function Logout ()
358 {
359
360 global $DB, $modules, $user;
361
362 setcookie("member_id", -1, time()-1000, "/", "killerthps.com", 0);
363 setcookie("pass_hash", "", time()-1000, "/", "killerthps.com", 0);
364 setcookie("session_id", "", time()-1000, "/", "killerthps.com", 0);
365
366 $DB->query("SELECT * FROM `ibf_sessions` WHERE `ip_address` = '" . $_SERVER['REMOTE_ADDR'] . "'");
367
368 $select = $DB->result;
369
370 if( $DB->result == true )
371 {
372
373 $DB->query("DELETE FROM `ibf_sessions` WHERE `ip_address` = '" . $_SERVER['REMOTE_ADDR'] . "'");
374 $delete = $DB->result;
375
376 }
377
378 echo $modules->header();
379 var_dump($select);
380 var_dump($delete);
381
382
383 }
384
385
386/////////////////////////////////////////
387// RESTRICTED //
388/////////////////////////////////////////
389
390 function restricted ()
391 {
392
393 global $DB, $user, $_GET, $_POST, $root;
394
395 if($user->mgroup<=2 || $user->anon==1):
396
397 require($root . "sources/login.php");
398 echo "<div align=\"center\" style=\"padding-top: 35px; padding-bottom: 35px\"><b>You have to login to access this module.</b></div>";
399 $this->footer();
400
401 endif;
402
403 }
404
405/////////////////////////////////////////
406// ERROR MSG //
407/////////////////////////////////////////
408
409 function error ($msg)
410 {
411
412 echo "<div class=\"tileFoot\" width=\"100%\" align=\"center\" style=\"line-height: 22px; vertical-align: middle\"><font color=\"white\"><b>Error!</b></font></div><div align=\"center\" style=\"padding-top: 35px; padding-bottom: 35px\"><b>$msg</b></div>";
413
414
415 }
416
417
418/////////////////////////////////////////
419// MESSAGE //
420/////////////////////////////////////////
421
422 function message ($msg)
423 {
424
425 echo "<div align=\"center\" style=\"padding-top: 35px; padding-bottom: 35px\"><b>$msg</b></div>";
426
427 }
428
429
430/////////////////////////////////////////
431// UPLOAD HANDLER //
432/////////////////////////////////////////
433
434
435 function upload()
436 {
437
438 global $DB, $user, $root;
439
440 echo("<table width=\"100%\" align=\"center\" style=\"background-color: #272727; width: 100%; padding: 0; margin: 0\" cellspacing=\"1\" cellpadding=\"3\">");
441
442
443 echo "<tr><td class=\"row3\">";
444
445
446 if ( $_FILES["file"] || $_FILES["size"] >= 1 && $user->id >= 1 ){
447
448 $this->file_upload();
449
450 }elseif( $user->id >= 1 ){
451
452 echo $this->form();
453
454 // Check if user's folder exists. If it
455 // doesn't create in preparation for upload..
456 if ( !is_dir($root . "replays/users/" . $user->name . "/") ){
457
458 if ( mkdir($root . "replays/users/" . $user->name . "/", 0777) ){
459
460 echo "/replays/users/" . $user->name . "/ created.<br>";
461
462 }else{
463
464 echo "Folder creation failed. Please report this error to killerthps.";
465
466 }
467
468 }
469
470 }else{
471
472 echo $this->error("You must be signed in to upload.");
473
474 }
475
476
477 if ( !is_dir($root . "replays/users/" . $user->name . "/") ){
478
479 if ( mkdir($root . "replays/users/" . $user->name . "/", 0777) ){
480
481 echo "/replays/users/" . $user->name . "/ created.<br>";
482
483 }else{
484
485 echo "Folder creation failed. Please report this error to killerthps.";
486
487 }
488
489 }
490
491 echo "</td></tr></table>";
492
493 }
494
495
496/////////////////////////////////////////
497// UPLOAD FILE.. //
498/////////////////////////////////////////
499
500 function file_upload()
501 {
502
503 global $user, $DB, $root;
504
505 if ( !$_FILES["file"]["name"] || $_FILES["file"]["size"] < 1 || !$_FILES["file"]["size"] ){
506
507 echo $this->error("You haven't selected a valid file.");
508 return false;
509
510 }elseif( $user->id <= 0 ){
511
512 echo $this->error("You must be signed in to upload.");
513 return false;
514
515 }
516
517 if ( !is_dir($root . "replays/users/" . $user->name . "/") ){
518
519 if ( mkdir($root . "replays/users/" . $user->name . "/", 0777) ){
520
521 echo "/replays/users/" . $user->name . "/ created.<br>";
522
523 }else{
524
525 echo "Folder creation failed. Please report this error to killerthps.";
526
527 }
528
529 }
530
531 $target_path = $root . "replays/users/" . $user->name . "/" . basename($_FILES['file']['name']);
532 $target_url = "fuctuploads.com/replays/users/" . $user->name . "/" . basename($_FILES['file']['name']);
533 $path_info = pathinfo($target_path);
534
535 if ( file_exists( $target_path ) ){
536
537 echo "<br>" . basename($_FILES['file']['name']) . " already exists.<br>";
538 return;
539
540 }else{
541
542 if ( $_POST['title'] && $_POST['title'] !== "Title" ){
543
544 $finfo["title"] = $_POST['title'];
545
546 } else {
547
548 $finfo_path = pathinfo($_FILES['file']['name']);
549 $finfo["title"] = $finfo_path['filename'];
550 $finfo["title"] = preg_replace("/[\_\^\-\.\@\/\)\(]/", " ", $finfo["title"]);
551
552 }
553
554 $finfo["size"] = $_FILES['file']['size'];
555 $finfo["filename"] = $_FILES['file']['name'];
556 $finfo["extension"] = $path_info['extension'];
557 $finfo["alphalevel"] = alpha_conv($_POST["level"]);
558 $finfo["date"] = micro();
559 $query = "
560 INSERT INTO `thps_replays` (`username`, `uid`, `rename`, `filename` , `type`, `level` , `ip` , `date` , `size` )
561 VALUES ('" . $user->name . "', '" . $user->id . "', '" . $finfo['title'] . "', '" . $finfo['filename'] . "', '" . $_POST['type'] . "', '" . $_POST['level'] . "', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $finfo['date'] . "', '" . $finfo['size'] . "')
562 ";
563
564 $DB->query($query);
565
566 if ( !$DB->error ){
567
568 // Success
569 echo "Query complete ..<br>";
570
571
572 }elseif( $DB->error ){
573
574 echo "SQL query error: " . $DB->error . " ..<br><br>$query";
575
576 }
577
578 if ( !$DB->error && move_uploaded_file($_FILES['file']['tmp_name'], $target_path) ){
579
580 echo "<br><b>Upload Complete!</b> ..<br> " . basename($_FILES['file']['name']) . " has been uploaded to <a href=\"/replays/users/" . $user->name . "/" . basename($_FILES['file']['name']) . "\">" . $target_url . "</a>";
581
582 }
583
584 }
585
586 }
587
588
589
590/////////////////////////////////////////
591// UPLOAD FORM //
592/////////////////////////////////////////
593
594 function form()
595 {
596
597 global $user, $thps_levels, $thps_types;
598
599 if ( $user->id <= 0 ){
600
601 echo $this->error("You must be signed in to upload.");
602
603 }
604
605 echo '
606
607 <br><br>
608 <form style="background-color: transparent; color: orange" action="?act=upload" method="post" enctype="multipart/form-data">
609
610 <table align="center" style="width: 20%; border-width: 1px; border-color: #101010; border-style: solid; background-color: transparent" cellspacing="1" class="row1">
611
612 <tr>
613 <td class="tile_red" colspan="2" style="text-align:center">
614 Replay Upload
615 </td>
616 </tr>
617
618 <tr>
619 <td colspan="2" class="row1">
620
621 <input READONLY value="' . $user->name . '" type="text" size="32" name="user" style="background-color: #202020; font-family: Verdana; font-size:9px; color: orange">
622
623 </td>
624 </tr>
625
626 <tr>
627 <td class="row1" colspan="2"><input type="file" size="32" name="file" style="background-color: #202020; font-family: Verdana; font-size:9px; color: orange"></td>
628 </tr>
629
630 <tr>
631 <td class="row3" colspan="2" style="text-align: center; background-color: #2C2C30; font-family: Verdana; font-size:9px; color: orange">
632
633 <SELECT NAME="level" class="dark_input" style="width: 60%">
634
635 ';
636
637
638 foreach ( $thps_levels as $key => $value ){
639
640 if ( (int) $key == 0 ){
641
642 $key = NULL;
643 $value = "Level";
644
645 }
646
647 echo "<OPTION VALUE=\"$key\">$value</OPTION>";
648
649 }
650
651
652 echo ' </SELECT> ';
653
654 echo ' <SELECT NAME="type" class="dark_input" style="width: auto">
655 <OPTION VALUE="99">Type</OPTION>';
656
657
658 foreach ( $thps_types as $key => $value ){
659
660 echo "<OPTION VALUE=\"$key\">$value</OPTION>";
661
662 }
663
664 // <td class="row2" colspan="2"><input type="text" size="32" maxlength="36" name="title" value="Title" onClick="if(this.value==\'Title\'){this.value=\'\'}">
665
666 echo '
667 </SELECT>
668 </td>
669 </tr>
670
671 <tr>
672 <td class="row3" colspan="2" style="padding: 0; background-color: #2C2C30">
673
674 <input type="submit" style="background-color: orange; height: 100%; width: 100%; padding: 0; margin: 0; color: black; font-weight: bold; font-size: 11px; font-family: Verdana" value="Post file!">
675
676 </td>
677 </tr>
678
679 </table>
680
681 </form>
682
683 <br>
684
685 ';
686
687
688 }
689
690
691/////////////////////////////////////////
692// ReUp CP //
693/////////////////////////////////////////
694
695 function ReplayCP(){
696
697 global $DB, $modules, $user, $thps_types, $thps_builds, $thps_levels, $date, $mouseOver, $root;
698
699 require($root . "modules/replayCP.php");
700
701 }
702
703
704/////////////////////////////////////////
705// ReUp CP //
706/////////////////////////////////////////
707
708/*
709
710 function ReplayCP()
711 {
712
713
714 if ( $_FILES['file'] !== NULL ){
715
716 $selected = array(
717 name => "" . $_FILES['file']['name'] . "",
718 type => "" . $_FILES['file']['type'] . "",
719 size => "" . $_FILES['file']['size'] . "");
720
721 }
722
723 // Active Variables
724 $root = "/home/.rico/killerthps/killerthps.com/replays/users";
725 $domain ="http://KiLLeRtHPS.cOM/replays/users/";
726 $public_path = "".$domain."".$f_name."";
727 $exists = fopen("".$path."", "r");
728 $vindx = "http://KiLLeRtHPS.cOM/replays/users";
729 $id = $_COOKIE['member_id']; // Database row #
730 $replay_file = $selected['name'];
731 $replay_size = $selected['size'] / 1024 / 1000;
732 $action = $_GET['act'];
733 $size = round($replay_size, 3);
734
735 }
736
737
738*/
739
740/////////////////////////////////////////
741// REPLAYER INDEX //
742/////////////////////////////////////////
743
744
745 function Replayers()
746 {
747
748 global $DB, $user, $descells, $date;
749
750 $DB->query("SELECT SUM( `size` ), SUM( `views` ) FROM `thps_replays` ");
751 $sum = size(mysql_result($DB->result, 0));
752 $sum = number_format($sum['gb'], 2, ".", ",");
753 $view_count = mysql_result($DB->result, 0, 1);
754
755 $DB->query("SELECT * FROM `thps_replays` ORDER BY `rid`");
756
757/*
758<select name=\"search_field\" class=\"forminput\" style=\"height: 17px; font-size: 10px; border-width: 2px 0px 2px 2px; border-style: inset; border-color: #4c4c4c; font-weight: bold; vertical-align: middle; text-align: center\"><option>Username</option><option>Replay Title</option><option>Type</option></select>
759*/
760
761 echo '
762 <table class="content_table" cellspacing="1" cellpadding="3" width="100%">
763
764 <!--
765
766 <tr>
767 <td class="tile_red" colspan="100%" width="100%">
768
769 tRI
770
771 </td>
772 </tr>
773
774 -->
775 ';
776
777
778 echo("
779 <tr>
780 <td class=\"row3\" colspan=\"100%\" width=\"100%\" align=\"center\">
781
782 " . searchbar() . "
783
784 </td>
785 </tr>
786
787 <tr>
788 <td class=\"tile_red\" style=\"width: 25px\">
789
790 <a href=\"?sort=Username\" class=\"black\">RPs</a>
791
792 </td>
793 <td class=\"tile_red\">
794
795 <a href=\"?sort=Username\" class=\"black\">Player</a>
796
797 </td>
798 <td class=\"tile_red\">
799
800 <a href=\"?sort=Username\" class=\"black\">Last ReUp</a>
801
802 </td>
803 <td class=\"tile_red\">
804
805 <a href=\"?sort=Username\" class=\"black\">Last Updated</a>
806
807 </td>
808 </tr>
809
810 ");
811
812
813
814 $row[1] = "class=\"row1\"";
815 $row[2] = "class=\"row2\"";
816
817 $link[1] = "class=\"white\"";
818 $link[2] = "";
819
820 $i=1;
821
822
823
824
825 while ($listing = mysql_fetch_array($DB->result, MYSQL_ASSOC) )
826
827 {
828
829 $pinfo = pathinfo($listing['filename']);
830 $dateStr = date($date['long'], $listing['updated']);
831
832 echo('<tr><td ' . $row[$i] . ' align="center" valign="center">');
833 echo($listing['rid']);
834 echo('</td><td ' . $row[$i] . ' valign="center" style="padding-left: 12px"><a href="' . $PHP_SELF . '?act=Browse&uid=' . $listing["uid"] . '">');
835 echo($listing['username']);
836 echo('</a></td><td ' . $row[$i] . ' valign="center" style="padding-left: 12px">');
837 echo('<a href="' . $PHP_SELF . '?act=RePlayer&rid=' . $listing["rid"] . '">');
838 echo("" . $listing['rename'] . "");
839 echo('</a></td><td ' . $row[$i] . ' valign="center" style="padding-left:12px">');
840 echo($dateStr);
841 echo("</td></tr>");
842
843
844 $i++;
845
846 if ($i >= 3)
847 { $i=1; }
848
849
850 }
851
852
853 echo("
854 <tr>
855 <td class=\"row3\" colspan=\"100%\" width=\"100%\" align=\"center\">
856
857
858 " . searchbar() . "
859
860
861 </td>
862 </tr>
863
864 </table>
865 ");
866
867
868
869 // index user page, NOT the search page:
870
871 $this->footer();
872
873
874 }
875
876/////////////////////////////////////////
877// BROWSE REPLAYS //
878/////////////////////////////////////////
879
880 function Browse ()
881 {
882
883 global $DB, $modules, $user, $_GET, $descells, $date, $mouseOver, $thps_levels, $thps_builds, $thps_types;
884
885 //if($_GET['uid'])
886 $this->Search();
887 //else $this->Replayers();
888
889 }
890
891/////////////////////////////////////////
892// REPLAYER //
893/////////////////////////////////////////
894
895 function RePlayer ()
896 {
897 global $DB, $user, $_POST, $_GET, $root, $killerthps_com, $player_idx, $login;
898
899 if (!$_GET['rid'] || !is_numeric($_GET['rid'])):
900 $this->error("No replay selected.");
901
902 //elseif (!isset($_COOKIE['member_id'])):
903 //require($root . "/sources/login.php");
904
905 else:
906 require($root . "sources/replayer_bloo.php");
907
908 endif;
909
910 }
911
912/////////////////////////////////////////
913// REPLAY CP //
914/////////////////////////////////////////
915/*
916 function ReplayCP ()
917 {
918
919 global $DB, $user, $_GET, $_POST, $_FILES, $game, $thps_types, $thps_levels, $mouseOverDel, $mouseOver, $date, $darkrow2;
920
921 if($_COOKIE['member_id']<1) :
922
923 $this->error("You must login to access the Replay Control Panel.");
924
925 endif;
926
927
928 $DB->query("SELECT `rid`,`pid`,`uid`,`rename`,`filename`,`note`,`views`,`date`,`level`,`type` FROM `thps_replays` WHERE `uid` = '{$_COOKIE['member_id']}' ORDER BY `rid` DESC");
929 $i=0;
930
931// BUILD & CACHE USERS VIDLIST ..
932 while($rcp_results = mysql_fetch_array($DB->result, MYSQL_ASSOC)):
933 $i++;
934 $myvids["$i"] = $rcp_results;
935 endwhile;
936
937
938/////////////////////////////////////////////////////////
939///// MY VIDS LIST /////
940/////////////////////////////////////////////////////////
941
942
943echo ('<table width="100%" cellpadding="7" cellspacing="1" style="background-color: #262626; border: 0px #202020 solid;" align="center">
944
945 <tr>
946 <td width="100%" colspan="100%" class="button_tile" style="border: 0px; padding: 4px;" align="center">
947
948 <font style="font-variant: small-caps"><b>My ReUps</b></font>
949
950 </td>
951 </tr>');
952
953
954 if(!is_array($myvids)):
955
956 echo ('
957
958 <tr height="100%">
959
960 <td class="darkrow2" align="center" valign="center">
961
962 <br />
963 <br />
964
965 You can\'t view/edit something that doesn\'t exist.<br /><br /><br /><--- Upload your replays using the ReUp Form
966
967 <br />
968 <br />
969 <br />
970 <br />
971 <br />
972
973 </td>
974
975 </tr>
976
977
978 ');
979
980 else:
981
982echo ('
983 ' . $descells["ReplayCP"] . '
984
985 <form action="' . $PHP_SELF . '?act=Delete" method="POST" name="form">');
986
987
988 $i=0;
989 $count_myvids = 0;
990
991 foreach(array_keys($myvids) as $rcpArr => $rcpVals):
992
993 $i++;
994 $count_myvids++;
995 $rcpArr = $myvids["$i"];
996 $dateStr = date($date['short'], $rcpArr['date']);
997
998 echo("<tr><td class=\"row4\" width=\"1%\" align=\"center\">" . $rcpArr["rid"] . "</td><td class=\"darkrow3\" {$mouseOver} width=\"50%\"><a href=\"{$PHP_SELF}?act=ReplayCP&edit_id={$rcpArr["rid"]}\">" . $rcpArr["rename"] . "</a></td><td class=\"row4\" width=\"10%\" align=\"left\" nowrap=\"true\">" . $thps_levels["{$rcpArr['level']}"] . "</td><td class=\"row4\" width=\"3%\" align=\"left\" nowrap=\"true\">" . $thps_types["{$rcpArr['type']}"] . "</td><td class=\"darkrow1\" width=\"30%\" nowrap=\"true\" align=\"left\">" . $rcpArr['note'] . "</td><td class=\"darkrow3\" width=\"1%\" align=\"center\">" . $rcpArr['views'] . "</td><td class=\"darkrow4\" width=\"2%\" align=\"center\">" . $dateStr . "</td><td class=\"darkrow5\" width=\"1%\" align=\"center\"><input type=\"checkbox\" name=\"rid_{$rcpArr['rid']}\" value=\"{$rcpArr['rename']}\" {$mouseOverDel}></td></tr>");
999
1000 endforeach;
1001
1002
1003echo("
1004 <tr>
1005 <td class=\"darkrow1\" colspan=\"7\" align=\"center\">
1006
1007 Replays <a href=\"/forums/?showuser={$user->id}\">©{$user->name}</a> - Site Code/GFX <a href=\"/forums/?showuser=1\">©KiLLeRtHPS</a>
1008
1009 </td>
1010
1011 <td class=\"darkrow2\" colspan=\"1\" align=\"center\">
1012
1013 <input type=\"Submit\" value=\" Del \" class=\"forminput\" style=\"width: 100%\ border: 1px yellow solid;\">
1014 </td>
1015 </tr>
1016
1017 </table>");
1018
1019 endif;
1020
1021 $this->footer();
1022
1023 }
1024
1025 function ReUp ()
1026 {
1027
1028 $this->restricted();
1029
1030 if($_FILES['file']!==NULL)
1031
1032 $fileArr = array(
1033 name => "" . $_FILES['file'] ['name'] . "",
1034 type => "" . $_FILES['file'] ['type'] . "",
1035 size => "" . $_FILES['file'] ['size'] . "");
1036
1037
1038
1039 $title = $_POST['title'];
1040 $filename = $_FILES['file'];
1041 $f_id = $_COOKIE['member_id'];
1042
1043
1044 $i=2;
1045 $game_int = 2;
1046 $countgames = array_keys($thps_builds);
1047
1048 if($_FILES['file']!==NULL) {
1049 $rp_selected = "/replays/users/" . $user['name'] . "/" . $fileArr['name'];
1050 }
1051 else { $rp_selected = NULL; }
1052
1053 $rp_title = $_POST['rp_title'];
1054 $rp_note = $_POST['authors_note'];
1055
1056 $form_info = $_POST['rp_info'];
1057 $pattern = "/THPS/i";
1058 $replacewith = "";
1059 $selected_dropdown = preg_replace($pattern, $replace, $form_info, 2);
1060 $rp_info = explode(", ", $form_info, 2);
1061 $rp_game = $rp_info['0'];
1062 $rp_level = $rp_info['1'];
1063
1064 $rp["type"] = $_POST['rp_type'];
1065 $rp["time"] = time();
1066 $rp["title"] = $rp_title;
1067 $rp["level"] = $rp_level;
1068 $rp["game"] = $rp_game;
1069 $rp["authors_note"] = $rp_note;
1070 $rp["selected_replay"] = $rp_selected;
1071 $rp["ip"] = $_SERVER['REMOTE_ADDR'];
1072
1073
1074 $total_keys = count(array_keys($rp));
1075 $total_key_vals = count(array_keys($rp, !NULL));
1076 $excluded_keys = array_keys($rp, NULL);
1077 $sort_excluded = array_multisort($excluded_keys, SORT_DESC);
1078
1079 if($_GET['edit_id']!==NULL && $_POST['change']=="1")
1080
1081 {
1082
1083 $DB->query("UPDATE `thps_replays` SET
1084 `rename` = '{$_POST[replay_title]}', `note` = '{$_POST[note]}', `type` = '{$_POST[replay_type]}', `level` = '{$rp_level}', `game` = '{$rp_game}'
1085 WHERE `thps_replays` . `rid` = '{$_POST[rid]}';");
1086
1087 echo("<br /><br /><div align=\"center\"><b>Your requested changes were executed without error.</b></div><br /><br />");
1088
1089 }
1090
1091 }
1092
1093
1094*/
1095/////////////////////////////////////////
1096// SEARCH FORM //
1097/////////////////////////////////////////
1098
1099
1100 function Adv_Search()
1101 {
1102
1103 global $user, $DB, $root;
1104
1105 $DB->query("SELECT DISTINCT(`username`), `uid` FROM `thps_replays`");
1106
1107 echo "
1108 <form action=\"\" method=\"get\">
1109
1110 <input type=\"hidden\" name=\"act\" value=\"Search\">
1111 <input type=\"hidden\" name=\"mode\" value=\"advanced\">
1112
1113 <table width=\"100%\" align=\"center\" style=\"background-color: #272727; width: 100%; padding: 0; margin: 0\" cellspacing=\"1\" cellpadding=\"3\">
1114
1115 <tr>
1116 <td class=\"row3\" width=\"100%\" align=\"center\">
1117
1118 <div align=\"center\">
1119
1120 <br>
1121
1122 <table align=\"center\" style=\"background-color: #232326; margin: 0\" cellspacing=\"1\" cellpadding=\"3\">
1123
1124 <tr>
1125 <td class=\"darkrow2\" style=\"padding: 5px; width: 25%; text-align: center\">Username</td>
1126
1127 <td class=\"row2\" align=\"center\" style=\"padding: 5px\">
1128
1129 <SELECT NAME=\"username\" class=\"dark_input\" style=\"width:97%\">
1130 <OPTION VALUE=\"\">Any</OPTION>
1131 ";
1132
1133
1134 while ( $row = mysql_fetch_array($DB->result, MYSQL_ASSOC) ){
1135
1136
1137 echo "<OPTION VALUE=\"" . $row['username'] . "\">" . $row['username'] . "</OPTION>";
1138
1139 }
1140
1141
1142 echo "
1143 </SELECT>
1144 </td>
1145 </tr>
1146
1147 <tr>
1148 <td class=\"darkrow2\" style=\"padding: 5px; width: 25%; text-align: center\">Build</td>
1149
1150 <td class=\"row2\" align=\"center\" style=\"padding: 5px\">
1151 <SELECT NAME=\"game\" class=\"dark_input\" style=\"width:97%\">
1152 <OPTION VALUE=\"\">Any</OPTION><OPTION VALUE=\"1\">THPS1</OPTION><OPTION VALUE=\"2\">THPS2</OPTION><OPTION VALUE=\"3\">THPS3</OPTION><OPTION VALUE=\"4\">THPS4</OPTION><OPTION VALUE=\"5\">THUG</OPTION><OPTION VALUE=\"6\">THUG2</OPTION><OPTION VALUE=\"7\">THAW</OPTION><OPTION VALUE=\"8\">Project 8</OPTION>
1153 </SELECT>
1154
1155 </td>
1156 </tr>
1157
1158 <tr>
1159 <td class=\"darkrow2\" style=\"padding: 5px; width: 25%; text-align: center\">Type</td>
1160
1161 <td class=\"row2\" align=\"center\" style=\"padding: 5px\">
1162
1163 <SELECT NAME=\"type\" class=\"dark_input\" style=\"width:97%\">
1164 <OPTION VALUE=\"\">Any</OPTION><OPTION VALUE=\"1\">GT</OPTION><OPTION VALUE=\"2\">Improv</OPTION><OPTION VALUE=\"3\">Line</OPTION><OPTION VALUE=\"4\">NM</OPTION><OPTION VALUE=\"5\">Project</OPTION><OPTION VALUE=\"6\">Style</OPTION><OPTION VALUE=\"7\">Tourny</OPTION>
1165 </SELECT>
1166
1167 </td>
1168 </tr>
1169
1170 <tr>
1171 <td class=\"darkrow2\" style=\"padding: 5px; width: 25%; text-align: center\">Level</td>
1172
1173 <td class=\"row2\" align=\"center\" style=\"padding: 5px\">
1174
1175 <SELECT NAME=\"level\" class=\"dark_input\" style=\"width:97%\">
1176 <OPTION VALUE=\"\">Any</OPTION><OPTION VALUE=\"1\">Foundry</OPTION><OPTION VALUE=\"2\">Canada</OPTION><OPTION VALUE=\"3\">Rio</OPTION><OPTION VALUE=\"4\">Suburbia</OPTION><OPTION VALUE=\"5\">Airport</OPTION><OPTION VALUE=\"6\">Skater Island</OPTION><OPTION VALUE=\"7\">Los Angeles</OPTION><OPTION VALUE=\"8\">Tokyo</OPTION><OPTION VALUE=\"9\">Cruise Ship</OPTION><OPTION VALUE=\"10\">Warehouse</OPTION><OPTION VALUE=\"11\">Burnside</OPTION><OPTION VALUE=\"12\">Roswell</OPTION><OPTION VALUE=\"13\">Multiple</OPTION><OPTION VALUE=\"14\">College</OPTION><OPTION VALUE=\"15\">San Fransisco</OPTION><OPTION VALUE=\"16\">Alcatraz</OPTION><OPTION VALUE=\"17\">Kona</OPTION><OPTION VALUE=\"18\">Shipyard</OPTION><OPTION VALUE=\"19\">London</OPTION><OPTION VALUE=\"20\">Zoo</OPTION><OPTION VALUE=\"21\">Carnival</OPTION><OPTION VALUE=\"22\">Chicago</OPTION><OPTION VALUE=\"23\">Multiple</OPTION><OPTION VALUE=\"24\">New Jersey</OPTION><OPTION VALUE=\"25\">Manhattan</OPTION><OPTION VALUE=\"26\">Tampa</OPTION><OPTION VALUE=\"27\">San Diego</OPTION><OPTION VALUE=\"28\">Hawaii</OPTION><OPTION VALUE=\"29\">Vancouver</OPTION><OPTION VALUE=\"30\">Slam City Jam</OPTION><OPTION VALUE=\"31\">Moscow</OPTION><OPTION VALUE=\"32\">Hotter Than Hell</OPTION><OPTION VALUE=\"33\">School 2</OPTION><OPTION VALUE=\"34\">Venice</OPTION><OPTION VALUE=\"35\">Multiple</OPTION><OPTION VALUE=\"36\">Warehouse</OPTION><OPTION VALUE=\"37\">Boston</OPTION><OPTION VALUE=\"38\">Barcelona</OPTION><OPTION VALUE=\"39\">Berlin</OPTION><OPTION VALUE=\"40\">Australia</OPTION><OPTION VALUE=\"41\">New Orleans</OPTION><OPTION VALUE=\"42\">Skatopia</OPTION><OPTION VALUE=\"43\">Pro Skater</OPTION><OPTION VALUE=\"44\">The Triangle</OPTION><OPTION VALUE=\"45\">School</OPTION><OPTION VALUE=\"46\">Philadelphia</OPTION><OPTION VALUE=\"47\">Downhill Jam</OPTION><OPTION VALUE=\"48\">Canada</OPTION><OPTION VALUE=\"49\">Airport</OPTION><OPTION VALUE=\"50\">Los Angeles</OPTION><OPTION VALUE=\"51\">Multiple</OPTION><OPTION VALUE=\"52\">Hollywood</OPTION><OPTION VALUE=\"53\">Beverly Hills</OPTION><OPTION VALUE=\"54\">Skate Ranch</OPTION><OPTION VALUE=\"55\">Santa Monica</OPTION><OPTION VALUE=\"56\">Downtown</OPTION><OPTION VALUE=\"57\">Oil Rig</OPTION><OPTION VALUE=\"58\">East LA</OPTION><OPTION VALUE=\"59\">Casino</OPTION><OPTION VALUE=\"60\">Minneapolis</OPTION><OPTION VALUE=\"61\">Santa Cruz</OPTION><OPTION VALUE=\"62\">The Mall</OPTION><OPTION VALUE=\"63\">Chicago</OPTION><OPTION VALUE=\"64\">Kyoto</OPTION><OPTION VALUE=\"65\">The Ruins</OPTION><OPTION VALUE=\"66\">Atlanta</OPTION><OPTION VALUE=\"67\">Marseilles</OPTION><OPTION VALUE=\"68\">Multiple</OPTION>
1177 </SELECT>
1178
1179 </td>
1180 </tr>
1181
1182 <tr>
1183 <td class=\"darkrow2\" style=\"padding: 5px; width: 25%; text-align: center\"> </td>
1184
1185 <td class=\"row2\" align=\"center\" style=\"padding: 5px\">
1186
1187 <input type=\"submit\" value=\"Search!\" class=\"dark_input\" style=\"width: 97%\">
1188
1189 </td>
1190
1191 </table>
1192
1193 <br>
1194
1195 </div>
1196
1197 </td>
1198 </tr>
1199
1200 </table>
1201
1202 </form>
1203 ";
1204
1205 }
1206
1207
1208 function Search()
1209 {
1210 global $DB, $thps_types, $thps_builds, $thps_levels, $date, $mouseOver, $root;
1211
1212 require($root . "modules/search.php");
1213
1214 }
1215
1216/////////////////////////////////////////
1217// FOOTER .. //
1218/////////////////////////////////////////
1219
1220 function footer()
1221 {
1222 global $DB, $init, $date, $root;
1223 $init_exit = micro();
1224 $compare = $init_exit - $init;
1225 $exec_time = substr((float)$init_exit - (float)$init, 0, 5);
1226 $date = date("n.j.y @ h:i:s A", time());
1227 $ip = $_SERVER['REMOTE_ADDR'];
1228
1229 die('</td>
1230 </tr>
1231
1232 </table>
1233
1234 <!-- END BORDER TABLE .. -->
1235
1236
1237 </td>
1238 <td class="tilewrap_right"> </td>
1239 </tr>
1240 <tr>
1241 <td class="tilewrap_left"> </td>
1242 <td class="tile_red" align="center">killerthps.com [ All rights reserved ]</td>
1243 <td class="tilewrap_right"> </td>
1244 </tr>
1245</table>
1246
1247</body>
1248</html>
1249 ');
1250
1251 }
1252
1253 // $takeoff = "postponed"; from requesting page will disable the loading header, tables, etc
1254
1255 function launchpad()
1256 {
1257
1258 global $login, $DB, $modules, $user, $launchpad, $takeoff;
1259
1260 while ($launchpad = true):
1261
1262 if($_GET['act']=="Logout")
1263 { $takeoff = "postponed"; }
1264
1265 $DB = new DB();
1266 $DB->connect();
1267 $modules = new modules();
1268 $user = new user();
1269
1270 if(isset($login['name']) && isset($login['pass']))
1271 $user->Login();
1272 elseif($_GET['act']!=="Logout")
1273 $user->check();
1274
1275 $user->get_location();
1276
1277 if ( $takeoff !== "postponed" )
1278 { echo $modules->header(); }
1279
1280 $launchpad = false;
1281 break;
1282
1283 endwhile;
1284
1285 }
1286
1287 }
1288
1289if ( $takeoff == "cancelled" )
1290 { /* Do nothing .. */ }
1291
1292else{ modules::launchpad(); }
1293
1294?>