commit b22c0a1df893afe3fccc08c3b25846098612afe2 Author: Xkeeper Date: Sat Aug 8 22:45:34 2015 -0700 First (re-)commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ee8f2e --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.rem/ +.old/ +board/ +xkeeper/ + +lib/config.php +lib/firewall.php \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..123ceea --- /dev/null +++ b/.htaccess @@ -0,0 +1,7 @@ + +ErrorDocument 403 /errors/403.html +ErrorDocument 404 /errors/404.html +ErrorDocument 500 /errors/500.html + +Order Allow,Deny +Allow from all diff --git a/acs.php b/acs.php new file mode 100644 index 0000000..fa20b7c --- /dev/null +++ b/acs.php @@ -0,0 +1,177 @@ +query("SELECT u.id,u.name,u.aka,u.sex,u.powerlevel,COUNT(*) AS cnt FROM users AS u,posts AS p WHERE p.user=u.id AND p.date>=$dd AND p.date<$dd2 AND u.powerlevel >= 0 GROUP BY u.id ORDER BY cnt DESC"); + $i=0; + + if (!$u) { + $u = 0; + $n = $loguser['name']; + } + elseif ($u==2) + $n = $userid; + + if(!$view || $view <= 0 || $view > 2) $view=0; + + $ch1[$v] = 'checked'; + $ch2[$u] = 'checked'; + $ch3[$view] = 'checked'; + + $tposts = $sql->resultq("SELECT COUNT(*) AS cnt FROM posts WHERE posts.date>$dd AND posts.date<$dd2",0,'cnt'); + $rcount = ($tposts >= 400 ? 10 : 5); + $spoints = ($tposts >= 400 ? 11 : 8); + $desc="
$smallfont"; + print " + $header +
+ $tblstart + $tccellh colspan=2>Currently viewing ".date('m-d-y',$dd)." + $tccell1>Day:$desc Select the day to view rankings from. (mm-dd-yy format) + $tccell2l>$radio=v value=0 $ch1[0]> Today   $radio=v value=1 $ch1[1]> Other: $inpt=m VALUE=\"$m\" SIZE=2 MAXLENGTH=2>-$inpt=d VALUE=\"$d\" SIZE=2 MAXLENGTH=2>-$inpt=y VALUE=\"$y\" SIZE=2 MAXLENGTH=2> + $tccell1>User:$desc This user will be highlighted. + $tccell2l>$radio=u value=1 $ch2[1]> None   $radio=u value=0 $ch2[0]> You   $radio=u value=2 $ch2[2]> Other: $inpt=userid VALUE=\"$userid\" SIZE=25 MAXLENGTH=25> + $tccell1>View format: + $tccell2l>$radio=view value=0 $ch3[0]> Full rankings   $radio=view value=1 $ch3[1]> Rankers   $radio=view value=2 $ch3[2]> JCS form + $tccell1>  + $tccell2l> + $tblend + + $tblstart + "; + $max=1; + if($view<2){ + print " + $tccellh width=30># + $tccellh width=60%>Name + $tccellh width=50>Posts + $tccellh width=*>Total: $tposts + "; + while($user=$sql->fetch($users)){ + if($user['cnt']>$max) $max=$user['cnt']; + $i++; + if($rp!=$user['cnt']) $r=$i; + $rp=$user['cnt']; + + // Don't rank with 1 post + if ($user['cnt'] <= 1 && $rcount >= $r) + $rcount = $r-1; + + if($rr<=$rcount && $r>$rcount && $view==0) print "$tccellc colspan=4>"; + $rr=$r; + $b = $slashb = ''; + $td=$tccell1; + + if($r>$rcount) $td=$tccell2; + if(!strcasecmp($user['name'], $n)){ + $td=$tccellc; + $b=''; + $slashb=''; + } + + $tdl=str_replace(' center','',$td); + if($view==0 or ($view==1 and ($r<=$rcount or !strcasecmp($user['name'], $n)))) { + print " + + $td>$b$r$slashb + $tdl>". (!$_GET['dur'] ? $user['name'] : "DU". str_repeat("R", mt_rand(1,25))) ." + $td>$b$user[cnt]$slashb + $tdl> + "; + } + } + } else { + // Ranked yesterday: +// $usersy=mysql_query("SELECT users.id,users.name,users.sex,users.powerlevel,COUNT(posts.id) AS cnt FROM users,posts WHERE posts.user=users.id AND posts.date>".($dd-86400)." AND posts.date<$dd GROUP BY users.id ORDER BY cnt DESC"); +// $i=0; +// while($user=mysql_fetch_array($usersy) and $r <= $rcount ) { +// $i++; +// if($rp!=$user['cnt']) $r=$i; +// $rp=$user['cnt']; +// if($r<=5) $ranky[$user['id']]=$r; +// } + + $i=0; + $rp=0; + $r=0; + while($user = $sql->fetch($users) and $r <= $rcount){ + $i++; + // Don't rank with 1 post + if ($user['cnt'] <= 1 && $rcount >= $r) { + $rcount = $r-1; + } + if($rp!=$user['cnt']){ + $r=$i; + if($tend) $tie=''; + if($tie) $tend=1; + }else{ + $tie='T'; + $tend=0; + } + $posts[$user['id']]=$user['cnt']; + + // Ranked yesterday: +// $ry=$ranky[$user['id']]; +// if(!$ry) $ry='NR'; + + $rp=$user['cnt']; + //$myfakename = (($user['aka'] && $user['aka'] != $user['name']) ? "$user[aka] ($user[name])" : $user['name']); + //$myrealname = (($user['aka']) ? $user['aka'] : $user['name']); + $myfakename = $myrealname = $user['name']; + $dailyposts .= $tie . $ndailyposts; + $dailypoints .= $tie . $ndailypoints; + $ndailyposts = "$r) ". $myfakename ." - ". $user['cnt'] ."
"; + $ndailypoints = "$r) ". $myrealname ." - ". ($spoints - $r) ."
"; + +// $ndailyposts = "$tie$r) ". $user['name'] ." - ". $user['cnt'] ." - ". ($spoints - $r) ."
"; +// $ndailyposts = "$tie$r) ". $user['name'] ." - ". $user['cnt'] ." - ". ($spoints - $r) ."
"; + + } + if($r <= $rcount) { + if($tend) $tie=''; + // $dailyposts.=$tie.$ndailyposts; + // $dailypoints.=$tie.$ndailypoints; + } + + // More ranked yesterday stuff +// $lose=$user[cnt]; +// @mysql_data_seek($usersy,0); +// $i=0; +// $rp=0; +// $r=0; +// while($user=mysql_fetch_array($usersy) and $r<=$rcount){ +// $i++; +// if($rp!=$user[cnt]) $r=$i; +// $rp=$user[cnt]; +// if($posts[$user[id]]<=$lose && $r<=$rcount) $offcharts.=($offcharts?', ':'OFF THE CHARTS: ')."$user[name] ($r)"; +// } + + print " + $tccell1l> + ". strtoupper(date('F j',$dd)) ."
". + "---------

". + "TOTAL NUMBER OF POSTS: $tposts

". + "$dailyposts

