Location: PHPKode > projects > Modular Site Manager > htdocs/vou-flooder/includes/class.php
<?php
class admin {
	var $db = "";
	var $num_queries = 0;
	var $last_error = "";
	var $result = "";

	function mysql() {
		@$this->db = mysql_connect("localhost", "l33ad_vouksh", "xf3G63Wt") or $ret = $this->error();
		@mysql_select_db("l33ad_vouall", $this->db) or $ret = $this->error();
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}

	function close() {
		$this->result = @mysql_close($this->db) or $ret = $this->error();
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}
	
	function query($query) {
		global $query_num;
		mysql_query($query) or $ret = $this->error();
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
		$query_num++;
	}
	
	function error() {
		$this->last_error = mysql_error();
		return false;
	}
	
	function deletepost($id) {
		mysql_query("DELETE FROM `".PRE."flooder` WHERE `id` = '$id' LIMIT 1") or $ret = $this->error();
	if(!isset($ret)) {
		$ret = true;
	}
	return $ret;
	}
	
	function showall() {
		$all = mysql_query("SELECT * FROM ".PRE."flooder ORDER BY id DESC") or $ret = $this->error();
		while($this->r=mysql_fetch_array($all)) {
			$this->id = $this->r["id"];
		    $this->username = $this->r["name"];
			$this->message = $this->r["message"];
			$this->ip = $this->r["ip"];
			echo "<strong>$this->username</strong><br />IP: $this->ip <br />$this->message<br /><a href=\"v-delete.php?id=$this->id\">Delete this</a> <a href=\"v-edit.php?id=$this->id\">Edit this</a><br /><br />
			";
		}
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}
	
	function showone($id) {
		$one = mysql_query("SELECT * FROM ".PRE."flooder WHERE id='$id' ORDER BY id DESC LIMIT 1") or $ret = $this->error();
		while($this->t=mysql_fetch_array($one)) {
			$this->ido = $this->t["id"];
		    $this->usernameo = $this->t["name"];
			$this->messageo = str_replace('"', '&quot;', $this->t["message"]);
			$this->ipo = $this->t["ip"];
			echo "<form action=\"v-edit-in.php\" method=\"post\"><input type=\"hidden\" name=\"id\" value=\"$this->ido\" /><input type=\"hidden\" value=\"$this->usernameo\" name=\"username\" /><strong>$this->usernameo</strong> <br /><input type=\"textarea\" value=\"$this->messageo\" rows=\"4\" cols=\"20\" name=\"message\"></textarea><br /><input type=\"submit\" label=\"submit\" /></form>
			";
		}
			if(!isset($ret)) {
				$ret = true;
			}
			return $ret;
	}
}

class main {
	var $db = "";
	var $last_error = "";
	var $parsed = "";

	function mysql() {
		@$this->db = mysql_connect("localhost", "l33ad_vouksh", "xf3G63Wt") or $ret = $this->error();
		@mysql_select_db("l33ad_vouall", $this->db) or $ret = $this->error();
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}
	
	function close() {
		$this->result = @mysql_close($this->db) or $ret = $this->error();
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}
	
	function error() {
		$this->last_error = mysql_error();
		return false;
	}

function parse($string) {
		$search = array("[b]", "[/b]", "[i]", "[/i]", "[u]", "[/u]");
		$replace = array("<span style=\"font-weight: bold;\">", "</span>", "<span style=\"font-style: italic;\">", "</span>", "<span style=\"text-decoration:underline;\">", "</span>");
		$msg = str_replace($search, $replace, $string);
		$img = preg_replace("/\[img\](.*?)\[\/img\]/", "<img src=\"\\1\" alt=\"User Posted Image\" title=\"User Posted Image\" />", $msg);
		$msg2 = preg_replace('=([^\s|\[img\]]*)(www.)([^\s|\[\/img\]]*)=', '[url=http://\\2\\3]\\3[/url]', $img);
		$msgurl = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/", "<a href=\"\\1\">\\2</a>", $msg2);
		$sm_search = array(":)", ":(", ":D", ":biggrin:", ":p", ";p", ":meh:", ":o", ";)", "X_X", ":dead:");
		$sm_replace = array("<img src=\"/cms/smilies/happy.gif\" alt=\"Happy\" />","<img src=\"/cms/smilies/sad.gif\" alt=\"Sad\" />","<img src=\"/cms/smilies/grin.gif\" alt=\"Grin\" />", "<img src=\"/cms/smilies/big-grin.gif\" alt=\"Big Grin\" />", "<img src=\"/cms/smilies/tounge.gif\" alt=\"Tounge\" />", "<img src=\"/cms/smilies/wink-tounge.gif\" alt=\"Wink Tounge\" />", "<img src=\"/cms/smilies/meh.gif\" alt=\"Meh\" />", "<img src=\"/cms/smilies/gasp.gif\" alt=\"Gasp\" />", "<img src=\"/cms/smilies/wink.gif\" />", "<img src=\"/cms/smilies/dead.gif\" alt=\"Dead\" />", "<img src=\"/cms/smilies/dead.gif\" alt=\"Dead\" />");
		$smiley = nl2br(stripslashes(str_replace($sm_search, $sm_replace, $msgurl)));
		return $smiley;
}

	function show($limit) {
		$all = mysql_query("SELECT * FROM ".PRE."flooder ORDER BY id DESC LIMIT $limit") or $ret = $this->error();
		$rows = mysql_num_rows($all);
		echo "<div class=\"shoutbox-tags\">\n";
		for($i = 0; $i < $rows; $i++) {
		    $r=mysql_fetch_array($all); //get a row from our result set
		    $username = $r["name"];
			$message = $r["message"];
			if($i % 2) { //this means if there is a remainder
 		       echo "<div class=\"row1\">\n";
		    } else { //if there isn't a remainder we will do the else
				echo "<div class=\"row2\">\n";
			}
		
		$parsed = $this->parse($message);

		echo "<div style=\"font-weight: bold;\"><a href=\"Members/Profile/".$username."\">".$username."</a></div><br />".$parsed."<br /></div>\n";
		}
		//now let's close the table and be done with it
		echo "</div>\n";
			
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}
	function tagin($name, $message, $ip) {
		mysql_query("INSERT INTO ".PRE."flooder SET name='".htmlspecialchars($name)."', message='".nl2br($message)."', ip='$ip', date=now()") or die(mysql_error());
		if(!isset($ret)) {
			$ret = true;
		}
		return $ret;
	}
}

?>

Return current item: Modular Site Manager