executestart = $this->getmicrotime(); $this->setdb(); $this->version = "beta 1.2"; global $cuser, $cpass, $nitsuser, $rollovercolor, $allowguestposting; $options1 = $this->select("options.cgi", 1); $options2 = $this->select("options.cgi", 2); $options3 = $this->select("options.cgi", 3); $this->aheight = $options1[3]; $this->awidth = $options1[2]; $this->topiclength = $options1[4]; $this->timeformat = $options1[5]; $this->boardname = $options1[1]; $this->maxpostsize = $options1[6]; $this->postwrap = $options1[7]; $this->topicsperpage = $options1[8]; $this->postsperpage = $options2[1]; $this->membersperpage = $options2[2]; $this->posttime = $options2[3]; $this->allowguestposting = $options2[6]; if ($cuser == "") { $this->user = array(0, "Guest",'',7); $this->msgrwlc = "Welcome Guest, please register or login."; $this->in = false; $nitsuser = "Guest"; } else { $user = $this->selectwhere("users.cgi", 1, $cuser); $this->user = $user[0]; $this->cpass = $cpass; $messages = $this->selectwhere("messages.cgi", 2, $this->user[0]); $this->in = true; $messages = $this->where($messages, 6, 0); if (count($messages) != 1) { $s = "s"; } $this->msgrwlc = "Welcome back " . $this->user[1] . ".
You have ".count($messages)." New Message$s
"; } $this->usergroup = $this->select("groups.cgi", $this->user[3]); $this->whosonline(); $this->validated = $this->validate(14); $where = $this->selectwhere("logging/banned.cgi", 2, $GLOBALS['REMOTE_ADDR']); if ($where[0][0] != 0) { $this->banned = true; die(); } } function messages () { if ($cuser == "") { $this->user = array(0, "Guest",'',7); $var = ""; } else { $user = $this->selectwhere("users.cgi", 1, $cuser); $this->user = $user[0]; $this->cpass = $cpass; } echo $var; } function messengerlinks () { if ($cuser == "") { $var = ""; } elseif ($cuser != "Guest") { $var = ""; } else { } echo $var; } function button ($text) { ?> tags(string); function tags ($text) { if (substr_count($text, "[quote]") == substr_count($text, "[/quote]")) { $text = str_replace("[quote]", "
", $text); $text = str_replace("[/quote]", "
", $text); } $text = preg_replace("/\[url\](http:\/\/|)(.*?)\[\/url\]/i", "\\1\\2", $text); $text = preg_replace("/\[url=(http:\/\/|)(.*?)\](.*?)\[\/url\]/i", "\\3", $text); $text = preg_replace("/\[img\](.*?)\[\/img\]/i", "\"Posted", $text); $text = preg_replace("/\[url=(http:\/\/|)(.*?)\](.*?)\[\/url\]/i", "\\3", $text); $text = preg_replace("/\[email\](.*?)\[\/email\]/i", "\\1", $text); $text = preg_replace("/\[email=(.*?)\](.*?)\[\/email\]/i", "\\2", $text); $text = preg_replace("/\[font (.*?)\](.*?)\[\/font\]/i", "\\2", $text); $text = preg_replace("/\[b\](.*?)\[\/b\]/i", "\\1", $text); $text = preg_replace("/\[i\](.*?)\[\/i\]/i", "\\1", $text); $text = preg_replace("/\[u\](.*?)\[\/u\]/i", "\\1", $text); $text = preg_replace("/\[small\](.*?)\[\/small\]/i", "\\1", $text); $text = preg_replace("/\[center\](.*?)\[\/center\]/i", "
\\1
", $text); $text = str_replace(":login:", "", $text); $text = str_replace(":memberlist:", "", $text); $text = str_replace(":profile:", "", $text); $text = str_replace(":register:", "", $text); $text = str_replace(":logout:", "", $text); $text = str_replace("", $text); // Emoticon functions // "hey, who made these emoticons???" - Anthron $text = str_replace(":)", "Smile", $text); $text = str_replace(":(", "Sad", $text); $text = str_replace(":D", "Big Grin", $text); $text = str_replace(":p", "Tongue", $text); $text = str_replace(":lol:", "LOL", $text); $text = str_replace(":rolleyes:", "", $text); $text = str_replace(":unsure:", "Unsure", $text); $text = str_replace(";)", "Wink", $text); $text = str_replace(":-)", "Smile", $text); $text = str_replace(":-(", "Sad", $text); $text = str_replace(":-D", "Big Grin", $text); $text = str_replace(":-p", "Tongue", $text); $text = str_replace(":-/ ", "Unsure ", $text); $text = str_replace(";-)", "Wink", $text); $text = str_replace("pt:", "pt;", $text); $text = str_replace("pT:", "pT;", $text); $text = str_replace("Pt:", "Pt;", $text); $text = str_replace("PT:", "PT;", $text); $text = preg_replace("/\ www.(.*?)
/i", " www.\\1
", $text); $text = preg_replace("/\ www.(.*?)
/i", " www.\\1
", $text); $text = preg_replace("/\ www.(.*?)
/i", " www.\\1
", $text); $text = preg_replace("/\ www.(.*?) /i", " www.\\1 ", $text); $text = preg_replace("/\ www.(.*?) /i", " www.\\1 ", $text); $text = preg_replace("/\ www.(.*?) /i", " www.\\1 ", $text); $text = preg_replace("/\ http:\/\/(.*?)
/i", " http://\\1
", $text); $text = preg_replace("/\ http:\/\/(.*?)
/i", " http://\\1
", $text); $text = preg_replace("/\ http:\/\/(.*?)
/i", " http://\\1
", $text); $text = preg_replace("/\ http:\/\/(.*?) /i", " http://\\1 ", $text); $text = preg_replace("/\ http:\/\/(.*?) /i", " http://\\1 ", $text); $text = preg_replace("/\ http:\/\/(.*?) /i", " http://\\1 ", $text); return $text; } // Handles file uploads // $userfile and $userfile will be defined within the destination // script upon a successful upload. These variables must be passed. // int $edge->upload($userfile, $userfile_size, place to put file, maximum size file can be); // returns 0 on error, 1 on success, 2 on maxsize exceeded. function upload ($userfile, $userfile_size, $destinationfile, $maxsize) { if ($userfile_size > $maxsize) { return 2; } else { if (is_uploaded_file($userfile)) { copy($userfile, $destinationfile); chmod($destinationfile, 0777); if (is_file($destinationfile)) { return 1; } else { return 0; } } else { return 0; } } } // returns a series of links which are included in header.php function toplinks () { global $options2, $loginlink, $membrlink, $rgstrlink, $profllink; $options2 = file("options2.cgi"); if ($this->user[1] == "Guest") { $top = $options2[1]; stripslashes($top); $top = $this->tags($top); return stripslashes($top); } else { $top = $options2[0]; stripslashes($top); if ($this->validate(14) == 1) { $top = $top.""; } $top = $this->tags($top); return stripslashes($top); } } //RM: Function modified to allow Guest Posting // returns 1 if user checks out ok, 0 on error, 2 if user is a Guest function validate ($permission) { $equiv = $this->user[0]; if ($this->user[0] == 0) { if (strstr($this->allowguestposting, "true")) $prevalid = true; else return 2; } else $prevalid = ($this->encrypt($this->cpass) == $this->user[2]); return (int)(($prevalid)&&($this->usergroup[$permission] == 1)); } function session () { $ipn = str_replace(".", "", ($GLOBALS['REMOTE_ADDR'])); $x = round(((time())*(rand(1,1000))*($ipn)), 20); $x = str_replace("+", "7", $x); $x = str_replace(" ", "7", $x); $x = str_replace("E", "7", $x); $x = str_replace(".", "0", $x); return $x; } function pipset ($n) { if ($n >= 25) { $q = 1; } if ($n >= 50) { $q = 2; } if ($n >= 100) { $q = 3; } if ($n >= 200) { $q = 4; } if ($n >= 400) { $q = 5; } if ($n >= 800) { $q = 6; } if ($n >= 1400) { $q = 7; } if ($n >= 2000) { $q = 8; } if ($n >= 2600) { $q = 9; } if ($n >= 3200) { $q = 10; } if ($n >= 4000) { $q = 11; } if ($n >= 5000) { $q = 12; } return $q; } function pip ($n, $g) { $group = $this->select("groups.cgi", $g); if ($group[16] == "X") { $bigpip = ""; #pip = ""; } else { if (empty($group[16])) { $pipno = 2; } else { $pipno = $group[16]; } if ($pipno == "Power Administrator") { $file = "1"; } elseif ($pipno == "Power Team Member") { $file = "3"; } elseif ($pipno == "Power Moderator") { $file = "4"; } elseif ($pipno == "Level 1 Administrator") { $file = "1"; } elseif ($pipno == "Level 1 Registered") { $file = "2"; } elseif ($pipno == "Level 1 Team Member") { $file = "3"; } elseif ($pipno == "Level 1 Moderator") { $file = "4"; } if (strstr($pipno,"Power")) { $bigpip = "$pipno
"; } else { $bigpip = ""; } $q = $this->pipset($n); $i = 1; $newpip = ""; while ($i <= $q) { $pip = $pip.$newpip; if ($i == 6) { $pip = $pip."
"; } $i++; } if (($pip == "")) { $pip = "No Pips"; } if (($pipno == "X")) { $pip = "No Pips"; $bigpip = ""; } if (($pipno == "None")) { $pip = "No Pips"; $bigpip = ""; } } $this->bigpip = $bigpip; $this->pip = $pip."
"; $this->pipgroup = $pipno; $this->pipusergroup = $group[1]; } function usercp () { global $cuser; if ($cuser == "") { $this->user = $this->select("users.cgi", 0); echo "Welcome, Guest, please register or login."; } elseif ($cuser == "Guest") { $this->user = $this->select("users.cgi", 0); echo "Welcome, Guest, please register or login."; } else { echo "
".$this->user[1]."
\n"; $messages = $this->selectwhere("messages.cgi", 2, $this->user[0]); $messages = $this->where($messages, 6, 0); if (count($messages) != 1) { $s = "s"; } $this->pip($this->user[11], $this->user[3]); echo "Your Pips:
".$this->pip."\n"; echo "Your Pip Group: ".$this->pipgroup."
\n"; echo "Your Group: ".$this->pipusergroup."
\n"; echo "New Message$s: ".count($messages)."
\n"; echo "
Inbox | Outbox | Launch Messenger
\n"; } } function whosonline () { global $gtime, $session, $HTTP_COOKIE_VARS; // first take out anyone who should not be in who's online. $whosonline = $this->selectall("online.cgi"); // now go through each member one at a time foreach ($whosonline as $member) { // if this member's whosonline record is 10+ minutes old if ($member[2] < time()-600) { // delete the user from the whosonline list $this->delete("online.cgi", $member[0]); // if this member is not a guest if ($member[1] != 0) { // update his last active status $user = $this->select("users.cgi", $member[1]); $user[10] = time(); $this->update("users.cgi", $member[1], $user); } } else { // will eventually add stuff here to add someone to who's online list. } } // if this user is not a guest if ($this->user[0] != 0) { // see if this user is in the whosonline $where = $this->selectwhere("online.cgi", 1, $this->user[0]); // if the user is not in whosonline, add him if (count($where[0]) == 0) { $when = $this->selectwhere("logging/ipaddress.cgi", 2, $GLOBALS['REMOTE_ADDR']); if ($when[0][0] == 0) { if (!isset($gtime)) { $gtime = time(); } $ip = array($this->user[0], $GLOBALS['REMOTE_ADDR'], $gtime, $HTTP_COOKIE_VARS['userstatus']); $this->insert("logging/ipaddress.cgi", $ip); } $online = array($this->user[0], time()); $this->insert("online.cgi", $online); // if the user is in the whos online, update him } else { $online = array($where[0][0], $where[0][1], time(), $HTTP_COOKIE_VARS['userstatus']); $this->update("online.cgi", $where[0][0], $online); } // if this user is a guest } else { $session = $this->session(); if (!isset($HTTP_COOKIE_VARS['sessionid'])) { setcookie("sessionid", $session, time()+5184000); } $when = $this->selectwhere("logging/ipaddress.cgi", 2, $GLOBALS['REMOTE_ADDR']); if ($when[0][0] == 0) { $ip = array("guest", $GLOBALS['REMOTE_ADDR'], $session); $this->insert("logging/ipaddress.cgi", $ip); } $guest = $this->selectwhere("online.cgi", 3, $GLOBALS['REMOTE_ADDR']); // guest has no cookie, also is not in whos online. if ($guest[0][3] != $GLOBALS['REMOTE_ADDR']) { $guest = array(0, time(), $GLOBALS['REMOTE_ADDR']); $this->insert("online.cgi", $guest); // this means the guest is already in the whos online. } else { $guest[0][2] = time(); $this->update("online.cgi", $guest[0][0], $guest[0]); } } } function head () { $options = $this->select("options.cgi", 2); ?> select("options.cgi", 2); if (strstr(($options[8]),"true")) { echo ('onMouseOver="tableOver(this);" onClick="document.location.href=\'index.php?a=forum&forum='.$args[1].'\'" onMouseOut="tableOut(this);" style="cursor: hand;"'); } } function trfx ($page) { $args = func_get_args(); $options = $this->select("options.cgi", 2); if (strstr(($options[8]),"true")) { echo ('onMouseOver="tableOver(this);" onClick="document.location.href=\'index.php?a=member&type=viewprofile&userid='.$args[1].'\'" onMouseOut="tableOut(this);" style="cursor: hand;"'); } } function frfx ($page) { $args = func_get_args(); $options = $this->select("options.cgi", 2); if (strstr(($options[8]),"true")) { echo ('onMouseOver="tableOver(this);" onClick="document.location.href=\'index.php?a=topic&forum='.$args[1].'&topic='.$args[2].'\'" onMouseOut="tableOut(this);" style="cursor: hand;"'); } } // make sure $this->user can view $this->forum // arguments are permissionid (5/6/7), display message (true/false), and forumid function checkforumpermission ($permissionid, $displaymessage, $forumid) { $forum = $this->select("forums/forums.cgi", $forumid); $access = 1; if ($forum[$permissionid] != "") { $groups = explode(",", $forum[$permissionid]); $access = 0; foreach ($groups as $group) { if ($this->user[3] == $group) { $access = 1; } } if (($access == 0) && ($displaymessage == true)) { $this->displaymessage("Permissions Error.", "You do not have the nessecary permissions to perform that action in this forum."); $this->footer(); die(); } } return $access; } // used to display execution time function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } // arguments are message title, message text, [redirect] function displaymessage () { $args = func_get_args(); if (isset($args[2])) { $redirect = ""; } else { $redirect = ""; } ?>
window.location=\"".$args[2]."\";"; } else { $redirect = ""; } ?>
select("users.cgi", $this->user[0]); $user[11]++; $this->update("users.cgi", $this->user[0], $user); } function encrypt ($string) { return md5($string); } function header () { include "header.php"; $this->navbar(); } function footer () { $executeend = $this->getmicrotime(); $executetime = $executeend - $this->executestart; $this->executetime = round($executetime, 4); include "footer.php"; } // returns an array starting from $start with no more than $max indexes or whatever. // useful for pages. function limit($array, $start, $max) { $lines = array(); for ($i=$start; $i <= $start+$max; $i++) { if ($i == count($array)) {break;} array_push($lines, $array[$i]); } return $lines; } function deinputize ($text) { $text = str_replace("
", "\n", $text); return $text; } // arguments are // $text to inputize, maximum length of text, maxsize of any one word // $text is only required variable function inputize () { $args = func_get_args(); $text = $args[0]; if ((isset($args[1])) && (strlen($text) > $args[1])) { $text = substr($text, 0, $args[1]); } if (isset($args[2])) { // the following loop was found at php.net // http://www.php.net/manual/en/ref.strings.php // created by heiko@individual-web.com $l = 0; $temp = ""; for ($i = 0; $i < strlen($text); $i++) { $char = substr($text,$i,1); if ($char != " ") { $l++; } else { $l = 0; } if ($l == $args[2]) { $l = 0; $temp .= " "; } $temp .= $char; } $text = $temp; } $text = stripslashes($text); $o2 = $this->select("options.cgi", 3); if (strstr($o2[1],"false")) { $text = str_replace(">", ">", $text); $text = str_replace("<", "<", $text); } $text = str_replace("\r\n", "
", $text); $text = str_replace("\n", "
", $text); $text = str_replace("|", "|", $text); return $text; } function navbar () { global $a, $type; $navbar = "» ".$this->boardname." "; if ($this->forum != "") { $forum = $this->select("forums/forums.cgi", $this->forum); $navbar = $navbar . "» forum."\">".$forum[1]." "; } if ($this->topic != "") { if (substr($this->topic, 0, 1) != 0) { $topic = $this->select("forums/".$this->forum."/list.cgi", $this->topic); } else { $topic = $this->select("forums/".$this->forum."/pin.cgi", $this->topic); } $navbar = $navbar . "» forum."&topic=".$this->topic."\">".$topic[1]." "; } if (($a == "admin")) { $navbar = $navbar . "» Administrator's Control Panel "; } if (($type == "register") || ($type == "register2")){ $navbar = $navbar . "» Register "; } if (($type == "login") || ($type == "login2")){ $navbar = $navbar . "» Login "; } if (($type == "general") || ($type == "general2")){ $navbar = $navbar . "» Editing Options "; } if (($type == "group") || ($type == "group2")){ $navbar = $navbar . "» Editing Options "; } if (($type == "user") || ($type == "user2")){ $navbar = $navbar . "» Editing Options "; } if ($type == "logout") { $navbar = $navbar . "» Logout "; } if (($a == "post") && ($this->topic == "")) { $navbar = $navbar . "» New Topic "; } if (($a == "post") && ($this->topic != "")) { $navbar = $navbar . "» Post Reply "; } if ($type == "edit") { $navbar = $navbar . "» Editing "; } if (($type == "postdelete") || ($type == "postdelete2")) { $navbar = $navbar . "» Deleting Post "; } if (($type == "topicdelete") || ($type == "topicdelete2")) { $navbar = $navbar . "» Deleting Topic "; } if (($type == "list")) { $navbar = $navbar . "» Memberlist "; } if (($type == "profile")) { $navbar = $navbar . "» Profile "; } ?>
welcome?>