". + "DAILY POINTS
". + "--------------------
". + "$dailypoints"; + } + print $tblend.$footer; + printtimedif($startingtime); diff --git a/activeusers.php b/activeusers.php new file mode 100644 index 0000000..78bce9f --- /dev/null +++ b/activeusers.php @@ -0,0 +1,147 @@ +posts made"; + $linklist[1] = "new threads"; + if ($log) { + $linklist[2] = "PMs sent by you"; + $linklist[3] = "PMs sent to you"; + } + + if ($type == 'thread') { + $posters = $sql-> query("$query, threads WHERE threads.user=users.id" + .($time ? " AND threads.firstpostdate> '". (ctime() - $time) ."'" : '') + .$endp); + $desc = "Most active thread posters"; + $column = "Threads"; + $column2 = "threads"; + $stat = "most thread creators"; + $linklist[1] = "new threads"; + + } elseif ($type == 'pm') { + $posters = $sql-> query("$query, pmsgs WHERE pmsgs.userto=$loguserid" + .($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '') + ." AND pmsgs.userfrom=users.id$endp"); + $desc = "PMs recieved from"; + $column = "PMs"; + $column2 = "PMs"; + $stat = "most message senders"; + $linklist[3] = "PMs sent to you"; + + } elseif ($type == 'pms') { + $posters = $sql-> query("$query, pmsgs WHERE pmsgs.userfrom=$loguserid" + .($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '') + ." AND pmsgs.userto=users.id$endp"); + $desc = "PMs sent to"; + $column = "PMs"; + $column2 = "PMs"; + $stat = "who you've sent the most messages to"; + $linklist[2] = "PMs sent by you"; + + } else { + $posters = $sql-> query("$query, posts WHERE posts.user=users.id" + .($tid ? " AND thread='$tid'" : '') + .($time ? " AND posts.date> '". (ctime() - $time) ."'" : '') + .$endp); + $desc = "Most active posters"; + $column = "Posts"; + $column2 = "posts"; + $stat = "most active posters"; + $linklist[0] = "posts made"; + $type = ''; + } + + $link='$smallfont + Show $stat in the: +
$link=3600>last hour
- $link=86400>last day - $link=604800>last week - $link=2592000>last 30 days - $link=0>from the beginning + $smallfont + Most active users by:
+ ".implode(" - ", $linklist)." + $tblend + "; + + if ($time) + $timespan = " during the last ". timeunits2($time); + else + $timespan = ""; + +/* + if ($loguser["powerlevel"] >= 1) { + // Xk will hate me for using subqueries. + // No, I'll just hate you for adding this period + // It's like a sore. + // Also, uh, interesting I guess. The more you know. + $pcounts = $sql -> query(" + SELECT + (SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel >= 1) AS posts_staff, + (SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = 0) AS posts_users, + (SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = -1) AS posts_banned"); + + $pcounts = $sql->fetch($pcounts); + print " + $tblstart + $tccellh colspan=2>Staff vs. Normal User Posts + $tccell1>$pcounts[posts_staff]$tccell1>$pcounts[posts_users] + $tccell2 colspan=2>The ratio for staff posts to normal user posts is ".round($pcounts["posts_staff"]/$pcounts["posts_users"],3).". + $tccell2 colspan=2>Not included were the ".abs($pcounts[posts_banned])." posts shat out by a collective of morons. Depressing. + $tblend +
+ "; + } +*/ + + print " + $tblstart + $tccellc colspan=6>$desc$timespan + + $tccellh width=30># + $tccellh colspan=2>Username + $tccellh width=200>Registered on + $tccellh width=130 colspan=2>$column + "; + + $total = 0; + for($i = 1; $user = $sql->fetch($posters); $i++) { + if($i == 1) $max = $user['cnt']; + if ($user['cnt'] != $oldcnt) $rank = $i; + $oldcnt = $user['cnt']; + $ulink = getuserlink($user); + print " + + $tccell1>$rank + $tccell1 width=16>". ($user['minipic'] ? "" : " ") ." + $tccell2l>{$ulink} + $tccell1>".date($dateformat, $user['regdate'] + $tzoff) ." + $tccell2 width=30>". $user['cnt'] ." + $tccell2 width=100>". number_format($user['cnt'] / $max * 100, 1) ."%
+ "; + + $total += $user['cnt']; + } + + print " + + $tccellc colspan=6>". ($i - 1) ." users, $total $column2 + + "; + + print $tblend.$footer; + printtimedif($startingtime); diff --git a/activity.php b/activity.php new file mode 100644 index 0000000..f42f862 --- /dev/null +++ b/activity.php @@ -0,0 +1,64 @@ +resultq("SELECT regdate FROM users WHERE id='$u'") or die(); + + $vd=date('m-d-y', $user['regdate']); + $dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2)); + + $days = floor((ctime()-$dd)/86400); + $pq = $sql->getresultsbykey( + "SELECT FROM_UNIXTIME(date, '%Y-%m-%d') day, count(*) c ". + "FROM posts WHERE user={$u} GROUP BY day ORDER BY day", + 'day', 'c'); + for($i=0; $i < $days; ++$i) { + $dk = date('Y-m-d',$dd+$i*86400); + if (!array_key_exists($dk, $pq)) continue; + $p[$i] = $pq[$dk]; + } + +/* + if($_GET['debugsql']) { + require 'lib/layout.php'; + print $header.$footer; + printtimedif(time()); + die(1); + } +*/ + + $m=max($p); + $img=ImageCreate($days,$m); + + $c['bg'] = ImageColorAllocate($img, 0, 0, 0); + $c['bg1'] = ImageColorAllocate($img, 0, 0, 80); // Month colors + $c['bg2'] = ImageColorAllocate($img, 0, 0,130); // + $c['bg3'] = ImageColorAllocate($img, 80, 80,250); // (New year) + $c['mk1'] = ImageColorAllocate($img,110,110,160); // Horizontal Rulers + $c['mk2'] = ImageColorAllocate($img, 70, 70,130); // + $c['bar'] = ImageColorAllocate($img,240,190, 40); // Post count bar + $c['pt1'] = ImageColorAllocate($img,250,250,250); // Average + $c['pt2'] = ImageColorAllocate($img,240,230,220); // Average (over top of post bar) + + for($i=0;$i<$days; ++$i){ + $num=date('m',$dd+$i*86400)%2+1; + if(date('m-d',$dd+$i*86400)=='01-01') $num=3; + ImageLine($img,$i,$m,$i,0,$c["bg$num"]); + } + for($i=50, $ct=1; $i<=$m; $i+=50, ++$ct) + ImageLine($img,0,$m-$i,$days,$m-$i,(($ct&1) ? $c['mk2'] : $c['mk1'])); + + $pt=0; + for($i=0;$i<$days;$i++) { + if (isset($p[$i])) { + ImageLine($img,$i,$m,$i,$m-$p[$i],$c['bar']); + $pt += $p[$i]; + } + $avg = $pt/($i+1); + ImageSetPixel($img,$i,$m-$avg,(($p[$i] >= $avg) ? $c['pt2'] : $c['pt1'])); + } + + Header('Content-type:image/png'); + ImagePNG($img); + ImageDestroy($img); \ No newline at end of file diff --git a/activity2.php b/activity2.php new file mode 100644 index 0000000..ec9b3ae --- /dev/null +++ b/activity2.php @@ -0,0 +1,112 @@ + resultq("SELECT MIN(`regdate`) FROM users WHERE regdate > 0") or die(); + $max = ceil(($sql -> resultq("SELECT MAX(`posts`) FROM users") + 1) / 50) * 50; + + $vd = date('m-d-y', $user['regdate']); + $dd = mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2)); + + $days = floor((ctime()-$dd)/86400); + $scalex = 2; + $scaley = 20; + $m = $max / $scaley; + + $img = ImageCreateTrueColor($days * $scalex,$m); + $c['bg'] = ImageColorAllocate($img, 0, 0, 0); + $c['bg1'] = ImageColorAllocate($img, 0, 0, 60); + $c['bg2'] = ImageColorAllocate($img, 0, 0, 80); + $c['bg3'] = ImageColorAllocate($img, 40, 40,100); + $c['mk1'] = ImageColorAllocate($img, 60, 60,130); + $c['mk2'] = ImageColorAllocate($img, 80, 80,150); + $c['bar'] = ImageColorAllocate($img,250,190, 40); + $c['pt'] = ImageColorAllocate($img,250,250,250); + + for($i=0;$i<$days;$i++){ + $num=date('m',$dd+$i*86400)%2+1; + if(date('m-d',$dd+$i*86400)=='01-01') $num=3; + ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]); + } + + for($i=0;$i<=($m / 50);$i++){ + ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1, $m-$i*100+50, $c['mk1']); + ImageLine($img,0,$m-$i*100, ($days + 1) * $scalex - 1, $m-$i*100, $c['mk2']); + imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c['bg']); + imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c['bg']); + imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c['mk2']); + imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c['mk1']); + } + + $users = array(); + $userq = $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10"); + while ($u = $sql -> fetch($userq)) + $users[$u['id']] = array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255))); + + $z = count($users); + $namespace = 12; + + imagerectangle( $img, 61, 11, 174, 15 + $z * $namespace, $c['bg']); + imagefilledrectangle($img, 60, 10, 173, 14 + $z * $namespace, $c['bg2']); + imagerectangle( $img, 60, 10, 173, 14 + $z * $namespace, $c['mk2']); + + $z = 0; + + $data = getdata(array_keys($users)); + foreach($users as $uid => $userx) { + drawdata($data[$uid], $userx['color']); + imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c['bg']); + imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']); + imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c['bg']); + imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']); + $z++; + } + +/* if($_GET['debugsql']) { + require 'lib/layout.php'; + print $header.$footer; + printtimedif(time()); + die(1); + } */ + + Header('Content-type:image/png'); + ImagePNG($img); + ImageDestroy($img); + +function drawdata($p, $color) { + global $days, $scalex, $m, $img; + $oldy = $m; + for ($i=0;$i<$days;$i++){ + $y = $m-$p[$i]; + $x = $i * $scalex; + if (!$p[$i]) { + $y = $oldy; + } + imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color); + $oldy = $y; + } +} + +function getdata($users) { + global $sql, $dd, $scaley, $days; + + $q = $sql->query( + "SELECT user, FROM_UNIXTIME(date, '%Y-%m-%d') day, count(*) c ". + "FROM posts WHERE user IN (".implode(',',$users).") GROUP BY user, day ORDER BY user, day", + 'day'); + + $tmp = array(); + $y = array(); + + while ($r = $sql->fetch($q, MYSQL_ASSOC)) + $tmp[$r['user']][$r['day']] = $r; + + for($i=0; $i < $days; ++$i) { + $dk = date('Y-m-d',$dd+$i*86400); + foreach ($tmp as $uid => $qdata) { + if (!array_key_exists($dk, $qdata)) continue; + + $y[$uid] += $qdata[$dk]['c']; + $resp[$uid][$i] = $y[$uid] / $scaley; + } + } + return $resp; +} diff --git a/activity3.php b/activity3.php new file mode 100644 index 0000000..43dd5b2 --- /dev/null +++ b/activity3.php @@ -0,0 +1,173 @@ + resultq("SELECT MIN(`regdate`) FROM users"); + + $max = ceil(($sql -> resultq("SELECT COUNT(*) FROM `posts`") + 1) / 5000) * 5000; + $alen = ($_GET['len'] ? $_GET['len'] : 30); + + $alen = min(max(7, $alen), 90); +// $max = 5500; + + $vd=date('m-d-y', $user['regdate']); + $dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2)); + $dd2=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2)); + + + $days=ceil((ctime()-$dd)/86400); + $scalex = 1; + $scaley = 200; + $m = $max / $scaley; + $xs = $days * $scalex; + + $img=ImageCreateTrueColor($xs,$m); + + $c[bg]= ImageColorAllocate($img, 0, 0, 0); + $c[bg1]=ImageColorAllocate($img, 0, 0, 60); + $c[bg2]=ImageColorAllocate($img, 0, 0, 80); + $c[bg3]=ImageColorAllocate($img, 40, 40,100); + $c[bg4]=ImageColorAllocate($img,100, 40, 40); + $c[mk1]=ImageColorAllocate($img, 60, 60,130); + $c[mk2]=ImageColorAllocate($img, 80, 80,150); + $c[bar]=ImageColorAllocate($img,250,190, 40); + $c[pt] =ImageColorAllocate($img,250,250,250); + for($i=0;$i<$days;$i++){ + $num=date('m',$dd+$i*86400)%2+1; + if(date('m-d',$dd+$i*86400)=='01-01') $num=3; +# if(date('m-d-y',$dd+$i*86400)=='08-05-09') $num=4; +# if(date('m-d-y',$dd+($i-$alen)*86400)=='08-05-09') $num=4; + ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]); + + } + for($i=0;$i<=($m / 50);$i++){ + ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]); + ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]); + imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]); + imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]); + imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]); + imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]); + + imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]); + imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]); + imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]); + imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]); + } + + + $users = array( + 1 => array('name' => "Total posts ", 'color' => imagecolorallocate($img, 255, 255, 255)), + -1 => array('name' => "$alen-day average x 200", 'color' => 0xFF8888), +/* 50 => array('name' => "Hyperhacker ", 'color' => imagecolorallocate($img, 50, 255, 50)), + 61 => array('name' => "E. Prime ", 'color' => imagecolorallocate($img, 200, 200, 0)), + 18 => array('name' => "Hiryuu ", 'color' => imagecolorallocate($img, 255, 50, 50)), + 17 => array('name' => "NightKev ", 'color' => imagecolorallocate($img, 200, 0, 200)), +/ 5 => array('name' => "Hydrapheetz ", 'color' => imagecolorallocate($img, 50, 50, 255)), + 3 => array('name' => "cpubasic13 ", 'color' => imagecolorallocate($img, 0, 200, 255)), + 52 => array('name' => "Shadic ", 'color' => imagecolorallocate($img, 100, 50, 200)), + 57 => array('name' => "Kles ", 'color' => imagecolorallocate($img, 50, 200, 100)), + 12 => array('name' => "Dorito ", 'color' => imagecolorallocate($img, 200, 100, 50)), + + 36 => array('name' => "Erika ", 'color' => imagecolorallocate($img, 220, 100, 170)), + 100 => array('name' => "Kas ", 'color' => imagecolorallocate($img, 220, 170, 100)), + 117 => array('name' => "Rydain ", 'color' => imagecolorallocate($img, 220, 220, 79)), + 118 => array('name' => "Aiya ", 'color' => imagecolorallocate($img, 170, 150, 255)), + 175 => array('name' => "Tina ", 'color' => imagecolorallocate($img, 255, 100, 255)), + 387 => array('name' => "Acmlm ", 'color' => imagecolorallocate($img, 233, 190, 153)), + 49 => array('name' => "Dr. Sophie ", 'color' => imagecolorallocate($img, 193, 210, 233)), +*/ +// 2 => array('name' => "Drag ", 'color' => imagecolorallocate($img, 255, 0, 0)), + +); +/* + $users = array(); + $userq = $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10"); + while ($u = $sql -> fetch($userq)) { + $users[$u['id']] = array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255))); + } +*/ + + $z = count($users); + $namespace = 12; + + imagerectangle( $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]); + imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]); + imagerectangle( $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]); + + $z = 0; + + foreach($users as $uid => $userx) { + if ($uid > 0) { + $data = getdata($uid); + drawdata($data, $userx['color']); + } + imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]); + imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']); + imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]); + imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']); + $z++; + } + + foreach($xdata as $k => $v) { + $xdata2[$k - 13697] = ($v / 1); + } + + if (false) { + print "
days = $days \n\n\n";
+		print_r($data);
+		print "\n\n------------------------\n\n";
+		print_r($xdata2);
+		die();
+	}
+	drawdata($xdata2, $users[-1]['color']);
+ 
+ Header('Content-type:image/png');
+ ImagePNG($img);
+ ImageDestroy($img);
+
+
+ function drawdata($p, $color) {
+	 global $days, $scalex, $m, $img;
+	 $oldy	= $m;
+	 for($i=0;$i<$days;$i++){
+		$y		= $m-$p[$i];
+		$x		= $i * $scalex;
+		if (!$p[$i]) {
+			$y	 = $oldy;
+		}
+		imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
+		$oldy	= $y;
+
+	 }
+ }
+
+  function getdata($u) {
+	 global $sql, $dd, $dd2, $scaley, $days, $xdata, $alen;
+	 $nn	= $sql -> query("SELECT FROM_UNIXTIME(date,'%Y%m%d') ymd, floor(date/86400) d, count(*) c FROM posts  GROUP BY ymd ORDER BY ymd");
+
+	 while ($n = $sql -> fetch($nn)) {
+	   $p[$n['d']]=$n['c'];
+	   
+	   for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
+		$xdata[$n['d']]	+= $p[$temp];
+	   }
+	   $xdata[$n['d']]	/= $alen;
+	 
+	 }
+
+	$dat	= $sql -> query(
+		"SELECT count( * ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
+		."FROM posts "
+//		."WHERE user =$u "
+		."GROUP BY d ORDER BY d DESC");
+	while ($z = $sql -> fetch($dat)) {
+	   $da = $days - $z['d'];
+	   $y	+= $z['cnt'];
+	   $p[$da] = $y / $scaley;
+
+	 }
+	return $p;
+  }
+
+
+?>
\ No newline at end of file
diff --git a/activity3u.php b/activity3u.php
new file mode 100644
index 0000000..05e97ae
--- /dev/null
+++ b/activity3u.php
@@ -0,0 +1,206 @@
+ resultq("SELECT MIN(`regdate`) FROM users");
+
+// $val				= $sql -> resultq("SELECT COUNT(DISTINCT `user`) FROM `posts` GROUP BY FLOOR(`date` / 86400)");
+ $val				= 99;
+ $max				= ceil(($val + 1) / 50) * 50;
+ $alen				= ($_GET['len'] ? $_GET['len'] : 30);
+
+ $alen				= min(max(7, $alen), 90);
+// $max				= 5500;
+
+ $vd=date('m-d-y', $user['regdate']);
+ $dd=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
+ $dd2=mktime(0,0,0,substr($vd,0,2),substr($vd,3,2)+1,substr($vd,6,2));
+
+
+ $days=ceil((ctime()-$dd)/86400);
+ $scalex	= 2;
+ $scaley	= .2;
+ $m			= $max / $scaley;
+ $xs		= $days * $scalex;
+ $xsize		= $days * $scalex;
+
+ $img=ImageCreateTrueColor($xs,$m);
+
+ $c[bg]= ImageColorAllocate($img,  0,  0,  0);
+ $c[bg1]=ImageColorAllocate($img,  0,  0, 60);
+ $c[bg2]=ImageColorAllocate($img,  0,  0, 80);
+ $c[bg3]=ImageColorAllocate($img, 40, 40,100);
+ $c[bg4]=ImageColorAllocate($img,100, 40, 40);
+ $c[mk1]=ImageColorAllocate($img, 60, 60,130);
+ $c[mk2]=ImageColorAllocate($img, 80, 80,150);
+ $c[bar]=ImageColorAllocate($img,250,190, 40);
+ $c[pt] =ImageColorAllocate($img,250,250,250);
+ for($i=0;$i<$days;$i++){
+   $num=date('m',$dd+$i*86400)%2+1;
+   if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
+   ImageFilledRectangle($img,$i * $scalex,$m,($i + 1) * $scalex - 2,0,$c["bg$num"]);
+
+ }
+ for($i=0;$i<=($m / 50);$i++){
+   ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]);
+   ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]);
+   imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]);
+   imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]);
+   imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]);
+   imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]);
+
+   imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]);
+   imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]);
+   imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]);
+   imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]);
+ }
+
+
+	$users	= array(
+		  1 => array('name' => "Users active per day", 'color' =>  imagecolorallocate($img, 255, 255, 255)),
+		 -1 => array('name' => "$alen-day average", 'color' =>  0xFF8888),
+/*		 50 => array('name' => "Hyperhacker    ", 'color' =>  imagecolorallocate($img,  50, 255,  50)),
+		 61 => array('name' => "E. Prime       ", 'color' =>  imagecolorallocate($img, 200, 200,   0)),
+		 18 => array('name' => "Hiryuu         ", 'color' =>  imagecolorallocate($img, 255,  50,  50)),
+		 17 => array('name' => "NightKev       ", 'color' =>  imagecolorallocate($img, 200,   0, 200)),
+/		  5 => array('name' => "Hydrapheetz    ", 'color' =>  imagecolorallocate($img,  50,  50, 255)),
+		  3 => array('name' => "cpubasic13     ", 'color' =>  imagecolorallocate($img,   0, 200, 255)),
+		 52 => array('name' => "Shadic         ", 'color' =>  imagecolorallocate($img, 100,  50, 200)),
+		 57 => array('name' => "Kles           ", 'color' =>  imagecolorallocate($img,  50, 200, 100)),
+		 12 => array('name' => "Dorito         ", 'color' =>  imagecolorallocate($img, 200, 100,  50)),
+
+		 36 => array('name' => "Erika          ", 'color' =>  imagecolorallocate($img, 220, 100, 170)),
+		100 => array('name' => "Kas            ", 'color' =>  imagecolorallocate($img, 220, 170, 100)),
+		117 => array('name' => "Rydain         ", 'color' =>  imagecolorallocate($img, 220, 220,  79)),
+		118 => array('name' => "Aiya           ", 'color' =>  imagecolorallocate($img, 170, 150, 255)),
+		175 => array('name' => "Tina           ", 'color' =>  imagecolorallocate($img, 255, 100, 255)),
+		387 => array('name' => "Acmlm          ", 'color' =>  imagecolorallocate($img, 233, 190, 153)),
+		 49 => array('name' => "Dr. Sophie     ", 'color' =>  imagecolorallocate($img, 193, 210, 233)),
+*/
+//		  2 => array('name' => "Drag           ", 'color' =>  imagecolorallocate($img, 255,   0,   0)),
+
+);
+/*
+	$users	= array();
+	$userq	= $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
+	while ($u = $sql -> fetch($userq)) {
+		$users[$u['id']]	= array('name' => $u['name'], 'color' => imagecolorallocate($img, rand(100,255), rand(100,255), rand(100,255)));
+	}
+*/
+
+	$z	= count($users);
+	$namespace	= 12;
+
+	imagerectangle(      $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]);
+	imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]);
+	imagerectangle(      $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]);
+
+	$z	= 0;
+
+	foreach($users as $uid => $userx) {
+		if ($uid > 0) {
+			$data	= getdata($uid);
+			drawdata($data, $userx['color']);
+		}
+		imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]);
+		imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
+		imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]);
+		imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
+		$z++;
+	}
+
+	foreach($xdata as $k => $v) {
+		$xdata2[$k - 13697]	= ($v * 5);
+	}
+
+	if (0) {
+		print "
days = $days \n\n\n";
+		print_r($data);
+		print "\n\n------------------------\n\n";
+		print_r($xdata2);
+		die();
+	}
+	drawdata($xdata2, $users[-1]['color'], true, $users[-1]['color'] + 0x40000000);
+ 
+	Header('Content-type:image/png');
+	ImagePNG($img);
+	ImageDestroy($img);
+
+
+ function drawdata($p, $color, $derp = false, $color2 = false) {
+	 global $days, $scalex, $m, $img, $xs;
+	 $oldy	= $m;
+	 if ($derp) {
+		$points[]	= 0;
+		$points[]	= $m - 1;
+	 }
+	 for($i=0;$i<$days;$i++){
+		$y		= $m-$p[$i];
+		$x		= $i * $scalex;
+		if (!$p[$i]) {
+			$y	 = $oldy;
+		}
+		
+		if (!$derp) {
+			imageline($img, $x, $oldy, $x + $scalex - 1, $y, $color);
+			$oldy	= $y;
+		} elseif ($y != $m) {
+			$points[]	= $x;
+			$points[]	= $y;
+		}
+
+	 }
+	 if ($derp) {
+//		$points[]	= $xs;
+//		$points[]	= 499;
+//		$points[]	= 2769;
+//		$points[]	= 499;
+		$points[]	= $xs;
+		$points[]	= $y;
+		$points[]	= $xs;
+		$points[]	= $m - 1;
+		 imagefilledpolygon($img, $points, count($points) / 2, $color2);
+		 imagepolygon      ($img, $points, count($points) / 2, $color);
+	 }
+ }
+
+//SELECT COUNT(DISTINCT `user`) FROM `posts` GROUP BY FLOOR(`date` / 86400)
+
+  function getdata($u) {
+	 global $sql, $dd, $dd2, $scaley, $days, $xdata, $alen;
+	 $nn	= $sql -> query("SELECT FROM_UNIXTIME(date,'%Y%m%d') ymd, floor(date/86400) d,  count( DISTINCT `user`) c FROM posts GROUP BY ymd ORDER BY ymd");
+
+	 while ($n = $sql -> fetch($nn)) {
+	   $p[$n['d']]=$n['c'];
+	   
+	   for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
+		$xdata[$n['d']]	+= $p[$temp];
+	   }
+	   $xdata[$n['d']]	/= $alen;
+	 
+	 }
+
+/*
+	$dat	= $sql -> query(
+		"SELECT count( * ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
+		."FROM posts "
+//		."WHERE user =$u "
+		."GROUP BY d ORDER BY d DESC");
+*/
+	$dat	= $sql -> query(
+		"SELECT count( DISTINCT `user` ) AS cnt, floor( to_days( now( ) ) ) - floor( to_days( from_unixtime( date ) ) ) AS d "
+		."FROM posts "
+		."GROUP BY d ORDER BY d DESC");
+
+	while ($z = $sql -> fetch($dat)) {
+	   $da = $days - $z['d'];
+	   $y	+= $z['cnt'];
+	   $y	= $z['cnt'];
+	   $p[$da] = $y / $scaley;
+
+	 }
+	return $p;
+  }
+
+
+?>
\ No newline at end of file
diff --git a/admin-editforums.php b/admin-editforums.php
new file mode 100644
index 0000000..bf465eb
--- /dev/null
+++ b/admin-editforums.php
@@ -0,0 +1,386 @@
+query("INSERT INTO `forums` SET $values, `lastpostid` = '0'");
+		if (mysql_error()) die(mysql_error());
+		$id	= mysql_insert_id();
+		trigger_error("Created new forum \"$forumtitle\" with ID $id", E_USER_NOTICE);
+	} else {
+		$sql->query("UPDATE `forums` SET $values WHERE `id` = '". $_GET['id'] ."'");
+		if (mysql_error()) die(mysql_error());
+		$id	= $_GET['id'];
+		trigger_error("Edited forum ID $id", E_USER_NOTICE);
+	}
+
+	if ($_POST['edit'])
+		header("Location: ?id=". $id . $prevtext);
+	else
+		header("Location: ?".substr($prevtext, 1));
+
+	die();
+}
+elseif ($_POST['delete']) {
+	if (!$isadmin)
+		die("You aren't an admin!");
+
+	$id      = intval($_GET['delete']);
+	$mergeid = intval($_POST['mergeid']);
+
+	if (!isset($_GET['delete']) || $id < 0)
+		die("No forum selected to delete.");
+	if (!isset($_POST['mergeid']) || $mergeid < 0)
+		die("No forum selected to merge to.");
+
+	$counts = $sql->fetchq("SELECT `numthreads`, `numposts` FROM `forums` WHERE `id`='$id'");
+	$sql->query("UPDATE `threads` SET `forum`='$mergeid' WHERE `forum`='$id'") or die(mysql_error());
+	$sql->query("UPDATE `announcements` SET `forum`='$mergeid' WHERE `forum`='$id'") or die(mysql_error());
+	$sql->query("DELETE FROM `forummods` WHERE `forum`='$id'") or die(mysql_error());
+	$sql->query("DELETE FROM `forums` WHERE `id`='$id'") or die(mysql_error());
+
+	$lastthread = $sql->fetchq("SELECT * FROM `threads` WHERE `forum`='$mergeid' ORDER BY `lastpostdate` DESC LIMIT 1");
+	$sql->query("UPDATE `forums` SET
+		`numthreads`=`numthreads`+'{$counts['numthreads']}',
+		`numposts`=`numposts`+'{$counts['numposts']}',
+		`lastpostdate`='{$lastthread['lastpostdate']}',
+		`lastpostuser`='{$lastthread['lastposter']}',
+		`lastpostid`='{$lastthread['id']}'
+	WHERE `id`='$mergeid'") or die(mysql_error());
+
+	if (isset($_GET['preview']))
+		$prevtext = "preview=" . $_GET['preview'];
+
+	trigger_error("DELETED forum ID $id; merged into forum ID $mergeid", E_USER_NOTICE);
+
+	header("Location: ?$prevtext");
+	die();
+}
+
+$windowtitle = "Editing Forum List";
+require_once('lib/layout.php');
+
+print "$header
"; + +admincheck(); +print adminlinkbar('admin-editforums.php'); + +foreach($pwlnames as $pwl=>$pwlname) { + if ($pwl < 0) continue; + $powers[] = $pwlname; +} +$powers[] = '[no access]'; + +$pollstyles = array(-2 => 'Disallowed', + -1 => 'Normal', + 0 => 'Force Regular', + 1 => 'Force Influence'); + + +if (isset($_GET['delete'])) { + $forum = intval($_GET['delete']); + + $forums[-1] = "Choose a forum to merge into..."; + $forumquery = $sql->query("SELECT id,title FROM forums ORDER BY catid,forder"); + while ($f = $sql->fetch($forumquery, MYSQL_ASSOC)) + $forums[$f['id']] = $f['title']; + + if (array_key_exists($forum, $forums)) { + $fname = $forums[$forum]; + unset($forums[$forum]); + if (isset($_GET['preview'])) + $prevtext = "&preview=" . $_GET['preview']; + + echo " +
+ $tblstart + + $tccellh>Deleting $fname + + $tccellc>You are about to delete forum ID $forum.

+ All announcements and threads will be moved to the forum below.
+ ". dropdownList($forums, -1, "mergeid") . " + + $tccellc> or Cancel + +

"; + } +} +else if (isset($_GET['id'])) { + $catquery = $sql->query("SELECT id,name FROM categories ORDER BY id"); + while ($catres = $sql->fetch($catquery)) + $categories[$catres['id']] = $catres['name']; + + $forum = $sql->fetchq("SELECT * FROM `forums` WHERE `id` = '". $_GET['id'] . "'", MYSQL_ASSOC); + if (!$forum) + $_GET['id'] = -1; + + if ($forum && !array_key_exists($forum['catid'], $categories)) + $categories[$forum['catid']] = "Unknown category #" . $forum['catid']; + + if (isset($_GET['preview'])) + $prevtext = "&preview=" . $_GET['preview']; + + echo " +
+ $tblstart + + $tccellh colspan=6>Editing ". ($forum ? htmlspecialchars($forum['title']) : "a new forum") . " + + + + $tccellh>Forum Name + $tccell1l colspan=4> + $tccell1l width=10%> + + + + $tccellh rowspan=4>Description + $tccell1l rowspan=4 colspan=3>$txta=description ROWS=4 style=\"width: 100%; resize:none;\">". htmlspecialchars($forum['description']) ." + $tccellh colspan=2>Minimum power needed... + + + + $tccellh>...to view the forum + $tccell1l>". dropdownList($powers, $forum['minpower'], "minpower") . " + + + + $tccellh>...to post a thread + $tccell1l>". dropdownList($powers, $forum['minpowerthread'], "minpowerthread") . " + + + + $tccellh>...to reply + $tccell1l>". dropdownList($powers, $forum['minpowerreply'], "minpowerreply") . " + + + + $tccellh width='10%'>Number of Threads + $tccell1l width='24%'> + $tccellh width='10%'>Forum order + $tccell1l width='23%'> + $tccellh width='10%'>Poll Style + $tccell1l width='23%'>". dropdownList($pollstyles, $forum['pollstyle'], "pollstyle") . " + + + + $tccellh >Number of Posts + $tccell1l> + $tccellh >Special Scheme + $tccell1l> + $tccellh >Category + $tccell1l>". dropdownList($categories, $forum['catid'], "catid") . " + + + + $tccellc colspan=6>  + + +

"; +} + + $forumlist=" + + $tccellh width=90px>Actions + $tccellh>Forum + $tccellh width=80>Threads + $tccellh width=80>Posts + $tccellh width=15%>Last post + + "; + + if (isset($_GET['preview'])) { + $forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id WHERE (!minpower OR minpower<=$_GET[preview]) AND f.hidden = '0' ORDER BY catid,forder"); + $catquery = $sql->query("SELECT id,name FROM categories WHERE (!minpower OR minpower<=$_GET[preview]) ORDER BY id"); + $prevtext = "&preview=" . $_GET['preview']; + } + else { + $forumquery = $sql->query("SELECT f.*,u.id AS uid,name,sex,powerlevel FROM forums f LEFT JOIN users u ON f.lastpostuser=u.id ORDER BY catid,forder"); + $catquery = $sql->query("SELECT id,name FROM categories ORDER BY id"); + } + + $modquery = $sql->query("SELECT u.id,name,sex,powerlevel,forum FROM users u INNER JOIN forummods m ON u.id=m.user ORDER BY name"); + + $categories = array(); + $forums = array(); + $mods = array(); + + while ($res = $sql->fetch($catquery)) + $categories[] = $res; + while ($res = $sql->fetch($forumquery)) + $forums[] = $res; + while ($res = $sql->fetch($modquery)) + $mods[] = $res; + + $forumlist .= "< Create a new forum >"; + + foreach ($categories as $category) { + $forumlist.="$category[name]"; + + foreach ($forums as $forumplace => $forum) { + if ($forum['catid'] != $category['id']) + continue; + + $m = 0; + $modlist = ""; + foreach ($mods as $modplace => $mod) { + if ($mod['forum'] != $forum['id']) + continue; + + $namecolor=getnamecolor($mod['sex'],$mod['powerlevel']); + $modlist.=($m++?', ':'')."$mod[name]"; + unset($mods[$modplace]); + } + + if ($m) + $modlist="$smallfont(moderated by: $modlist)"; + + $namecolor = getnamecolor($forum['sex'],$forum['powerlevel']); + if($forum['numposts']){ + $forumlastpost="". date($dateformat,$forum['lastpostdate']+$tzoff); + $by="$smallfont
by $forum[name]". ($forum['lastpostid'] ? " ". $statusicons['getlast'] ."" : "") ."
"; + } else { + $forumlastpost=getblankdate(); + $by=''; + } + + if($forum['lastpostdate']>$category['lastpostdate']){ + $category['lastpostdate']=$forum['lastpostdate']; + $category['l']=$forumlastpost.$by; + } + + if ($forum['hidden']) + $hidden = " (hidden)"; + else + $hidden = ""; + + if ($_GET['id'] == $forum['id']) { + $tc1 = $tccellh; + $tc2 = $tccellh; + $tc2l = $tccellhl; + } + else { + $tc1 = $tccell1; + $tc2 = $tccell2; + $tc2l = $tccell2l; + } + + $forumlist.=" + + $tc1>Edit / Delete + $tc2l>$forum[title]$hidden
+ $smallfont$forum[description]
$modlist + $tc1>$forum[numthreads] + $tc1>$forum[numposts] + $tc2>$forumlastpost$by$forumlastuser + + "; + + unset($forums[$forumplace]); + } + } + +// Leftover forums +if (!isset($_GET['preview']) && count($forums)) { + $forumlist.="These forums are not associated with a valid category ID"; + + foreach ($forums as $forum) { + $m = 0; + foreach ($mods as $modplace => $mod) { + if ($mod['forum'] != $forum['id']) + continue; + + $namecolor=getnamecolor($mod['sex'],$mod['powerlevel']); + $modlist.=($m++?', ':'')."$mod[name]"; + unset($mods[$modplace]); + } + + if ($m) + $modlist="$smallfont(moderated by: $modlist)"; + + $namecolor = getnamecolor($forum['sex'],$forum['powerlevel']); + if($forum['numposts']){ + $forumlastpost="". date($dateformat,$forum['lastpostdate']+$tzoff); + $by="$smallfont
by $forum[name]". ($forum['lastpostid'] ? " ". $statusicons['getlast'] ."" : "") ."
"; + } else { + $forumlastpost=getblankdate(); + $by=''; + } + + if($forum['lastpostdate']>$category['lastpostdate']){ + $category['lastpostdate']=$forum['lastpostdate']; + $category['l']=$forumlastpost.$by; + } + + if ($forum['hidden']) + $hidden = " (hidden)"; + else + $hidden = ""; + + $forumlist.=" + + $tccell1>Edit / Delete + $tccell2l>$forum[title]$hidden
+ $smallfont$forum[description]
$modlist + $tccell1>$forum[numthreads] + $tccell1>$forum[numposts] + $tccell2>$forumlastpost$by$forumlastuser + + "; + } +} + +print "
Preview forums with powerlevel: ".previewbox()."
\n"; +print "$tblstart$forumlist$tblend$footer"; +printtimedif($startingtime); + +function dropdownList($links, $sel, $n) { + global $tccell1, $tccellc; + $r = ""; +} + +function previewbox(){ + if (isset($_GET['id'])) { + $idtxt = "id=" . $_GET['id'] . "&"; + $idtxt2 = "?id=" . $_GET['id']; + } + + return "
"; +} +?> diff --git a/admin-editmods.php b/admin-editmods.php new file mode 100644 index 0000000..30a1076 --- /dev/null +++ b/admin-editmods.php @@ -0,0 +1,133 @@ +"; + +admincheck(); +print adminlinkbar('admin-editmods.php'); + +$donotprint = false; +if ($action) { +// print "DEBUG: Asked to ".$action." a moderator of forum: ".${$action."modforum"}." and user: ".${$action."moduser"}; + $donotprint = true; + switch($action) { + case "remove": + $removemod = explode("|", $removemod); + $removemoduser = $removemod[1]; + $removemodforum = $removemod[0]; + + $sql->query("DELETE FROM forummods WHERE user='$removemoduser' AND forum='$removemodforum'"); + if(($err=mysql_error()) != "") + print "$tblstart$tccell1> ERROR: $err."; + else { + $sql->query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." removed mod $removemoduser from forum $removemodforum\", \"$userip\")"); + print "$tblstart$tccell1> You successfully deleted user $removemoduser from forum $removemodforum.
".redirect("admin-editmods.php",'go back to Edit Mods',0); + } + break; + case "add": + $sql->query("INSERT INTO forummods VALUES('$addmodforum', '$addmoduser')"); + if(($err=mysql_error()) != "") + print "$tblstart$tccell1> ERROR: $err."; + else { + $sql->query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." added mod $addmoduser to forum $addmodforum\", \"$userip\")"); + print "$tblstart$tccell1> You successfully added user $addmoduser to forum $addmodforum.
".redirect("admin-editmods.php",'go back to Edit Mods',0); + } + break; + default: + print "No, doofus."; + } +} + +if (!$donotprint) { + $forums=$sql->query("SELECT id,title,description,catid FROM forums ORDER BY catid"); + $fa=""; + $forumselect="\r\n"; + $forumselectforrem = "\r\n"; + while($forum=$sql->fetch($forums)) { + $m=0; + $modlist=""; + $forumselect.=""; + $mods=$sql->query("SELECT user FROM forummods WHERE forum=$forum[id]"); + if($mods) { + while($mod=$sql->fetch($mods)) { + $usermod=$sql->fetchq("SELECT aka,sex,powerlevel,name,id from users where id=$mod[user]"); + if($m) $modlist.=", "; + $modlist .= getuserlink($usermod); + $forumselectforrem.="\r\n"; + $m++; + } + } + if ($m) + $fa.=" + + $forum[id] + $forum[title] + $modlist + + "; + } + + $userlist = "\r\n"; + $users1=$sql->query("SELECT `id`, `name` FROM `users` WHERE `powerlevel` > '0' ORDER BY `name`"); + while($user=$sql->fetch($users1)) + $userlist.="\r\n"; + +print " + +$tblstart +ID +Forum Name +Moderators$fa$tblend + +
$inph=\"action\" value=\"add\">
$tblstart". +/* + $tccellh>$smallfont Delete a mod. + $tccellh>$smallfont Add Moderator. + + + + $tccell1> User ID: +$tccell1> User ID: + + + $tccell1> Forum ID: +$tccell1> Forum ID: + + + $tccell1> +$tccell1> */ +"$tccellh colspan=\"2\">Add Moderator: +$tccell1 width=15%>Forum:$tccell2l width=85%> +$tccell1 width=15%>User:$tccell2l width=85%> $smallfont(note: this only shows Member+ and above) +$tccell1 width=15%> $tccell2l width=85%>$inps=\"addmodsubmit\" value=\"Add Moderator\">$tblend" +. + +/* + $tccellh>$smallfont Delete a mod. + $tccellh>$smallfont Add Moderator. + + + + $tccell1> User ID: +$tccell1> User ID: + + + $tccell1> Forum ID: +$tccell1> Forum ID: + + + $tccell1> +$tccell1> */ +($forumselectforrem!=""?"
$inph=\"action\" value=\"remove\">$tblstart"."$tccellh colspan=\"2\">Remove Moderator: +$tccell1 width=15%>Forum and Moderator:$tccell2l width=85%> +$tccell1 width=15%> $tccell2l width=85%>$inps=\"removemodsubmit\" value=\"Remove Moderator\">$tblend
":""); + +} + +print $footer; +printtimedif($startingtime); + +?> diff --git a/admin-slammer.php b/admin-slammer.php new file mode 100644 index 0000000..99447e1 --- /dev/null +++ b/admin-slammer.php @@ -0,0 +1,73 @@ +"; +echo "
"; + +admincheck(); +//print adminlinkbar('admin-slammer.php'); + +$target_id = $sql->resultq('SELECT id FROM users ORDER BY id DESC LIMIT 1'); +$uinfo = $sql->fetchq("SELECT name, lastip FROM users WHERE id = '{$target_id}'"); + +if ($_POST['knockout'] && $_POST['knockout'] != $target_id) +{ + echo "Whoops! Someone else took that user to the slammer before you did.\n"; + echo "\n
".redirect("admin-slammer.php", 'the slammer (for another go)', 2); + die(); +} +else if ($_POST['knockout']) +{ + echo "SLAM JAM:\n"; + + $sql->query("DELETE FROM threads WHERE user = '{$target_id}' LIMIT 50"); + echo "Deleted threads.\n"; + + $sql->query("DELETE FROM posts_text WHERE pid IN (SELECT id FROM posts WHERE user = '{$target_id}') LIMIT 50"); + $sql->query("DELETE FROM posts WHERE user = '{$target_id}' LIMIT 50"); + echo "Deleted posts.\n"; + + $sql->query("DELETE FROM users WHERE id = '{$target_id}' LIMIT 1"); + $sql->query("DELETE FROM users_rpg WHERE uid = '{$target_id}' LIMIT 1"); + echo "Deleted user data.\n"; + + $new_maxid = intval($sql->resultq("SELECT id FROM users ORDER BY id DESC LIMIT 1")); + $sql->query("ALTER TABLE users AUTO_INCREMENT = {$new_maxid}"); + echo "Max ID set to {$new_maxid}.\n"; + + @$sql->query("INSERT INTO `ipbans` SET `ip` = '". $uinfo['lastip'] ."', `date` = '". ctime() ."', `reason` = 'Thanks for playing!'"); + echo "Delivered IP ban to {$uinfo['lastip']}.\n"; + + xk_ircsend("1|". xk(8) . $uinfo['name'] . xk(7). " (IP " . xk(8) . $uinfo['lastip'] . xk(7) .") is the latest victim of the new EZ BAN button(tm)."); + + echo "\n".redirect("admin-slammer.php", 'the slammer (for another go)', 2); + die(); +} +else +{ + $threads = $sql->getarraybykey("SELECT id, forum, title FROM threads WHERE user = '{$target_id}'", 'id'); + $posts = $sql->getarraybykey("SELECT id, thread FROM posts WHERE user = '{$target_id}'", 'id'); + + $ct_threads = count($threads); + $ct_posts = count($posts); + + echo "Up on the chopping block today is \"{$uinfo['name']}\".\n\n"; + echo "Their last known IP address is \"{$uinfo['lastip']}\".\n\n"; + + echo "They have made {$ct_threads} thread(s):\n"; + foreach ($threads as $th) + echo "{$th['id']}: {$th['title']} (in forum {$th['forum']})\n"; + + echo "\nThey have made {$ct_posts} post(s):\n"; + foreach ($posts as $po) + echo "{$po['id']}: in thread {$po['thread']}\n"; + + ?> + + Press the button? +
+ "; + + if (!$isadmin) { + + print " + $tblstart + $tccell1>This feature is restricted. + $tblend + + $footer + "; + printtimedif($startingtime); + die(); + } + + + print adminlinkbar("admin-threads.php"); + + if (!$_POST['run']) { + print "
+ $tblstart + $tccellh>Thread Repair System + $tccell1>  +
This page is intended to repair threads with broken reply counts. Please don't flood it with requests. +
This problem causes \"phantom pages\" (e.g., too few or too many pages displayed). +
  +
$inps=\"run\" value=\"Start\"> +
  + + $tblend +
+ "; + } else { + + print " + $tblstart + $tccellh>Thread Repair System + $tccell1>Now running. + + $tblend +
+ $tblstart + + $tccellh>id# + $tccellh>Name + $tccellh>Reports + $tccellh>Real + $tccellh>Err + $tccellh>Status + + "; + + $q = "SELECT `posts`.`thread`, (COUNT(`posts`.`id`)) AS 'real', ((COUNT(`posts`.`id`) - 1) - `threads`.`replies`) AS 'offset', `threads`.`replies`, `threads`.`title` AS `threadname` FROM `posts` LEFT JOIN `threads` ON `posts`.`thread` = `threads`.`id` GROUP BY `thread` ORDER BY `offset` DESC"; + $sql = mysql_query($q) or die(mysql_error()); + + $count = ""; + while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) { + + $status = ""; + + if ($data['offset'] != 0) { + + if ($data['offset'] >= 10000000) { + $data['offset'] = ($data['real'] - 1) - $data['replies']; +// $status = "First post missing or otherwise broken"; +// $data['offset'] = " "; + } + + if (!$status) { + $status = mysql_query("UPDATE `threads` SET `replies` = '". ($data['real'] - 1) ."' WHERE `id` = '". $data['thread'] ."'") or "Error: ". mysql_error(); + if ($status == 1) $status = "Updated"; +// $status = "Not updated"; + $count++; + } + + print " + + $tccell1>". $data['thread'] ." + $tccell2l>". $data['threadname'] ." + $tccell1r>". $data['replies'] ." + $tccell1r>". $data['real'] ." + $tccell2r>". $data['offset'] ." + $tccell1l>$status + "; + + } else { + break; + } + } + + if ($count) { + print "$tccellc colspan=6>$count thread". ($count != 1 ? "s" : "") ." updated."; + } else { + + print " $tccell1 colspan=6>  +
No problems found. +
  + "; + } + } + + + print "$tblend + $footer + "; + printtimedif($startingtime); +?> diff --git a/admin-threads2.php b/admin-threads2.php new file mode 100644 index 0000000..8b9a2f6 --- /dev/null +++ b/admin-threads2.php @@ -0,0 +1,108 @@ +"; + + if (!$isadmin) { + + print " + $tblstart + $tccell1>This feature is restricted. + $tblend + + $footer + "; + printtimedif($startingtime); + die(); + } + + print adminlinkbar("admin-threads2.php"); + + if (!$_POST['run']) { + print "
+ $tblstart + $tccellh>Thread Repair System II + $tccell1>  +
This page is intended to repair threads with broken 'last reply' times/users. +
This problem causes bumped threads that shouldn't be, especially with badly deleted posts. +
  +
$inps=\"run\" value=\"Start\"> +
  + + $tblend +
+ "; + } else { + + print " + $tblstart + $tccellh>Thread Repair System II + $tccell1>Now running. + + $tblend +
+ $tblstart + + $tccellh>id# + $tccellh>Name + $tccellh>Reported Date + $tccellh>Real Date + $tccellh>Difference + $tccellh>Status + + "; + + + + $q = "SELECT `threads`.`id`, `threads`.`title` , `threads`.`lastpostdate` , `posts`.`date` as realdate, (`posts`.`date` - `threads`.`lastpostdate`) AS `diff` FROM `threads` LEFT JOIN (SELECT MAX(`date`) as `date`, `thread` FROM `posts` GROUP BY `thread`) as `posts` ON `posts`.`thread` = `threads`.`id` ORDER BY `diff` DESC"; + $sql = mysql_query($q) or die(mysql_error()); + + $count = ""; + while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) { + + $status = ""; + + if ($data['lastpostdate'] != $data['realdate']) { + + if ($data['lastpostdate'] == "0" && $data['realdate'] == NULL) { + $status = "Broken thread"; + } else { + + $userd = mysql_fetch_array(mysql_query("SELECT `date`, `user` FROM `posts` WHERE `thread` = '". $data['id'] ."' ORDER BY `date` DESC LIMIT 1"), MYSQL_ASSOC); + $status = mysql_query("UPDATE `threads` SET `lastposter` = '". $userd['user'] ."', `lastpostdate` = '". $userd['date'] ."' WHERE `id` = '". $data['id'] ."'") or "Error: ". mysql_error(); + if ($status == 1) $status = "Updated"; + $count++; + } + } + + if ($status) { + + print " + + $tccell1>". $data['id'] ." + $tccell2l>". $data['title'] ." + $tccell1>". ($data['lastpostdate'] ? date($dateformat, $data['lastpostdate'] + $tzoff) : "-") ." + $tccell1>". ($data['realdate'] ? date($dateformat, $data['realdate'] + $tzoff) : "-") ." + $tccell1>". timeunits2($data['lastpostdate'] - $data['realdate']) ." + $tccell2l>$status + "; + } + } + + if ($count) { + print "$tccellc colspan=6>$count thread". ($count != 1 ? "s" : "") ." updated."; + } else { + print "$tccellc colspan=6>Nothing to repair."; + } + } + + + print "$tblend + $footer + "; + printtimedif($startingtime); +?> diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..e57f020 --- /dev/null +++ b/admin.php @@ -0,0 +1,122 @@ +"; + + if (!$isadmin) { + + print " + $tblstart + $tccell1>Uh oh, you are not the admin go away. + $tblend + + $footer + "; + printtimedif($startingtime); + die(); + } + + + $misc = $sql -> fetchq("SELECT * FROM `misc`"); + + print adminlinkbar("admin.php") ." + $tblstart + $tccellh>Panel de Admin
+ $tccell1>  +
Under construction for +
". timeunits2(time() - mktime(19, 20, 21, 9, 27, 2007)) ." +
...and counting! +
  + + $tblend + +
+ +
+ $tblstart + $tccellh colspan=2>Setting up the Soft Dip + $tccellc colspan=2>Board settings + + $tccell1 width='200'>". $statusicons['hot'] ." threshold + $tccell2l> $inpt='hotcount' value='". $misc['hotcount'] ."' class='right'> replies + $inph='hotcount_' value='". $misc['hotcount'] ."'> + + + $tccell1 width='200'>Disable forum? + $tccell2l> $inpc='disable' value='1'> Disable + + + + $tccellc colspan=2>Records + + $tccell1 width='200'>View count + $tccell2l> $inpt='views' value='". $misc['views'] ."' class='right'> views + $inph='views' value='". $misc['views'] ."'> + + + + $tccell1 width='200'>Max posts/day + $tccell2l> $inpt='maxpostsday' value='". $misc['maxpostsday'] ."' class='right'> posts, at $inpt='maxpostsdaydate' value='". $misc['maxpostsdaydate'] ."' class='right'> + $inph='maxpostsday' value='". $misc['maxpostsday'] ."'>$inph='maxpostsdaydate' value='". $misc['maxpostsdaydate'] ."'> + + + $tccell1 width='200'>Max posts/hour + $tccell2l> $inpt='maxpostshour' value='". $misc['maxpostshour'] ."' class='right'> posts, at $inpt='maxpostshourdate' value='". $misc['maxpostshourdate'] ."' class='right'> + $inph='maxpostshour' value='". $misc['maxpostshour'] ."'>$inph='maxpostshourdate' value='". $misc['maxpostshourdate'] ."'> + + + $tccell1 width='200'>Most users online + $tccell2l> $inpt='maxusers' value='". $misc['maxusers'] ."' class='right'> users, at $inpt='maxusersdate' value='". $misc['maxusersdate'] ."' class='right'> +
$inpc='maxusersreset' value='1'> Reset user list + $inph='maxusers' value='". $misc['maxusers'] ."'>$inph='maxusersdate' value='". $misc['maxusersdate'] ."'> + + + + $tccellc colspan=2>
Monetary settings + + $tccell1 width='200'>Donations + $tccell2l> $inpt='donations' value='". sprintf("%01.2f", $misc['donations']) ."' class='right'>$ + $inph='donations' value='". sprintf("%01.2f", $misc['donations']) ."'> + + + $tccell1 width='200'>$$$ Ads $$$ + $tccell2l> $inpt='ads' value='". sprintf("%01.2f", $misc['ads']) ."' class='right'>$ + $inph='ads' value='". sprintf("%01.2f", $misc['ads']) ."'> + + + + $tccellc colspan=2>  + + $tccell1 width='200'>  + $tccell2l> $inps='submit' value='Submit changes'> +
(Only saves the money settings though.) just kidding, it doesn't work. + + + + $tblend +
+ + "; + + + + print "$footer"; + printtimedif($startingtime); + + + // returns several field names with hours/date/time all set up and that jazz etc blah blah blah + function timetofields($fname, $time) { + + + + return; + } + + + + + +?> diff --git a/adnonsense.php b/adnonsense.php new file mode 100644 index 0000000..b1e69a7 --- /dev/null +++ b/adnonsense.php @@ -0,0 +1,154 @@ + fetchq("SELECT `donations`, `ads`, `valkyrie` FROM `misc`"); + $bonusr = 0; + $bonusg = 0; + $bonusb = 0; + + if ($_GET['m'] == "d") { + $money = $data['donations']; + $text = "Donations"; + $textc = imagecolorallocatealpha($img, 80, 200, 80, 40); + if ($money >= 120) { + $money -= 120; + $bonusr = -.5; + $bonusg = .1; + $bonusb = -.5; + $bonusm = 120; + } + } elseif ($_GET['m'] == "t") { + $money = $data['donations'] + $data['ads']; + $text = "Total"; + $textc = imagecolorallocatealpha($img, 140, 140, 255, 40); + if ($money >= 120) { + $money = min(120, $data['donations']) + $data['ads'] - 120; // Extra donations don't count towards extra funding +// $money = $data['donations'] + $data['adsense'] - 120; +// $text = "Extra!"; + $bonusr = -.5; + $bonusg = -.5; + $bonusb = .3; + } + + } elseif ($_GET['m'] == "v") { + $money = $data['valkyrie']; + $text = "VPS fund"; + $textc = imagecolorallocatealpha($img, 140, 140, 255, 40); + if ($money >= 120) { + $money -= 120; + $bonusr = -.5; + $bonusg = -.5; + $bonusb = .3; + } + } else { + $money = $data['ads']; + $text = "Ad rev."; + $textc = imagecolorallocatealpha($img, 255, 80, 80, 40); + if ($money >= 120) { + $money -= 120; + $bonusr = .3; + $bonusg = -.3; + $bonusb = -.3; + $bonusm = 120; + } + } + + + for ($i = 0; $i < 600; $i++) { + $c = floor($i / 600 * 100) + 27; + if ($i % 50 == 0) $c = floor($c * 0.8); + if ($i >= 597) $c = floor($c * (1.3 + ($i == 599 ? 0.4 : 0.0))); + if ($i <= 2) $c = floor($c * (1.3 + ($i == 0 ? 0.4 : 0.0))); + + fillbar($img, $i, $c * (1 + $bonusr ), $c * (1 + $bonusg ), $c * (1 + $bonusb )); + } + + $max = min(600, ($money / 120) * 600); + + for ($i = 0; $i < $max; $i++) { + if ($_GET['m'] == "d") { // Donations use a different color scheme + $r = 20 + floor($i / 600 * 100); + $g = 80 + floor($i / 600 * 170); + $b = 25 + floor($i / 600 * 110); + } elseif ($_GET['m'] == "t" || $_GET['m'] == "v") { + $b = 100 + floor($i / 600 * 150); + $g = 20 + floor($i / 600 * 60); + $r = 25 + floor($i / 600 * 80); + } else { + $r = 100 + floor($i / 600 * 150); + $g = 20 + floor($i / 600 * 60); + $b = 25 + floor($i / 600 * 80); + } + if ($i % 50 == 0 && $i <= $max - 3) { + $r = floor($r * 0.8); + $g = floor($g * 0.8); + $b = floor($b * 0.8); + } elseif ($i >= $max - 3) { + $r = floor($r * (1.3 + ($i == $max - 1 ? 0.4 : 0.0))); + $g = floor($g * (1.3 + ($i == $max - 1 ? 0.4 : 0.0))); + $b = floor($b * (1.3 + ($i == $max - 1 ? 0.4 : 0.0))); + } elseif ($i <= 2) { + $r = floor($r * (1.3 + ($i == 0 ? 0.4 : 0.0))); + $g = floor($g * (1.3 + ($i == 0 ? 0.4 : 0.0))); + $b = floor($b * (1.3 + ($i == 0 ? 0.4 : 0.0))); + } + + + fillbar($img, $i, $r, $g, $b); +/* imageline($img, $i + 1, 20, $i + 20, 1, 0x010101 * $c); + imagesetpixel($img, $i + 20, 1, 0x010101 * min(255, floor($c * 1.7))); + imagesetpixel($img, $i + 19, 2, 0x010101 * min(255, floor($c * 1.3))); + imagesetpixel($img, $i + 2, 19, 0x010101 * min(255, floor($c * 1.3))); + imagesetpixel($img, $i + 1, 20, 0x010101 * min(255, floor($c * 1.7))); +*/ } + + $s = sprintf("\$%01.2f", $money + $bonusm); + if ($max > 50) { + $s = str_pad($s, 7, " ", STR_PAD_LEFT); + $x = $max - 41; + } else { + $x = $max + 12; + } + imagestring($img, $font, $x + 1, 13, $s, 0x000000); + imagestring($img, $font, $x, 12, $s, 0xffffff); + + imagealphablending($img, true); + + imagestring($img, $font, 21, 3, $text, $textc); + + + header("Content-type: image/png;"); + imagepng($img); + imagedestroy($img); + + + function fillbar($img, $i, $r, $g, $b) { + $r = min(255, $r); + $g = min(255, $g); + $b = min(255, $b); + imageline($img, $i + 1, 20, $i + 20, 1, imagecolorallocate($img, $r, $g, $b)); + imagesetpixel($img, $i + 20, 1, imagecolorallocate($img, min(255, floor($r * 1.7)), min(255, floor($g * 1.7)), min(255, floor($b * 1.7)))); + imagesetpixel($img, $i + 19, 2, imagecolorallocate($img, min(255, floor($r * 1.3)), min(255, floor($g * 1.3)), min(255, floor($b * 1.3)))); + imagesetpixel($img, $i + 2, 19, imagecolorallocate($img, min(255, floor($r * 1.3)), min(255, floor($g * 1.3)), min(255, floor($b * 1.3)))); + imagesetpixel($img, $i + 1, 20, imagecolorallocate($img, min(255, floor($r * 1.7)), min(255, floor($g * 1.7)), min(255, floor($b * 1.7)))); + return; + } \ No newline at end of file diff --git a/announcement.php b/announcement.php new file mode 100644 index 0000000..6e08422 --- /dev/null +++ b/announcement.php @@ -0,0 +1,206 @@ +0)); + if($_GET[action]=='edit' or $_POST[action]=='editannc'){ + $annc=mysql_fetch_array(mysql_query("SELECT * FROM announcements WHERE id=$id")); + if($annc[forum]>0 && $ismod) $canpost=true; + } + $smilies=readsmilies(); + if(!$action){ + loadtlayout(); + $ppp=($log?$loguser[postsperpage]:20); + $min=$ppp*$page; + if ($loguser['id'] && $f == 0) { + mysql_query("UPDATE `users` SET `lastannouncement` = (SELECT MAX(`id`) FROM `announcements` WHERE `forum` = 0) WHERE `id` = '". $loguser['id'] ."'"); + } + $anncs=mysql_query("SELECT a.*,u.*,a.title atitle,u.id uid FROM announcements a,users u WHERE forum=$f AND a.user=u.id ORDER BY a.id DESC LIMIT $min,$ppp"); + $annctotal=@mysql_result(mysql_query("SELECT count(*) FROM announcements WHERE forum=$f"),0,0); + $pagelinks=$smallfont.'Pages:'; + for($i=0;$i<($annctotal/$ppp);$i++){ + if($i==$page) $pagelinks.=' '.($i+1); + else $pagelinks.=" ".($i+1).''; + } + $annclist="$tccellh width=150>User$tccellh colspan=2>Announcement"; + while($annc=mysql_fetch_array($anncs)){ + if($annccount) $annclist.=''; + $annccount++; + $bg=$bg%2+1; + $edit=' '; + if($isadmin or ($ismod && $f)){ + $edit="Edit | Delete"; + if($isadmin) $ip=" | IP: $annc[3]"; + } + if($loguser[viewsig]==2){ + $annc[headtext]=$annc[postheader]; + $annc[signtext]=$annc[signature]; + } + $annc[text]="
$annc[atitle]

$annc[text]"; + $annclist.=threadpost($annc,$bg); + } + } + if($canpost){ + if($_GET[action]=='delete'){ + mysql_query("DELETE FROM announcements WHERE id=$id"); + $annclist.=" + $tccell1>Announcement deleted. +
".redirect("announcement.php?f=$f",'return to the announcements',0); + } + if($_GET[action]=='new'){ + $annclist=" +
+ $tccellh width=150> $tccellh>  + $tccell1>Announcement title:$tccell2l>$inpt=subject SIZE=70 MAXLENGTH=100> + $tccell1>Announcement: $tccell2l>$txta=message ROWS=20 COLS=$numcols> + $tccell1>  $tccell2l>$inph=action VALUE=postannc>$inph=f VALUE=$f> + $inps=submit VALUE=\"Post announcement\"> + $inps=preview VALUE=\"Preview announcement\">
+ "; + } + if($_GET[action]=='edit'){ + if(!$annc[headid]) $head=$annc[headtext]; + else $head=mysql_result(mysql_query("SELECT text FROM postlayouts WHERE id=$annc[headid]"),0,0); + if(!$annc[signid]) $sign=$annc[signtext]; + else $sign=mysql_result(mysql_query("SELECT text FROM postlayouts WHERE id=$annc[signid]"),0,0); + sbr(1,$annc[text]); + sbr(1,$head); + sbr(1,$sign); + $annclist=" +
+ $tccellh width=150> $tccellh>  + $tccell1>Announcement title:$tccell2l>$inpt=subject VALUE=\"$annc[title]\" SIZE=70 MAXLENGTH=100> + $tccell1>Header: $tccell2l>$txta=head ROWS=8 COLS=$numcols>$head + $tccell1>Announcement: $tccell2l>$txta=message ROWS=12 COLS=$numcols>$annc[text] + $tccell1>Signature: $tccell2l>$txta=sign ROWS=8 COLS=$numcols>$sign + $tccell1>  $tccell2l> + $inph=action VALUE=editannc> + $inph=f VALUE=$annc[forum]> + $inph=id VALUE=$id> + $inph=edited VALUE=\"$annc[edited]\"> + $inps=submit VALUE=\"Edit announcement\"> + $inps=preview VALUE=\"Preview announcement\">
+ "; + } + if($_POST[action]=='postannc'){ + $userid = $loguserid; + $user = $loguser; + if($userid!=-1){ + $sign=$user[signature]; + $head=$user[postheader]; + if($user[postbg]) $head="
$head"; + $numposts=$user[posts]; + $numdays=(ctime()-$user[regdate])/86400; + $message=doreplace($message,$numposts,$numdays,$user['name']); + $rsign=doreplace($sign,$numposts,$numdays,$user['name']); + $rhead=doreplace($head,$numposts,$numdays,$user['name']); + squot(0,$subject); + $currenttime=ctime(); + if($submit){ + if(!$f) $f=0; + $headid=getpostlayoutid($head); + $signid=getpostlayoutid($sign); + mysql_query("INSERT INTO `announcements` (`user`, `date`, `ip`, `title`, `forum`, `text`, `headid`, `signid`, `tagval`) VALUES ('$userid', '$currenttime', '$userip', '$subject', '$f', '$message', '$headid', '$signid', '$tagval')"); + $annclist=" + $tccell1>Thank you, $user[name], for posting your announcement.
+ ".redirect("announcement.php?f=$f","the announcements",0).""; + }else{ + loadtlayout(); + $ppost=$user; + $ppost[uid]=$userid; + $ppost[date]=$currenttime; + $ppost[headtext]=$rhead; + $ppost[signtext]=$rsign; + $ppost[text]="
". stripslashes($subject) ."

". stripslashes($message); + if($isadmin) $ip=$userip; + $annclist=" + + $tccellh>Announcement preview + $tblend$tblstart + ".threadpost($ppost,1)." + $tblend
$tblstart +
+ $tccellh width=150> $tccellh>  + $tccell1>Announcement title:$tccell2l>$inpt=subject SIZE=70 MAXLENGTH=100 VALUE=\"". stripslashes($subject) ."\"> + $tccell1>Announcement: $tccell2l>$txta=message ROWS=10 COLS=$numcols>". stripslashes($message) ." + $tccell1> $tccell2l> + $inps=submit VALUE=\"Submit announcement\"> + $inps=preview VALUE=\"Preview announcement\"> + $inph=action VALUE=postannc> + $inph=f VALUE=$f> + + "; + } + }else + $annclist=" + $tccell1>Couldn't enter the announcement. You haven't entered the right username or password. + ".redirect('announcement.php','return to the announcements',0); + } + if($_POST[action]=='editannc'){ + print $tblstart; + $numposts=$loguser[posts]; + $numdays=(ctime()-$loguser[regdate])/86400; + $message=doreplace($message,$numposts,$numdays,$loguser[name]); + + $namecolor = getnamecolor($loguser['sex'], $loguser['powerlevel']); + $edited ="$loguser[name]"; + + if($submit){ + $headid=@mysql_result(mysql_query("SELECT id FROM postlayouts WHERE text='$head' LIMIT 1"),0,'id'); + $signid=@mysql_result(mysql_query("SELECT id FROM postlayouts WHERE text='$sign' LIMIT 1"),0,'id'); + if($headid) $head=''; else $headid=0; + if($signid) $sign=''; else $signid=0; + mysql_query("UPDATE announcements SET title='$subject', text='$message', headtext='$head', signtext='$sign', edited='$edited', editdate='".ctime()."',headid=$headid,signid=$signid WHERE id=$id"); + $annclist=" + $tccell1>Thank you, ".$loguser[name].", for editing the announcement.
+ ".redirect("announcement.php?f=$f","go to the announcements",0); + }else{ + loadtlayout(); + $annc=mysql_fetch_array(mysql_query("SELECT * FROM announcements WHERE id=$id")); + $ppost=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$annc[user]")); + $subject = stripslashes($subject); + $message = stripslashes($message); + $head = stripslashes($head); + $sign = stripslashes($sign); + $ppost['uid']=$annc[user]; + $ppost['date']=$annc[date]; + $ppost['tagval']=$annc[tagval]; + $ppost['headtext']=$head; + $ppost['signtext']=$sign; + $ppost['text']="
$subject

$message"; + + $ppost['edited'] = $edited; + $ppost['editdate'] = ctime(); + + if($isadmin) $ip=$annc['ip']; + $annclist=" + + $tccellh>Announcement preview + $tblend$tblstart + ".threadpost($ppost,1)." + $tblend
$tblstart +
+ $tccellh width=150> $tccellh>  + $tccell1>Announcement title:$tccell2l>$inpt=subject VALUE=\"$subject\" SIZE=70 MAXLENGTH=100> + $tccell1>Header: $tccell2l>$txta=head ROWS=4 COLS=$numcols>$head + $tccell1>Announcement: $tccell2l>$txta=message ROWS=6 COLS=$numcols>$message + $tccell1>Signature: $tccell2l>$txta=sign ROWS=4 COLS=$numcols>$sign + $tccell1> $tccell2l> + $inps=submit VALUE=\"Edit announcement\"> + $inps=preview VALUE=\"Preview announcement\"> + $inph=action VALUE=editannc> + $inph=id VALUE=$id> + $inph=f VALUE=$f> + + "; + } + } + $postnew="Post new announcement"; + } + print "$header +
$fonttag$boardname - Announcements$smallfont$postnew
+ $pagelinks$tblstart$annclist$tblend$pagelinks$footer + "; + printtimedif($startingtime); +?> \ No newline at end of file diff --git a/avatar.php b/avatar.php new file mode 100644 index 0000000..47a66c3 --- /dev/null +++ b/avatar.php @@ -0,0 +1,72 @@ + "neutral", "angry", "tired/upset", "playful", "doom", "delight", "guru", "hope", "puzzled", "whatever", "hyperactive", "sadness", "bleh", "embarrassed", "amused", "afraid"); + +$me = false; +$form = 'Preview mood avatar for user...
+
"; + +if ($me) { + $script = ' + + '; + + $ret = "$tccellh colspan=2>$me[name]: ".htmlspecialchars($me['moodurl']).""; + $ret .= "$tccell1l width=200px>Mood avatar list:
"; + + foreach($a as $num => $name) { + $jsclick = "onclick='avatarpreview($me[id],$num)'"; + $selected = (($num == 1) ? ' checked' : ''); + $ret .= " +
\r\n"; + } + + $startimg = htmlspecialchars(str_replace('$', '1', $me['moodurl'])); + + $ret .= "$tccell2 width=400px>"; + +} +else { + $script = ''; + $ret = ''; +} + print " +Mood Avatar Preview +$body +$css +$script +
+ $tccellh colspan=2>$form + $ret + $tblend +
+ $tblstart +
+"; +?> \ No newline at end of file diff --git a/biggestposters.php b/biggestposters.php new file mode 100644 index 0000000..6f56358 --- /dev/null +++ b/biggestposters.php @@ -0,0 +1,81 @@ +resultq("SELECT bigpostersupdate FROM misc") <= ctime()-(3600 * 8)) { + $sql->query("TRUNCATE biggestposters"); + $sql->query("INSERT INTO biggestposters " + ."(id, posts, waste) " + ."SELECT u.id, u.posts, SUM(LENGTH(pt.`text`)) " + ."FROM `posts` p " + ."LEFT JOIN `users` u ON p.user = u.id " + ."LEFT JOIN `posts_text` pt on p.id = pt.pid " + ."WHERE (u.posts >= 5 OR u.posts < 0) GROUP BY p.user"); + $sql->query("UPDATE biggestposters SET average = waste / posts"); + $sql->query("UPDATE misc SET bigpostersupdate = ".ctime()); + } + $posters = $sql->query("SELECT bp.*, u.name, u.regdate, u.minipic, u.sex, u.powerlevel FROM biggestposters bp LEFT JOIN users u ON bp.id=u.id ORDER BY $sort DESC"); + + print " + $header + +
+ + $tblstart + $tccellc colspan=7>Biggest posters, $headertext + + $tccellh width=30># + $tccellh colspan=2>Username + $tccellh width=200>Registered on + $tccellh width=130>Posts + $tccellh width=130>Size + $tccellh width=130>Average + "; + + for($i=1; $user = $sql -> fetch($posters); $i++) { + + if($i == 1) $max = $user['waste']; + if ($user['waste'] != $oldcnt) $rank = $i; + $oldcnt = $user['waste']; + $namecolor=getnamecolor($user['sex'],$user['powerlevel']); + + $col = ""; + if ($user['average'] >= 500) $col = "#88ff88"; + if ($user['average'] >= 750) $col = "#8888ff"; + if ($user['average'] <= 200) $col = "#ffff80"; + if ($user['average'] <= 100) $col = "#ff8080"; + if ($user['average'] <= 0) $col = "#888888"; + + $avgc = number_format(abs($user['average']), 1); + if ($col) $avgc = "$avgc"; + + + + print " + + $tccell1>$rank + $tccell1 width=16>". ($user['minipic'] ? "" : " ") ." + $tccell2l>". $user['name'] ." + $tccell1>".date($dateformat, $user['regdate'] + $tzoff) ." + $tccell1r>". $user['posts'] ." + $tccell1r>". number_format($user['waste']) ." + $tccell2r>". $avgc ." + "; + } + + print " + $tblend + + $smallfont(Note: this doesn't take into account quotes, joke posts, or other things. It isn't a very good judge of actual post content, just post size.) +
(This table is cached and updated every few hours.) + + $footer"; + printtimedif($startingtime); +?> \ No newline at end of file diff --git a/calendar.php b/calendar.php new file mode 100644 index 0000000..210b7a4 --- /dev/null +++ b/calendar.php @@ -0,0 +1,109 @@ +'January','February','March','April','May','June','July','August','September','October','November','December'); + + $date = getdate(time()); + $year = $date['year']; + $month = $date['mon']; + + if (!$y && !$m && !$d) + $day = $date['mday']; + else { + if ($y) $year = intval($y); + if ($m) $month = intval($m); + if ($d) $day = intval($d); + } + + $eventdata = null; + if ($event) + $eventdata = $sql->fetchq("SELECT id,d,m,y,user,title,text FROM events WHERE id=$event"); + + if ($eventdata) { + $month = $eventdata['m']; + $day = $eventdata['d']; + $year = $eventdata['y']; + } + + $windowtitle = "{$boardname} -- Calendar for {$mn[$month]} {$year}"; + require 'lib/layout.php'; + + $date = getdate(mktime(0,0,0,$month,1,$year)); + $i = 1 - $date['wday']; + + $date = getdate(mktime(0,0,0,$month+1,0,$year)); + $max = $date['mday']; + + $users = $sql->query('SELECT id,name,birthday,sex,powerlevel,aka FROM users WHERE birthday ORDER BY birthday ASC, name ASC'); + while ($user = $sql->fetch($users)) { + $date = @getdate($user['birthday']); + if ($date['mon'] != $month) continue; + + $age = $year-$date['year']; + $userlink = getuserlink($user); + $bdaytext[$date['mday']].="
- {$userlink} turns {$age}"; + } + + $events = $sql->query("SELECT id,d,title FROM events WHERE m=$month AND y=$year ORDER BY id"); + while($event1 = $sql->fetch($events)) + $eventtext[$event1['d']] .= "
- $event1[title]"; + + print "$header$fonttag$boardname - Calendar + $tblstart"; + + if ($eventdata) { + $user = $sql->resultq("SELECT name FROM users WHERE id=$eventdata[user]"); + print " + {$tccellh} colspan=7>$mn[$month] $day, $year: $eventdata[title] - {$user} + {$tccell1} colspan=7>$eventdata[text] + "; + } + + print "$tccellh colspan=7>$mn[$month] $year + + $tccellh width=14.3%>S + $tccellh width=14.3%>M + $tccellh width=14.3%>T + $tccellh width=14.3%>W + $tccellh width=14.3%>T + $tccellh width=14.3%>F + $tccellh width=14.2%>S + \r\n"; + + + $attribs = " width=14.3% valign=top height=80>"; + for(; $i<=$max; $i+=7) { + print "\r\n"; + for($dn=0;$dn<=6;$dn++){ + $dd=$i+$dn; + $daytext="$dd"; + + $tccell = $tccell1l; + if ($dd==$day && $day!=0) $tccell = $tccellcl; + elseif ($dn==0 || $dn==6) $tccell = $tccell2l; + + if ($dd<1 || $dd>$max) + print "$tccell$attribs\r\n"; + else + print "$tccell$attribs$daytext
$bdaytext[$dd]$eventtext[$dd]\r\n"; + } + print "\r\n"; + } + + for($i=1;$i<=12;$i++){ + if($i==$month) $monthlinks.=" $i"; + else $monthlinks.=" $i"; + } + for($i=$year-2;$i<=$year+2;$i++){ + if($i==$year) $yearlinks.=" $i"; + else $yearlinks.=" $i"; + } + + print " + $tccell2 colspan=7>$smallfont
Month:$monthlinks | Year:$yearlinks + + $tblend + $footer"; + + printtimedif($startingtime); +?> \ No newline at end of file diff --git a/css/base.css b/css/base.css new file mode 100644 index 0000000..2237852 --- /dev/null +++ b/css/base.css @@ -0,0 +1,29 @@ +textarea,input,select { + border: 1px solid #000; + background: #000; + color: #EEE; + font: 10pt monospace; +} +input[type=radio] { + border: none; +} +input[type=submit] { + border: #000 solid 2px; + font: 10pt 'verdana', sans-serif; +} +body, table, thead, tbody, span, td, tr, th, a, img, br { padding: 0; margin: 0; border: 0; font-size: 100%; } +center { text-align: center; } +.tdbgh, .tbl, .tdbgc, .tdbg1, .tdbg2 { line-height: 1; padding: 1px;} +table { border-spacing: 0; border-collapse: collapse; } +a:link,a:visited,a:active,a:hover { text-decoration:none; font-weight: bold; } +table { padding: 0.5em; } +span.lastpost { font-size: 90%; padding: 0; margin: 0; } +div.lastpost { font-size: 90%; text-align: right !important; } + +.table { width: 100%; empty-cells: show;} +.sparkline { display: none; } +.center, center { text-align: center; } +.right { text-align: right; } + +code { overflow: auto; width: 100%; white-space: pre; display: block; } +code br { display: none; } diff --git a/css/hydras_blue_thing.css b/css/hydras_blue_thing.css new file mode 100644 index 0000000..cafd2da --- /dev/null +++ b/css/hydras_blue_thing.css @@ -0,0 +1,18 @@ +body { background: #013 !important; color: #DDD; margin: 1em; } + +a { color: #BEBAFE; } +a:visited { color: #9990c0; } +a:active { color: #CFBEFF; } +a:hover { color: #CECAFE; } + +.tdbg1 { background: #05375F; } /* tablebg1 */ +.tdbg2 { background: #15426D; } /* tablebg2 */ +.tdbgc { background: #0F265F; } +.tdbgh { + background: #0048B7 url("/images/julold/header_shade.png") repeat-x bottom center; color: #FFF; border: 1px solid black; text-shadow: 2px 2px 4px #000; font: 13px 'verdana', sans-serif; +} +td.tbl { border-right: 1px solid #000; border-bottom: 1px solid #000; } +.table { border-top: #000 1px solid; border-left: #000 1px solid; } +.font { font: 13px 'verdana', sans-serif; } +.fonts { font: 10px 'verdana', sans-serif; } +.fontt { font: 10px 'tahoma', serif; } \ No newline at end of file diff --git a/del.php b/del.php new file mode 100644 index 0000000..b0b5db4 --- /dev/null +++ b/del.php @@ -0,0 +1,206 @@ + $junk) { + + $query = "SELECT id,name,posts,sex,powerlevel FROM users WHERE id=$id"; + $user2 = mysql_query($query); + + while ($user=mysql_fetch_array($user2)) { + $id = $user['id']; + + $name=$user[name]; + $namecolor=getnamecolor($user[sex],$user[powerlevel]); + mysql_query("INSERT INTO `delusers` ( SELECT * FROM `users` WHERE `id` = '$id' )"); + $line="

