Location: PHPKode > projects > Modular Site Manager > htdocs/inc/members.inc.php
<?
// oh boy, sessions and cookies!!!!!!
if(!isset($_GET['subsec']))
{
	// do something... I don't know what yet...
} else {
	global $mysql;
	switch(strtolower($_GET['subsec']))
	{
		case "register":
			echo 'Benifits of registering:<br />
				<ul>
					<li>Posting in the shoutbox</li>
					<li>Submit tutorials, images, and downloads</li>
					<li>Post comments</li>
					<li>Upload your avatar</li>
					<li>Manage your friends</li>
					<li>Message people without using a client or email!</li>
				</ul><fieldset></fieldset><form action="misc/register.php" method="post"><div>
				<div class="formtext">Username:</div><div class="formdiv"><input type="text" name="username" /></div>
				<div class="formtext">Password:</div><div class="formdiv"><input type="password" name="pass1" /></div>
				<div class="formtext">Confirm Password:</div><div class="formdiv"><input type="password" name="pass2" /></div>
				<div class="formtext">E-Mail address:</div><div class="formdiv"><input type="text" name="email" /></div>
				<div class="buttondiv"><input type="submit" value="Submit" name="submit" /></div>
				</div>
				</form>';
		break;
		case "myprofile":
			//$mysql = new mysql(DB_MAIN);
			$sel = $mysql->select(PRE."members", "id='".$_COOKIE['mid']."'", "id", "DESC", "1");
			while($a = mysql_fetch_array($sel))
			{
				$username = $a['username'];
				$aim = $a['aim'];
				$msn = $a['msn'];
				$yahoo = $a['yahoo'];
				$icq = $a['icq'];
				$email = $a['email'];
				$sig = stripslashes($a['signature']);
				$pgnum = $a['pglimit'];
				$wpid = $a['wpid'];
				
				echo '<fieldset>
				<form action="misc/edit-profile.php" method="post" enctype="multipart/form-data">
					<div>
						<div class="formtext">AOL Instant Messenger</div><div class="formdiv"><input type="text" name="aim" value="'.$aim.'" /></div>
						<div class="formtext">MSN Messenger</div><div class="formdiv"><input type="text" name="msn" value="'.$msn.'" /></div>
						<div class="formtext">Yahoo! Messenger</div><div class="formdiv"><input type="text" name="yahoo" value="'.$yahoo.'" /></div>
						<div class="formtext">ICQ Instant Messenger</div><div class="formdiv"><input type="text" name="icq" value="'.$icq.'" /></div>
						<div class="formtext" style="padding-top:6px;">E-Mail Address</div><div class="formdiv"><input type="text" name="email" value="'.$email.'" /></div>
						<div class="formtext" style="padding-top:5px;">Avatar</div><div class="formdiv"><input type="file" name="avatar" /></div>
						<div class="formtext" style="padding-top: 6px;"><a href="http://www.whatpulse.org/">WhatPulse</a> id</div><div class="formdiv"><input type="text" name="wpid" value="'.$wpid.'" /></div>
						<div class="formtext">Signature</div><div class="formdiv"><textarea cols="70" rows="8" name="sig">'.$sig.'</textarea></div>
						<div class="buttondiv"><input type="submit" value="Submit" name="submit" /></div>
					</div>
				</form>
				</fieldset>';
			}
			//$mysql->close();
			//unset($mysql);
		break;
		case "friends":
			//$mysql = new mysql(DB_MAIN);
			echo '<fieldset>
			<form method="post" action="misc/add-friend.php">
				<div class="formtext">Add a friend:</div><div class="formdiv"><select name="friend">';
				$list = $mysql->select(PRE."members", "active='yes'", "username", "ASC");
				while($l = mysql_fetch_assoc($list))
				{
					if($l['username'] !== $_COOKIE['user'] && !strstr(getuserinfoid('friends', $_COOKIE['mid']), $l['username']))
					{
						echo '<option value="'.$l['username'].'">'.$l['username'].'</option>
						';
					}
				}
				echo '</select></div>
				<div class="buttondiv"><input type="submit" name="submit" value="Add as Friend" /></div>
			</form></fieldset>';
			
			$sel = $mysql->select(PRE."members", "id='".$_COOKIE['mid']."'", "id", "DESC", "1");
			while($a = mysql_fetch_array($sel))
			{
				if(!empty($a['friends']))
				{
					echo '<ul>';
					$friends = explode("~", $a['friends']);
					foreach($friends as $friend)
					{
						if($friend !== "")
						{
							echo '<li><a href="misc/del-friend.php?friend='.str_replace(" ", "_", $friend).'"><img src="images/delete-clear.gif" alt="Remove '.$friend.' from your friends list" title="Remove '.$friend.' from your friends list" class="deletefriend" /> </a><a href="Members/Profile/'.$friend.'">'.$friend.'</a> <a href="Members/Message&amp;friend='.$friend.'">PM</a></li>'; 
						}
					}
					echo '</ul>';
				} else {
					echo "You have no friends. Use the form above to add them.";
				}
			}
			if(isset($_GET['ferror']))
			{
				echo '<div class="error">Error: Friend exists!</div>';
			}
		break;
		case "message":
			// Oi, I hate doing this stuff. so insecure...
			echo '<fieldset><form method="post" action="misc/pm.php"><div>
			<div class="formtext">Username</div><div class="formdiv"><input type="text" name="user" value="'.str_replace(array('-', '+', "_"), array('/', '&amp;', " "),$_GET['friend']).'" /></div>
			<div class="formtext">Subject</div><div class="formdiv"><input type="text" name="subject" value="'.str_replace(array('-', '+', "_"), array('/', '&amp;', " "), $_GET['subject']).'" /></div>
			<div class="formtext">Message</div><div class="formdiv"><textarea rows="10" cols="40" name="message" class="wysiwyg"></textarea></div>
			<div class="buttondiv"><input type="submit" name="submit" value="Send" /></div>
			</div></form></fieldset>';
			if(isset($_GET['pmerror']))
			{
				echo '<div class="error">Error: No such user</div>';
			}
		break;
		case "messages":
			switch(strtolower($_GET['id']))
			{
				case "inbox":
					echo '<div><ul style="display: inline; background:none; margin-left: 15%;">
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Inbox/">Inbox</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Sent/">Sent Messages</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Trash/">Trash</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Message/">Send a PM</a></li>
					</ul></div>';

				//	$mysql = new mysql(DB_MAIN);
					// Pagination crap..
					if(empty($_GET['view']) || !isset($_GET['view']))
					{
						$view = 1;
					} else {
						$view = $_GET['view'];
					}
					$limit = getuserinfo('pglimit');
					$totalrows	= mysql_num_rows($mysql->select(PRE."messages", "owner='".$_COOKIE['mid']."' AND folder='inbox'", "id"));
					$limitvalue = $view * $limit - ($limit);
					// end pagination crap
					$allq = $mysql->select(PRE."messages", "owner='".$_COOKIE['mid']."' AND folder='inbox'", "id", "DESC", $limitvalue.",".$limit);
					$all = mysql_num_rows($allq);
					$new = mysql_num_rows($mysql->select(PRE."messages", "toid='".$_COOKIE['mid']."' AND viewed='no' AND folder='inbox'", "id"));
					echo "You have ".$new." new message(s).";
					if($all > "0")
					{
						echo '<ul>';
						$style="row2";
						while($a = mysql_fetch_array($allq))
						{
							if($style = "row2") {
								$style="row1";
							} else {
								$style="row2";
							}
							if($a['viewed'] == "no")
							{
								$subject = "&gt;".$a['subject'];
							} else {
								$subject = $a['subject'];
							}
							$date = gmdate(DATE, $a['date']);
							$from = mysql_fetch_array($mysql->select(PRE."members", "id='".$a['fromid']."'", "id", "DESC", "1"));
							echo '<li><a href="Members/Messages/View&amp;mid='.$a["id"].'">'.$subject.'</a> &brvbar; From: <a href="Members/Profile/'.str_replace(" ", "_", $from['username']).'">'.$from['username'].'</a> &brvbar; '.$date.'</li>';
						}
						echo "</ul>";
						echo '<div style="font-weight:bold;text-align:center;">';
						if($view != 1)
						{
							$pageprev = $view-1;
							echo '<a href="Members/Messages/Inbox&amp;view='.$pageprev.'">&lt;&lt;</a> ';
						} 
						$numofpages = $totalrows / $limit;
						for($i = 1; $i <= $numofpages; $i++)
						{
							if($i == $view)
							{
								echo $i." ";
							} else {
								echo '<a href="Members/Messages/Inbox&amp;view='.$i.'">'.$i.'</a> ';
							}
						}
						if(($totalrows % $limit) != 0)
						{
							if($i == $view)
							{
								echo $i.' ';
							} else {
								echo '<a href="Members/Messages/Inbox&amp;view='.$i.'">'.$i.'</a> ';
							}
						}
						if(($totalrows - ($limit * $view)) > 0)
						{	
							$pagenext = $view+1;
							echo '<a href="Members/Messages/Inbox&amp;view='.$pagenext.'">&gt;&gt;</a>';
						}
						echo '</div>';

					}
//$mysql->close();
				//	unset($mysql);
				break;
				case "sent":
					echo '<div><ul style="display: inline; background:none; margin-left: 15%;">
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Inbox/">Inbox</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Sent/">Sent Messages</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Trash/">Trash</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Message/">Send a PM</a></li>
					</ul></div>';
				//	$mysql = new mysql(DB_MAIN);
					// Pagination crap..
					if(empty($_GET['view']) || !isset($_GET['view']))
					{
						$view = 1;
					} else {
						$view = $_GET['view'];
					}
					$limit = getuserinfo('pglimit');
					$totalrows	= mysql_num_rows($mysql->select(PRE."messages", "owner='".$_COOKIE['mid']."' AND folder='sent'", "id"));
					$limitvalue = $view * $limit - ($limit);
					// end pagination crap
					$allq = $mysql->select(PRE."messages", "owner='".$_COOKIE['mid']."' AND folder='sent'", "id", "DESC", $limitvalue.",".$limit);
					$all = mysql_num_rows($allq);
					if($all > "0")
					{
						echo '<ul>';
						$style="row2";
						while($a = mysql_fetch_array($allq))
						{
							if($style = "row2") {
								$style="row1";
							} else {
								$style="row2";
							}
							$date = gmdate(DATE, $a['date']);
							$from = mysql_fetch_array($mysql->select(PRE."members", "id='".$a['fromid']."'", "id", "DESC", "1"));
							echo '<li><a href="Members/Messages/View&amp;mid='.$a["id"].'&amp;norep">'.$a['subject'].'</a> &brvbar; From: <a href="Members/Profile/'.str_replace(" ", "_", $from['username']).'">'.$from['username'].'</a> &brvbar; '.$date.'</li>';
						}
						echo "</ul>";
						echo '<div style="font-weight:bold;text-align:center;">';
						if($view != 1)
						{
							$pageprev = $view-1;
							echo '<a href="Members/Messages/Sent&amp;view='.$pageprev.'">&lt;&lt;</a> ';
						} 
						$numofpages = $totalrows / $limit;
						for($i = 1; $i <= $numofpages; $i++)
						{
							if($i == $view)
							{
								echo $i." ";
							} else {
								echo '<a href="Members/Messages/Sent&amp;view='.$i.'">'.$i.'</a> ';
							}
						}
						if(($totalrows % $limit) != 0)
						{
							if($i == $view)
							{
								echo $i.' ';
							} else {
								echo '<a href="Members/Messages/Sent&amp;view='.$i.'">'.$i.'</a> ';
							}
						}
						if(($totalrows - ($limit * $view)) > 0)
						{	
							$pagenext = $view+1;
							echo '<a href="Members/Messages/Sent&amp;view='.$pagenext.'">&gt;&gt;</a>';
						}
						echo '</div>';

					} else {
						echo "You have no sent messages";
					}
				//	$mysql->close();
				//	unset($mysql);
				break;
				case "trash":
					echo '<div><ul style="display: inline; background:none; margin-left: 15%;">
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Inbox/">Inbox</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Sent/">Sent Messages</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Trash/">Trash</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Message/">Send a PM</a></li>
					</ul></div>';
				//	$mysql = new mysql(DB_MAIN);
					// Pagination crap..
					if(empty($_GET['view']) || !isset($_GET['view']))
					{
						$view = 1;
					} else {
						$view = $_GET['view'];
					}
					$limit = getuserinfo('pglimit');
					$totalrows	= mysql_num_rows($mysql->select(PRE."messages", "owner='".$_COOKIE['mid']."' AND folder='trash'", "id"));
					$limitvalue = $view * $limit - ($limit);
					// end pagination crap

					$allq = $mysql->select(PRE."messages", "owner='".$_COOKIE['mid']."' AND folder='trash'", "id", "DESC", $limitvalue.",".$limit);
					$all = mysql_num_rows($allq);
					if($all > "0")
					{
						echo '<ul>';
						$style="row2";
						while($a = mysql_fetch_array($allq))
						{
							if($style = "row2") {
								$style="row1";
							} else {
								$style="row2";
							}
							$date = gmdate(DATE, $a['date']);
							$from = mysql_fetch_array($mysql->select(PRE."members", "id='".$a['fromid']."'", "id", "DESC", "1"));
							echo '<li><a href="Members/Messages/View&amp;mid='.$a["id"].'">'.$a['subject'].'</a> &brvbar; From: <a href="Members/Profile/'.str_replace(" ", "_", $from['username']).'">'.$from['username'].'</a> &brvbar; '.$date.'</li>';
						}
						echo '<li><a href="misc/purgedeleted.php">Purge deleted messages</a>';
						echo "</ul>";
						echo '<div style="font-weight:bold;text-align:center;">';
						if($view != 1)
						{
							$pageprev = $view-1;
							echo '<a href="Members/Messages/Trash&amp;view='.$pageprev.'">&lt;&lt;</a> ';
						} 
						$numofpages = $totalrows / $limit;
						for($i = 1; $i <= $numofpages; $i++)
						{
							if($i == $view)
							{
								echo $i." ";
							} else {
								echo '<a href="Members/Messages/Trash&amp;view='.$i.'">'.$i.'</a> ';
							}
						}
						if(($totalrows % $limit) != 0)
						{
							if($i == $view)
							{
								echo $i.' ';
							} else {
								echo '<a href="Members/Messages/Trash&amp;view='.$i.'">'.$i.'</a> ';
							}
						}
						if(($totalrows - ($limit * $view)) > 0)
						{	
							$pagenext = $view+1;
							echo '<a href="Members/Messages/Trash&amp;view='.$pagenext.'">&gt;&gt;</a>';
						}
						echo '</div>';

					} else {
						echo "You have no deleted messages";
					}
				//	$mysql->close();
				//	unset($mysql);
				break;
				case "view":
					echo '<div><ul style="display: inline; background:none; margin-left: 15%;">
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Inbox">Inbox</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Sent">Sent Messages</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Messages/Trash">Trash</a></li>
					<li style="display: inline; background:none; border: none;"><a href="Members/Message">Send a PM</a></li>
					</ul></div>';
				//	$mysql = new mysql(DB_MAIN);
					$mysql->update(PRE."messages", "viewed='yes'", "id='".$_GET['mid']."'");
					/*if(isset($_GET['norep']))
					{
						$sel = $mysql->select(PRE."messages", "id='".$_GET['mid']."' AND fromid='".$_COOKIE['mid']."'", "id", "DESC", "1");
					} else {*/
						$sel = $mysql->select(PRE."messages", "id='".$_GET['mid']."' AND owner='".$_COOKIE['mid']."'", "id", "DESC", "1");
					//}
					while($a = mysql_fetch_array($sel))
					{
						$date = gmdate(DATE, $a['date']);
						$from = mysql_fetch_array($mysql->select(PRE."members", "id='".$a['fromid']."'", "id", "DESC", "1"));
						$to = mysql_fetch_array($mysql->select(PRE."members", "id='".$a['toid']."'", "id", "DESC", "1"));
						echo '<div class="formtext" style="padding:0px; font-weight: bold;">From:</div>
						<div class="formdiv">
						<a href="Members/Profile/'.$from['username'].'">'.$from['username'].'</a>
						</div>
						<div class="formtext" style="padding:0px; font-weight: bold;">To:</div>
						<div class="formdiv">
						<a href="Members/Profile/'.$to['username'].'/">'.$to['username'].'</a>
						</div>
						<div class="formtext" style="padding:0px; font-weight: bold;">Subject:</div>
						<div class="formdiv">'.$a['subject'].'</div>
						<div class="formtext" style="padding:0px; font-weight: bold;">Date:</div>
						<div class="formdiv">'.$date.'</div>
						<div style="width: 100%; text-align: center; font-weight: bold;">-Message-</div>
						<div style="width: 80%; border: 1px solid #000; margin-left: 10%; background: #DEDEDE;">'.parse($a['message']).'</div>';
						if($a['folder'] !== "sent")
						{
							echo "<a href=\"Members/Message&amp;friend=".str_replace(" ", "_",$from['username'])."&amp;subject=".str_replace(array('+', '%2F', '%26'), array('_', '-', '+'),urlencode("Re: ".$a['subject']))."\">Reply</a> ";
						}
						echo '<a href="misc/del-message.php?mid='.$a['id'].'">Delete</a>';
					}
				break;
				default:
				//	$mysql = new mysql(DB_MAIN);
					$inbox = mysql_num_rows($mysql->select(PRE."messages", "folder='inbox' AND toid='".$_COOKIE['mid']."'", "id"));		
					$sent = mysql_num_rows($mysql->select(PRE."messages", "folder='sent' AND owner='".$_COOKIE['mid']."'", "id"));
					$trash = mysql_num_rows($mysql->select(PRE."messages", "folder='trash' AND owner='".$_COOKIE['mid']."'", "id"));
					echo 'This is where you can manage your private messages.<br />
					<ul>
					<li><a href="Members/Messages/Inbox/">('.$inbox.') Inbox</a></li>
					<li><a href="Members/Messages/Sent/">('.$sent.') Sent Messages</a></li>
					<li><a href="Members/Messages/Trash/">('.$trash.') Trash</a></li>
					<li><a href="Members/Message/">Send a PM</a></li>
					</ul>';
				//	$mysql->close();
//unset($mysql);
				break;
			}
		break;
		case "settings":
		//	$mysql = new mysql(DB_MAIN);
			$sel = $mysql->select(PRE."members", "id='".$_COOKIE['mid']."'", "id", "DESC", "1");
			while($a = mysql_fetch_array($sel))
			{
				$pgnum = $a['pglimit'];
				if($a['newsletter'] == "yes")
				{
					$checked = 'checked="checked" ';
				} else {
					$checked = "";
				}
				if($a['emailshow'] == "yes")
				{
					$checked2 = 'checked="checked" ';
				} else {
					$checked2 = "";
				}
				$datestyle = $a['datestyle'];
				$blogcats = $a['blogcats'];
			}
			$gmt = $mysql->select(PRE."config", "name='timezones'", "id");
			$g = mysql_fetch_assoc($gmt);
			$set1 = explode(",", $g["setting"]);
			$set2 = explode("~", $g["setting2"]);
			$tmzs = array_combine($set1, $set2);
		//	$mysql->close();
		//	unset($mysql);
			echo '<form action="misc/settings.php" method="post">
					<div class="formtext"><acronym title="How many things to show per page on the tutorials, downloads, etc">Pagination</acronym> Amount</div>
					<div class="formdiv"><input type="text" value="'.$pgnum.'" name="pglimit" /></div>
					<div class="formtext"><a href="http://us2.php.net/manual/en/function.date.php">Date style</a></div>
					<div class="formdiv"><input type="text" name="datestyle" value="'.$datestyle.'" /></div>
					<div class="formtext">Blog Categories</div>
					<div class="formdiv"><input type="text" name="blogcats" value="'.$blogcats.'" /> (seperate by commas)</div>
					<div class="formtext">Time Zone</div>
					<div class="formdiv"><select name="timezone">';
					foreach($tmzs as $ofs => $text)
					{
						if(getuserinfo("gmt") == $ofs)
						{
							echo '<option value="'.$ofs.'" selected="selected">'.$text.'</option>';
						} else {
							echo '<option value="'.$ofs.'">'.$text.'</option>';
						}
					}
					echo'</select></div>
					<div class="formtext"><label for="newsletter">Receive Newsletter?</label></div>
					<div class="formdiv"><input type="checkbox" '.$checked.'name="newsletter" id="newsletter" /></div>
					<div class="formtext"><label for="emailshow">Show email?</label></div>
					<div class="formdiv"><input type="checkbox" '.$checked2.'name="emailshow" id="emailshow" /></div>
					<div class="buttondiv"><input type="submit" value="Apply" name="submit" /></div>
				</form>';
		break;
		case "profile":
			//$mysql = new mysql(DB_MAIN);
			$sel = $mysql->select(PRE."members", "username='".str_replace("_", " ",$_GET['id'])."'", "id", "ASC");
			while($a = mysql_fetch_array($sel))
			{
				if($a['id'] !== "-1")
				{
					$username = $a['username'];
					$aim = $a['aim'];
					$msn = $a['msn'];
					$yahoo = $a['yahoo'];
					$icq = $a['icq'];
					$email = explode("@", $a['email']);
					$sig = stripslashes($a['signature']);
					$wpid = $a['wpid'];
					
					echo '<div style="text-align: center;"><img src="avatars/'.$a["avatar"].'" style="max-width: 80px; max-height: 80px; vertical-align: center;" alt="'.$a["username"].'\'s Avatar" /></div>
					<div style="text-align:left; padding-left: 30px; margin-bottom:20px;">
						<div style="float:left; width: 30%; text-align: right;">Username:</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$username.'</div>
						<div style="float:left; width: 30%; text-align: right;">AIM:</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$aim.'</div>
						<div style="float:left; width: 30%; text-align: right;">MSN:</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$msn.'</div>
						<div style="float:left; width: 30%; text-align: right;">Yahoo!: </div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$yahoo.'</div>
						<div style="float:left; width: 30%; text-align: right;">ICQ:</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$icq.'</div>';
						if($a['emailshow'] == "yes")
						{
							echo '<div style="float:left; width: 30%; text-align: right;">E-Mail:</div><div style="float:right; text-align:left; width:65%;">&nbsp;<a href="javascript:email(\''.$email[0].'\',\''.$email[1].'\');">'.$email[0].'@'.$email[1].'</a></div>';
						}
						echo '<div style="float:left; width: 30%; text-align: right;">Signature:</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.parse($sig).'</div>
						<div style="float:left; width: 30%; text-align: right;">Join date:</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$a["joindate"].'</div>
						<div class="buttondiv" style="float:left;"><a href="Members/Message&amp;friend='.$username.'">PM Me</a>~<a href="Blogs/View/'.str_replace(" ", "_",$a['username']).'/">My Blog</a></div>';
						if($wpid !== "0" && isset($wpid))
						{
							include "inc/user_parse.php";
							$usrstats = NULL;
							$usrstats = readUserStats($wpid);
							echo "<div class=\"buttondiv\"><a href=\"http://www.whatpulse.org/\">WhatPulse</a> Stats</div><div class=\"buttondiv\">";
							foreach($usrstats as $stat => $setting)
							{
								echo '<div style="float:left; width: 30%; text-align: right;">'.$stat.'</div><div style="float:right; text-align:left; width:65%;">&nbsp;'.$setting.'</div>';
							}
							echo "</div>";
						}
						echo '</div>';
				}
			}
			//$mysql->close();
			//unset($mysql);
		break;
		case "memberlist":
		//	$mysql = new mysql(DB_MAIN);
			// Pagination crap..
			if(empty($_GET['view']) || !isset($_GET['view']))
			{
				$view = 1;
			} else {
				$view = $_GET['view'];
			}
			$limit = getuserinfo('pglimit')*5;
			if ($limit == 0)
			{
				$limit = 50;
			}
			$totalrows	= mysql_num_rows($mysql->select(PRE."members", "active='yes'", "id"));
			$limitvalue = ($view * $limit - ($limit))*10;
			// end pagination crap

			$sel = $mysql->select(PRE."members", "active='yes'", "id", "ASC", $limitvalue.",".$limit);
			$rows = mysql_num_rows($sel);
			$style = "row2";
			echo '<div style="float: left; text-align: center; width: 24%;">User ID</div><div style="float: left; text-align: center; width: 24%;">Username</div><div style="float: right; text-align: center; width: 24%;">Blog</div><div style="float: right; text-align: center; width: 24%;">Profile</div><ul style="float: left; width: 100%;">';

			while($a = mysql_fetch_array($sel))
			{
				if($style == "row2")
				{
					$style = "row1";
				} else {
					$style = "row2";
				}
				if($a['id'] !== "-1")
				{
					if($a['groups'] == "1")
					{
						$username = '<span style="color:#F60; font-weight: bolder;">'.$a['username'].'</span>';
					} else {
						$username = $a['username'];
					}
					$id = $a['id'];
					
					echo '<li>'.$a["id"].' - '.$username.' - <a href="Members/Profile/'.str_replace(" ", "_",$a["username"]).'/">Profile</a> - <a href="Blogs/View/'.str_replace(" ", "_",$a["username"]).'/">Blog</a></li>';
				}
			}
			echo '</ul><div style="float: left; width: 100%;font-weight:bold;text-align:center;">';
			if($view != 1)
			{
				$pageprev = $view-1;
				echo '<a href="Members/Memberlist&amp;view='.$pageprev.'">&lt;&lt;</a> ';
			} 
			$numofpages = $totalrows / $limit;
			for($i = 1; $i <= $numofpages; $i++)
			{
				if($i == $view)
				{
					echo $i." ";
				} else {
					echo '<a href="Members/Memberlist&amp;view='.$i.'">'.$i.'</a> ';
				}
			}
			if(($totalrows % $limit) != 0)
			{
				if($i == $view)
				{
					echo $i.' ';
				} else {
					echo '<a href="Members/Memberlist&amp;view='.$i.'">'.$i.'</a> ';
				}
			}
			if(($totalrows - ($limit * $view)) > 0)
			{	
				$pagenext = $view+1;
				echo '<a href="Members/Memberlist&amp;view='.$pagenext.'">&gt;&gt;</a>';
			}
			echo '</div>';

		//	$mysql->close();
		//	unset($mysql);
		break;
		case "forgotpass":
			echo '<fieldset><form action="misc/forgotpass.php" method="post">
			<div>
			<div class="formtext">Email</div><div class="formdiv"><input name="email" type="text" /></div>
			<div class="formtext">Username</div><div class="formdiv"><input name="username" type="text" /></div>
			<div class="buttondiv"><input type="submit" name="submit" value="Submit" /></div>
			</div>
			</form></fieldset>';
		break;
		case "cp":
			//$mysql = new mysql(DB_MAIN);
			echo '<div class="cpleft">Welcome to your control panel '.$_COOKIE["user"].'. <br />
			From here you can control everything about your membership on Vouksh.info.
				<div class="cptitle">Messages</div>
				<ul>
					<li><a href="Members/Messages/Inbox/">Inbox</a></li>
					<li><a href="Members/Messages/Sent/">Sent</a></li>
					<li><a href="Members/Messages/Trash/">Trash</a></li>
				</ul>
				<div class="cptitle">Profile/Settings/</div>
				<ul>
					<li><a href="Members/MyProfile/">My Profile</a></li>
					<li><a href="Members/Friends/">My Friends</a></li>
					<li><a href="Members/Settings/">My Settings</a></li>
				</ul>
				<div class="cptitle">Blog Management</div>
				<ul>
					<li><a href="Blogs/View/'.$_COOKIE["user"].'/">My Blog</a></li>
					<li><a href="Blogs/Post/">Post in my Blog</a></li>
				</ul>
			</div>
			<div class="cpright">';
			$sel = $mysql->select(PRE."members", "id='".$_COOKIE['mid']."'", "id", "DESC", "1");
			while($a = mysql_fetch_assoc($sel))
			{
				$avatar = $a['avatar'];
				$blogposts = mysql_num_rows($mysql->select(PRE."blogs", "userid='".$a['username']."'", "id"));
				echo "<img src=\"avatars/".$a['avatar']."\" style=\"max-height: 80px; max-width: 80px; border: none;\" /><br />
You have made ".$blogposts." blog posts.";
			}
			echo '</div>';
		break;
	}
}
?>
Return current item: Modular Site Manager