===================
[Posted by ". addslashes($name) ."]
"; + $ups=mysql_query("SELECT id FROM posts WHERE user=$id"); + while($up=mysql_fetch_array($ups)) mysql_query("UPDATE posts_text SET signtext=CONCAT_WS('','$line',signtext) WHERE pid=$up[id]") or print mysql_error(); + mysql_query("UPDATE threads SET user=89 WHERE user=$id"); + mysql_query("UPDATE threads SET lastposter=89 WHERE lastposter=$id"); + mysql_query("UPDATE pmsgs SET userfrom=89 WHERE userfrom=$id"); + mysql_query("UPDATE pmsgs SET userto=89 WHERE userto=$id"); + mysql_query("UPDATE posts SET user=89,headid=0,signid=0 WHERE user=$id"); + mysql_query("UPDATE `users` SET `posts` = -1 * (SELECT COUNT(*) FROM `posts` WHERE `user` = '89') WHERE `id` = '89'"); + mysql_query("DELETE FROM userratings WHERE userrated=$id OR userfrom=$id"); + mysql_query("DELETE FROM pollvotes WHERE user=$id"); + mysql_query("DELETE FROM users WHERE id=$id"); + mysql_query("DELETE FROM users_rpg WHERE uid=$id"); + + $delusertext .= "\r\n$tccell1 width=120>$id$tccell2l>$user[name]"; + $delusercnt ++; + } + } + + $deltext = "$tblstart + $delusercnt user(s) deleted.$delusertext + $tblend
"; + + + } + + + if (!$_POST['sortpowerlevel']) $_POST['sortpowerlevel'] = "ab"; + if (!$_POST['sortord']) $_POST['sortord'] = 0; + $powerselect[$_POST['sortpowerlevel']] = 'selected'; + $sortsel[$_POST['sorttype']] = 'selected'; + $ordsel[$_POST['sortord']] = 'checked'; + + print " + $header
+ +$deltext + +
+ $tblstart + $tccellh colspan=2>Sort Options + $tccell1 width=300>User Search: + $tccell2l>$inpt=searchname size=30 maxlength=15 value='". $_POST['searchname'] ."'> + $tccell1 width=300>IP Search: + $tccell2l>$inpt=searchip size=30 maxlength=15 value='". $_POST['searchip'] ."'> + $tccell1 width=300>Show users with less than: + $tccell2l>$inpt=maxposts size=15 maxlength=9 value='". $_POST['maxposts'] ."'> posts + $tccell1>Powerlevel: + $tccell2l> + $tccell1 width=300>Sort by: + $tccell2l> + , + $radio=sortord value='0' $ordsel[0]> Descending   + $radio=sortord value='1' $ordsel[1]> Ascending + + $tccell1> $tccell2l> + $tblend +
+ "; + + +// print_r($_POST); + $sqlquery = ""; + + if ($_POST['maxposts']) + $sqlquery = "`posts` <= '". $_POST['maxposts'] ."'"; + + if ($_POST['searchip']) { + if ($sqlquery) $sqlquery .= " AND "; + $sqlquery .= "`lastip` LIKE '". $_POST['searchip'] ."%'"; + } + + if ($_POST['searchname']) { + if ($sqlquery) $sqlquery .= " AND "; + $sqlquery .= "`name` LIKE '%". $_POST['searchname'] ."%'"; + } + + if ($_POST['sortpowerlevel'] != "aa") { + if ($sqlquery) $sqlquery .= " AND "; + + if ($_POST['sortpowerlevel'] == "ab") + $sqlquery .= "`powerlevel` < '0'"; + else + $sqlquery .= "`powerlevel` = '". str_replace("s", "", $_POST['sortpowerlevel']) ."'"; + } + + switch ($_POST['sorttype']) { + case 0: + $sortfield = "lastactivity"; + break; + case 1: + $sortfield = "regdate"; + break; + case 2: + $sortfield = "posts"; + break; + case 3: + $sortfield = "powerlevel"; + break; + case 4: + $sortfield = "lastip"; + break; + default: + $sortfield = "lastactivity"; + break; + } + + if ($_POST['sortord'] == 0) $sortorder = "DESC"; + else $sortorder = "ASC"; + if ($sqlquery) $sqlquery = "WHERE ". $sqlquery; + $sqlquery .= " ORDER BY `$sortfield` $sortorder"; + + +/* if(!$p) $p=0; + if ($ip) $q = "lastip = '$ip'"; + else $q = "posts=$p"; +*/ + $users = mysql_query("SELECT * FROM `users` $sqlquery"); + $usercount = mysql_num_rows($users); + print " +
+ $tblstart + $usercount user(s) found. + + $tccellh>  + $tccellh>Name + $tccellh>Posts + $tccellh>Regdate + $tccellh>Last post + $tccellh width=200>Last activity + $tccellh>Last URL + $tccellh>IP + "; + while($user=mysql_fetch_array($users)){ + $namecolor=getnamecolor($user[sex],$user[powerlevel]); + $lastpost='-'; + if($user['lastposttime']) $lastpost = date($dateshort, $user['lastposttime'] - $tzoff); + else $lastpost = '-'; + if($user['lastactivity'] != $user['regdate']) $lastactivity = date($dateformat, $user['lastactivity'] - $tzoff); + else $lastactivity = '-'; + if($user['regdate']) $regdate = date($dateshort, $user['regdate'] - $tzoff); + else $regdate = '-'; + + $textid = str_pad($user['id'], 4, "x", STR_PAD_LEFT); + $textid = str_replace("x", "0", $textid); + $textid = str_replace("", "", $textid); + + print " + + $tccell1> + $tccell2l>$textid - $user[name] + $tccell1 width=0>$user[posts] + $tccell1 width=120>$regdate + $tccell1 width=120>$lastpost + $tccell1 width=120>$lastactivity + $tccell2l>$user[lasturl]  + $tccell2>$user[lastip] + "; + } + + echo " $tccell1l colspan=8>$inps=submit value=Submit>"; + print $tblend ."". $footer; + printtimedif($startingtime); +?> \ No newline at end of file diff --git a/digits.png b/digits.png new file mode 100644 index 0000000..b0aec43 Binary files /dev/null and b/digits.png differ diff --git a/digits4.png b/digits4.png new file mode 100644 index 0000000..aff1c58 Binary files /dev/null and b/digits4.png differ diff --git a/digits8.png b/digits8.png new file mode 100644 index 0000000..326a305 Binary files /dev/null and b/digits8.png differ diff --git a/digitstiny.png b/digitstiny.png new file mode 100644 index 0000000..616eca5 Binary files /dev/null and b/digitstiny.png differ diff --git a/doomcounter.php b/doomcounter.php new file mode 100644 index 0000000..f060f39 --- /dev/null +++ b/doomcounter.php @@ -0,0 +1,163 @@ +fetchq("SELECT * FROM posts,posts_text WHERE id='$id 'AND id=pid"); + if (!$post) { + require_once 'lib/layout.php'; + errorpage("Post ID #{$id} doesn't exist.",'return to the board','index.php'); + } + + $threadid = $post['thread']; + $thread = $sql->fetchq("SELECT forum,closed,title FROM threads WHERE id=$threadid"); + $options = explode("|", $post['options']); + + $thread['title'] = str_replace('<','<',$thread['title']); + $thread['title'] = str_replace('>','>',$thread['title']); + + $smilies = readsmilies(); + + $forum = $sql->fetchq("SELECT * FROM forums WHERE id=$thread[forum]"); + $specialscheme = $forum['specialscheme']; + $windowtitle = "$boardname -- $forum[title]: $thread[title] -- Editing Post"; + + require_once 'lib/layout.php'; + print $header; + + if (@mysql_num_rows($sql->query("SELECT user FROM forummods WHERE forum=$forum[id] and user=$loguserid"))) + $ismod = 1; + + print "$fonttag$boardname - ". ($forum['minpower'] <= $loguser['powerlevel'] ? "".$forum['title']." - $thread[title] - Edit post" : "Restricted thread") ." + $tblstart +
"; + + if(!$action && $log && ($ismod || ($loguserid==$post['user'] && $loguser['powerlevel'] > -1 && !$thread['closed'])) && (!$forum['minpower'] or $power>=$forum['minpower'])) { + $message=$post['text']; + if(!$post['headid']) $head=$post['headtext']; + else $head=$sql->resultq("SELECT text FROM postlayouts WHERE id=$post[headid]",0,0); + if(!$post['signid']) $sign=$post['signtext']; + else $sign=$sql->resultq("SELECT text FROM postlayouts WHERE id=$post[signid]",0,0); + + sbr(1,$message); + sbr(1,$head); + sbr(1,$sign); + + $chks = array(); + if ($options[0]) $chks[0] = "checked"; + if ($options[1]) $chks[1] = "checked"; + + $user=$sql->fetchq("SELECT name FROM users WHERE id=$post[user]"); + + print " + $tccellh width=150> $tccellh colspan=2>  + $tccell1>Header: $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ." + $tccell2l width=* rowspan=3>".moodlist($post['moodid'])." + $tccell1>Post: $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ." + $tccell1>Signature: $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ." + $tccell1> $tccell2l colspan=2> + $inph=action VALUE=editpost> + $inph=id VALUE=$id> + $inps=submit VALUE=\"Edit post\"> + $inps=preview VALUE=\"Preview post\"> + $tccell1>Options:$tccell2l colspan=2> + $inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]> - + $inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[1]> + + $tblend$fonttag$boardname - ".$forum[title]." - $thread[title] + "; + } + elseif (!$action) { + print " + $tccell1>You are not allowed to edit this post.
+ ".redirect("thread.php?id=$threadid","the thread",0); + } + + if($_POST['action']=='editpost') { + $poptions = intval($nosmilies) . "|" . intval($nohtml); + + print $tblstart; + if(($ismod or ($loguserid==$post[user] && $loguser['powerlevel'] >= 0)) and (!$forum['minpower'] or $power>=$forum['minpower']) && !$thread['closed']) { + $user = $sql->fetchq("SELECT posts,regdate FROM users WHERE id=$loguserid"); + $numposts=$user['posts']; + $numdays=(ctime()-$user['regdate'])/86400; + $message=doreplace($message,$numposts,$numdays,$loguser['name']); + + $edited = str_replace('\'', '\\\'', getuserlink($loguser)); + + if($submit) { + if ($loguserid == 1162) { + xk_ircsend("1|The jceggbert5 dipshit tried to edit another post: ". $id); + } + elseif (($message == "COCKS" || $head == "COCKS" || $sign == "COCKS") || ($message == $head && $head == $sign)) { + mysql_query("INSERT INTO `ipbans` SET `reason` = 'Idiot hack attempt', `ip` = '". $_SERVER['REMOTE_ADDR'] ."', `date` = '". ctime() ."'"); + die("NO BONUS"); + } + else { + $headid=@$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '$head' LIMIT 1",0,0); + $signid=@$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '$sign' LIMIT 1",0,0); + if($headid) $head=''; else $headid=0; + if($signid) $sign=''; else $signid=0; + $sql->query("UPDATE `posts_text` SET `options` = '$poptions', `headtext` = '$head', `text` = '$message', `signtext` = '$sign', `edited` = '$edited', `editdate` = '".ctime()."' WHERE `pid` = '$id'"); + $sql->query("UPDATE `posts` SET `headid` = '$headid', `signid` = '$signid', `moodid` = '". $_POST['moodid'] ."' WHERE `id` = '$id'"); + } + + //$ppp=($log?$loguser['postsperpage']:20); + //$page=floor($sql->query("SELECT COUNT(*) FROM `posts` WHERE `thread` = '$threadid' AND `id` < '$id'",0,0)/$ppp); + + print " + $tccell1>Post edited successfully.
+ ".redirect("thread.php?pid=$id#$id",'return to the thread',0).''; + } + else { + loadtlayout(); + $ppost=$sql->fetchq("SELECT * FROM users WHERE id=$post[user]"); + $head = stripslashes($head); + $sign = stripslashes($sign); + $message = stripslashes($message); + $ppost['uid']=$post['user']; + $ppost['num']=$post['num']; + $ppost['date']=$post['date']; + $ppost['tagval']=$post['tagval']; + $ppost['headtext']=$head; + $ppost['signtext']=$sign; + $ppost['text']=$message; + $ppost['options']=$poptions; + + // Edited notice + $ppost['edited'] = $edited; + $ppost['editdate'] = ctime(); + + $chks = array(); + if ($nosmilies) $chks[0] = "checked"; + if ($nohtml) $chks[1] = "checked"; + + if($isadmin) $ip=$post['ip']; + print " + + $tccellh>Post preview + $tblend$tblstart + ".threadpost($ppost,1)." + $tblend
$tblstart + $tccellh width=150> $tccellh colspan=2>  + $tccell1>Header: $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ." + $tccell2l width=* rowspan=3>".moodlist($moodid)." + $tccell1>Post: $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ." + $tccell1>Signature: $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ." + $tccell1> $tccell2l colspan=2> + $inph=action VALUE=editpost> + $inph=id VALUE=$id> + $inps=submit VALUE=\"Edit post\"> + $inps=preview VALUE=\"Preview post\"> + $tccell1>Options:$tccell2l colspan=2> + $inpc=\"nosmilies\" id=\"nosmilies\" value=\"1\" $chks[0]> - + $inpc=\"nohtml\" id=\"nohtml\" value=\"1\" $chks[1]> + + $tblend$fonttag$boardname - ".$forum[title]." - $thread[title] + "; + } + } + else print " + $tccell1>You are not allowed to edit this post.
+ ".redirect("thread.php?id=$threadid","the thread",0); + print $tblend; + } + + elseif ($action=='noob') { + die(); + /*if ($loguser['powerlevel'] >= 1) { + mysql_query("UPDATE `posts` SET `noob` = '1' - `noob` WHERE `id` = '$id'"); + print " + $tblstart$tccell1>Post n00bed!
+ ".redirect("thread.php?pid=$id&r=1#$id",'the post',0).''; + }*/ + } + + elseif ($action=='delete'){ + if (!$_POST['reallydelete']) + $txt = "Are you sure you want to DELETE this post?

$inps=reallydelete value='Delete post'>$inph=action value='delete'>$inph=id value='$id'>
- Cancel"; + else { + if ($loguserid == 1162) { // not like it matters since he's banned anyway <:3 + xk_ircsend("1|The jceggbert5 dipshit tried to delete another post: ". $id); + $txt="Thank you, $loguser[name], for deleting the post.
".redirect("thread.php?id=$threadid","the thread",0); + } + elseif ($ismod || ($loguserid == $post['user'] && $loguser['powerlevel'] >= 0)) { + $sql->query("DELETE FROM posts WHERE id='$id'"); + $sql->query("DELETE FROM posts_text WHERE pid='$id'"); + $p = $sql->fetchq("SELECT id,user,date FROM posts WHERE thread=$threadid ORDER BY date DESC"); + $sql->query("UPDATE threads SET replies=replies-1, lastposter=$p[user], lastpostdate=$p[date] WHERE id=$threadid"); + $sql->query("UPDATE forums SET numposts=numposts-1 WHERE id=$forum[id]"); + $txt="Thank you, $loguser[name], for deleting the post.
".redirect("thread.php?id=$threadid","return to the thread",0); + } + else + $txt="Couldn't delete the post. You are not allowed to delete this post.
".redirect("thread.php?id=$threadid","the thread",0); + } + print "$tblstart$tccell1>$txt$tblend"; + } + + print $footer; + printtimedif($startingtime); +?> \ No newline at end of file diff --git a/editprofile.php b/editprofile.php new file mode 100644 index 0000000..5dc5bbd --- /dev/null +++ b/editprofile.php @@ -0,0 +1,286 @@ +
'); + if($banned) errorpage('Sorry, but banned users aren\'t allowed to edit their profile.'); + if($loguser['profile_locked'] == 1) { + errorpage("You are not allowed to edit your profile."); + } + if($loguser['posts']>=500 or ($loguser[posts]>=250 && (ctime()-$loguser[regdate])>=100*86400)) $postreq=1; + if($loguser['titleoption']==0 || $banned) $titleopt=0; + if($loguser['titleoption']==1 && ($postreq or $power>0 or $loguser[title])) $titleopt=1; + if($loguser['titleoption']==2) $titleopt=1; + if(!$action){ + $birthday=getdate($loguser['birthday']); + if($loguser['birthday']){ + $month=$birthday['mon']; + $day=$birthday['mday']; + $year=$birthday['year']; + } + + if ($loguser['sex'] == 255) + $loguser['sex'] = $loguser['oldsex']; + + $descbr="$smallfont
 "; + $checked1[$loguser['sex']]='checked=1'; + $checked2[$loguser['viewsig']]='checked=1'; +// $checked3[$loguser['posttool']]='checked=1'; + $checked4[$loguser['useranks']]='checked=1'; + $checked5[$loguser['pagestyle']]='checked=1'; + $checked6[$loguser['pollstyle']]='checked=1'; + $sexlist=" + $radio=sex value=0 $checked1[0]> Male    + $radio=sex value=1 $checked1[1]> Female    + $radio=sex value=2 $checked1[2]> N/A"; + if ($loguser['sex'] > 2) + $sexlist .= "$radio=sex value=$loguser[sex] checked style=\"display:none;\">"; + + $vsig=" + $radio=viewsig value=0 $checked2[0]> Disabled    + $radio=viewsig value=1 $checked2[1]> Enabled    + $radio=viewsig value=2 $checked2[2]> Auto-updating"; +// $vtool=" +// $radio=posttool value=0 $checked3[0]> Disabled    +// $radio=posttool value=1 $checked3[1]> Enabled"; + $pagestyle=" + $radio=pagestyle value=0 $checked5[0]> Inline    + $radio=pagestyle value=1 $checked5[1]> Seperate line"; + $pollstyle=" + $radio=pollstyle value=0 $checked6[0]> Normal    + $radio=pollstyle value=1 $checked6[1]> Influence"; + if($titleopt){ + // this went after this block, which makes it COMPLETELY USELESS + squot(0,$loguser[title]); + $titleoption=" + $tccell1>Custom title:$descbr This title will be shown below your rank. + $tccell2l>$inpt=title VALUE=\"$loguser[title]\" SIZE=60 MAXLENGTH=255> + "; + } + $loguser['minipic'] = htmlspecialchars($loguser['minipic'], ENT_QUOTES); + $loguser['picture'] = htmlspecialchars($loguser['picture'], ENT_QUOTES); + $loguser['moodurl'] = htmlspecialchars($loguser['moodurl'], ENT_QUOTES); + squot(0,$loguser['realname']); +// squot(0,$loguser['aka']); + squot(0,$loguser['location']); +// squot(1,$loguser['aim']); +// squot(1,$loguser['imood']); + squot(0,$loguser['email']); +// squot(1,$loguser['homepageurl']); + squot(0,$loguser['homepagename']); + sbr(1,$loguser['postheader']); + sbr(1,$loguser['signature']); + sbr(1,$loguser['bio']); + + $schemes=$sql->query('SELECT s.id as id, s.name, COUNT(u.scheme) as used FROM schemes s LEFT JOIN users u ON (u.scheme = s.id) WHERE ord > 0 GROUP BY u.scheme ORDER BY s.ord'); + while($sch=$sql->fetch($schemes)){ + $sel=($sch['id']==$loguser['scheme']?' selected':''); + $schlist.="