Location: PHPKode > projects > Chinese Project Forum > upload/profile.php
<?
require("global.php");

if($user_id) {
	require("board_jump.php");
	
	if($mode == "avatars") {
		if($send == "send") {
			if($avatarid!="useown") {
				$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_avatars WHERE userid = '$user_id'");
				$oldavatar = $recordset->fields;
				if($oldavatar[id]) {
					@unlink("images/avatars/avatar-".$oldavatar[id].".".$oldavatar[extension]);
					$conn->Execute("DELETE FROM ".$prefix."_avatars WHERE id = '$oldavatar[id]'");
				}
				$conn->Execute("UPDATE ".$prefix."_user_table SET avatarid = '$avatarid' WHERE userid = '$user_id'");
			} else {
				if($uploadfile) {
					$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_avatars WHERE userid = '$user_id'");
					$oldavatar = $recordset->fields;
					if($oldavatar[id]) {
						@unlink("images/avatars/avatar-".$oldavatar[id].".".$oldavatar[extension]);
						$conn->Execute("DELETE FROM ".$prefix."_avatars WHERE id = '$oldavatar[id]'");
					}
					$conf[avatar_size] = $avatar_size;
					$conf[avatar_width] = $avatar_width;
					$conf[avatar_height] = $avatar_height;
					$setuserid = $user_id;
        			       			
					$mimetype = explode("\n", $avatarimage_ext);
					for($i = 0; $i < count($mimetype); $i++) $mimetype[$i] = trim($mimetype[$i]); 

					require_once("./admin/Upload.class.php");
					$upload = new Upload();

					$upload->setAllowedMimeTypes($mimetype);	
					$upload->setUploadPath("images/avatars");

					if ($upload->doUpload()) $conn->Execute("UPDATE ".$prefix."_user_table set avatarid = '$insertid' WHERE userid = '$user_id'");
					else eval ("\$error = \"".gettemplate("error3")."\";");
					
				} elseif(!$havatarid) eval ("\$error = \"".gettemplate("error3")."\";");
			}
		}
		$recordset = &$conn->Execute("SELECT userposts, avatarid FROM ".$prefix."_user_table WHERE userid = '$user_id'");
		$info = $recordset->fields;
		if(!$info[avatarid] || !$avatars) $checked = " CHECKED";
			if($avatars) {
				$recordset = &$conn->Execute("SELECT COUNT(*) FROM ".$prefix."_avatars WHERE (groupid = '$user_group' OR groupid = 0) AND posts <= '$info[userposts]' AND userid = 0");
				$anzahl = $recordset->fields;
				if($anzahl[0]) {
					if(!$page) $page=1;
					$pages=ceil($anzahl[0]/25);
					$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_avatars WHERE (groupid = '$user_group' OR groupid = 0) AND posts <= '$info[userposts]' AND userid = 0 ORDER BY name ASC LIMIT ".(25*($page-1)).", 25");
					while(!$recordset->EOF) {
						$row = $recordset->fields;
						if($row[id]==$info[avatarid]) $avatarArray[] = "<input type=\"RADIO\" name=\"avatarid\" value=\"$row[id]\" CHECKED><img src=\"images/avatars/avatar-".$row[id].".".$row[extension]."\">";
						else $avatarArray[] = "<input type=\"RADIO\" name=\"avatarid\" value=\"$row[id]\"><img src=\"images/avatars/avatar-".$row[id].".".$row[extension]."\">";
						$recordset->MoveNext();
					}
					$tableRows = ceil(count($avatarArray)/5);
					$count = 0;
					for ($i=0; $i<$tableRows; $i++) {
						$avatarbit .= "\t<tr bgcolor=\"{tableb}\" id=\"tableb\">\n";
						for ($j=0; $j<5; $j++) {
							$avatarbit .= "\t<td align=\"center\">".$avatarArray[$count]."&nbsp;</td>\n";
							$count++;
						}
						$avatarbit .= "\t</tr>\n";
					}
					$countall = $anzahl[0];
					$countvon = 1+25*($page-1);
					$countbis = 25*$page;
					if($countbis > $countall) $countbis = $countall;
                        	
					if($pages>1) {
						$page_link .= "<br>[ ";
						if($page!=1) $page_link .= "<a href=\"profile.php?mode=$mode$session&page=1\">&laquo;</a> <a href=\"profile.php?mode=$mode$session&page=".($page-1)."\">?/a> ";
						if($page>=6) $page_link .= "<a href=\"profile.php?mode=$mode$sessionpage=".($page-5)."\">...</a> ";
						if($page+4>=$pages) $pagex=$pages;
							else $pagex=$page+4;
						for($i=$page-4 ; $i<=$pagex ; $i++) { 	
							if($i<=0) $i=1;
							if($i==$page) $page_link .= $i." ";
								else $page_link .= "<a href=\"profile.php?mode=$mode$session&page=$i\">$i</a> ";
						}
						if(($pages-$page)>=5) $page_link .= "<a href=\"profile.php?mode=$mode$session&page=".($page+5)."\">...</a> ";
						if($page!=$pages) $page_link .= "<a href=\"profile.php?mode=$mode$session&page=".($page+1)."\"></a> <a href=\"profile.php?mode=$mode$session&page=".$pages."\">&raquo;</a>";
						$page_link .= " ]";
					}
                        	                        	
        			eval ("\$avatar_choice = \"".gettemplate("profile_avatar_choice")."\";");
				}
				if($userdata[canuploadavatar]) {
					$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_avatars WHERE userid = '$user_id'");
					$info = $recordset->fields;
					if($info[id]) {
						$ownavatar = "<img src=\"images/avatars/avatar-".$info[id].".".$info[extension]."\">";
						$havatar = "<input type=\"hidden\" name=\"havatarid\" value=\"$info[id]\">";
						$checked2= " CHECKED";
					}
					eval ("\$avatar_choice .= \"".gettemplate("profile_avatar_useown")."\";");
				}
			} 
			eval("dooutput(\"".gettemplate("profile_avatars")."\");");
		}
        
		if(!$mode) {
			$recordset = &$conn->Execute("SELECT objectid, username FROM ".$prefix."_object2user LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid = ".$prefix."_object2user.objectid) WHERE ".$prefix."_object2user.userid='$user_id' AND buddylist = 1");
			while(!$recordset->EOF) {
				$row = $recordset->fields;
				if(checkuseronline($row[objectid])) {
					if($online) $online .= ", ";
					$online .= "<a href=\"members.php?mode=profile&userid=".$row[objectid]."&boardid=$boardid$session\">".$row[username]."</a>";
				} else {
					if($offline) $offline .= ", ";
					$offline .= "<a href=\"members.php?mode=profile&userid=".$row[objectid]."&boardid=$boardid$session\">".$row[username]."</a>";
				}
			}
                
			if($pms && $userdata[canusepms]) eval ("\$profile_pmlink= \"".gettemplate("profile_pmlink")."\";");
			eval("dooutput(\"".gettemplate("profile_main")."\");");
			$recordset->MoveNext();
		}

		if($mode=="editprofile") {
			if($send == "send") {
				if(!$email || !$emailconfirm || $email != $emailconfirm || strlen($usertext) > $usertextlength || (getUserEmail($user_id) != $email && checkemail($email)) || checkemail($email,1)) eval ("\$error = \"".gettemplate("errorn1")."\";");
					else { 
						if($homepage) $homepage = editURL($homepage);
						$conn->Execute("UPDATE ".$prefix."_user_table SET useremail='$email', userhp='$homepage', usericq='".editPostdata($icq)."', userqq='".editPostdata($qq)."', aim='".editPostdata($aim)."', yim='".editPostdata($yim)."', age_m='$month', age_d='$day', age_y='".editPostdata($year)."', location='".editPostdata($location)."', interests='".editPostdata(nt_wordwrap($interests,20))."', work='".editPostdata($work)."', gender = '$gender', usertext = '".editPostdata(nt_wordwrap($usertext,25))."' WHERE userid='$user_id'");
					}
			}
                                
			$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_user_table WHERE userid='$user_id'");
			$user_info = $recordset->fields;
			if(!$user_info[age_d]) $day_select = "<option value=\"\" selected></option>";
                else $day_select = "<option value=\"\"></option>";
			if($user_info[usertext]) $usertext = editDBdata($user_info[usertext]);	
			if($user_info[gender]==1) $gender_sel[1] = " selected";
				elseif($user_info[gender]==2) $gender_sel[2] = " selected";

			for($i = 1; $i <= 31; $i++) {
				$day_select .= "<option value=\"$i\"";
				if($user_info[age_d]=="$i") $day_select .= " selected";
				$day_select .= ">$i</option>";
			}

			if(!$user_info[age_m]) $month_sel[0] = " selected";
			if($user_info[age_m]=="1ÔÂ") $month_sel[1] = " selected";
			if($user_info[age_m]=="2ÔÂ") $month_sel[2] = " selected";
			if($user_info[age_m]=="3ÔÂ") $month_sel[3] = " selected";
			if($user_info[age_m]=="4ÔÂ") $month_sel[4] = " selected";
			if($user_info[age_m]=="5ÔÂ") $month_sel[5] = " selected";
			if($user_info[age_m]=="6ÔÂ") $month_sel[6] = " selected";
			if($user_info[age_m]=="7ÔÂ") $month_sel[7] = " selected";
			if($user_info[age_m]=="8ÔÂ") $month_sel[8] = " selected";
			if($user_info[age_m]=="9ÔÂ") $month_sel[9] = " selected";
			if($user_info[age_m]=="10ÔÂ") $month_sel[10] = " selected";
			if($user_info[age_m]=="11ÔÂ") $month_sel[11] = " selected";
			if($user_info[age_m]=="12ÔÂ") $month_sel[12] = " selected";

			$usericq = editDBdata($user_info[usericq]);
			$userqq = editDBdata($user_info[userqq]);
			$aim = editDBdata($user_info[aim]);
			$yim = editDBdata($user_info[yim]);
			$age_y = editDBdata($user_info[age_y]);
			$location = editDBdata($user_info[location]);
			$interests = editDBdata($user_info[interests]);
			$work = editDBdata($user_info[work]);

			eval("dooutput(\"".gettemplate("profile_editprofile")."\");");

		}

		if($mode=="editsignature") {
			if($send && !$preview) {
				if(strlen($message) > $siglength || check_signature($message)) eval ("\$error = \"".gettemplate("errorn1")."\";");
					else $conn->Execute("UPDATE ".$prefix."_user_table set signatur = '".editPostdata(parseURL(nt_wordwrap($message)))."' WHERE userid = '$user_id'");                
			}
			if($bbcode && $u_bbcode) $bbcode_buttons = getcodebuttons();
			if($smilies && $u_bbcode) $bbcode_smilies = getclickysmilies(3,$anzahl_smilies);
			if($sightml) eval ("\$note .= \"".gettemplate("newthread_html_enable")."\";");
				else eval ("\$note .= \"".gettemplate("newthread_html_disable")."\";");
			if(!$sigsmilies) eval ("\$note .= \"".gettemplate("newthread_smilies_disable")."\";");
			if(!$sigbbcode) eval ("\$note .= \"".gettemplate("newthread_bbcode_disable")."\";");

			$recordset = &$conn->Execute("SELECT signatur FROM ".$prefix."_user_table WHERE userid='$user_id'");
			$user_info = $recordset->fields;
			if($user_info[signatur]) {
				$old_signature = editSignatur($user_info[signatur],0);
				eval ("\$old_signatur = \"".gettemplate("profile_old_signature")."\";");
				if(!$preview) $signature = editDBdata($user_info[signatur]);
			}
			if($preview) {
				$preview_signature = editSignatur($message,0);
				eval ("\$preview = \"".gettemplate("profile_preview_signature")."\";");
				$signature = stripslashes($message);
			}
			eval("dooutput(\"".gettemplate("profile_editsignature")."\");");
		}

		if($mode=="changepw") {
			if($send == "send") {
				if(!$password || !$confirmpassword || !$old_password || $password!=$confirmpassword || !checkpw($user_id,md5($old_password))) eval ("\$error = \"".gettemplate("errorn1")."\";");
					else {
						$user_password = md5($password);
						$conn->Execute("UPDATE ".$prefix."_user_table SET userpassword='$user_password' WHERE userid='$user_id'");
						session_register("user_password");
						setcookie("user_password", "$user_password", time()+(3600*24*365));
						header("Location: profile.php?boardid=$boardid$session");
						exit;
				}
			}
		eval("dooutput(\"".gettemplate("profile_changepw")."\");");
		}
		if($mode=="editoptions") {
			if($send == "send") {
				$conn->Execute("UPDATE ".$prefix."_user_table SET invisible='$ghost', session_link='$slink', mods_may_email='$mod_email', users_may_email='$form_email', show_email_global='$hide_email', hide_signature='$show_signature', hide_userpic='$show_userpic', prunedays='$s_prunedays', umaxposts='$s_umaxposts', bbcode='$use_bbcode', style_set='$ustyleset' WHERE userid='$user_id'");
				header("Location: profile.php?boardid=$boardid$session");
				exit;
			}
			$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_user_table WHERE userid='$user_id'");
			$user = $recordset->fields;

			if($user[invisible]) $ghost[1] = "Checked";
				else $ghost[0] = "Checked";
		
			if($user[session_link]) $slink[1] = "Checked";
				else $slink[0] = "Checked";
		
			if($user[mods_may_email]) $mod_email[1] = "Checked";
				else $mod_email[0] = "Checked";
		
			if($user[show_email_global]) $hide_email[1] = "Checked";
				else $hide_email[0] = "Checked";
		
			if($user[users_may_email]) $form_email[1] = "Checked";
				else $form_email[0] = "Checked";
		
			if($user[hide_signature]) $show_signature[1] = "Checked";
				else $show_signature[0] = "Checked";
		
			if($user[hide_userpic]) $show_userpic[1] = "Checked";
				else $show_userpic[0] = "Checked";
//Ò»ÏÂÓÃswitchÌæ´ú
			if(!$user[prunedays]) $s_prunedays[0] = "selected";
			if($user[prunedays]==1) $s_prunedays[1] = "selected";
			if($user[prunedays]==2) $s_prunedays[2] = "selected";
			if($user[prunedays]==5) $s_prunedays[3] = "selected";
			if($user[prunedays]==10) $s_prunedays[4] = "selected";
			if($user[prunedays]==20) $s_prunedays[5] = "selected";
			if($user[prunedays]==30) $s_prunedays[6] = "selected";
			if($user[prunedays]==45) $s_prunedays[7] = "selected";
			if($user[prunedays]==60) $s_prunedays[8] = "selected";
			if($user[prunedays]==75) $s_prunedays[9] = "selected";
			if($user[prunedays]==100) $s_prunedays[10] = "selected";
			if($user[prunedays]==365) $s_prunedays[11] = "selected";
			if($user[prunedays]==1000) $s_prunedays[12] = "selected";
                
			if(!$user[umaxposts]) $s_umaxposts[0] = "selected";
			if($user[umaxposts]==5) $s_umaxposts[1] = "selected";
			if($user[umaxposts]==10) $s_umaxposts[2] = "selected";
			if($user[umaxposts]==20) $s_umaxposts[3] = "selected";
			if($user[umaxposts]==30) $s_umaxposts[4] = "selected";
			if($user[umaxposts]==40) $s_umaxposts[5] = "selected";
                
			if($user[bbcode]) $use_bbcode[1] = "Checked";
				else $use_bbcode[0] = "Checked";
		
		$recordset = &$conn->Execute("SELECT styleid, stylename FROM ".$prefix."_style WHERE default_style = 0 ORDER by stylename ASC");
		while(!$recordset->EOF) {
			$row = $recordset->fields;
			if($user[style_set]==$row[styleid]) $u_style .= "<option value=\"$row[styleid]\" selected>$row[stylename]</option>";
				else $u_style .= "<option value=\"$row[styleid]\">$row[stylename]</option>";
			$recordset->MoveNext();
		}
		$recordset->close();
		eval("dooutput(\"".gettemplate("profile_editoptions")."\");");
	}

	if($mode=="buddy") {
		if($send == "send" && $buddylist) {
			$buddylist = explode(",",$buddylist);
        		for($i = 0; $i < count($buddylist); $i++) {
        			$buddylist[$i] = getUserid(trim($buddylist[$i]));
        			if(!$buddylist[$i] || $buddylist[$i]==$user_id) continue;
        			if(check_userobject($user_id,$buddylist[$i],"buddylist")) $conn->Execute("DELETE FROM ".$prefix."_object2user WHERE userid = '$user_id' AND objectid = '$buddylist[$i]' AND buddylist = 1");
						else $conn->Execute("INSERT INTO ".$prefix."_object2user (userid,objectid,buddylist) VALUES ('$user_id','$buddylist[$i]','1')");
				}
		}	

		$recordset = &$conn->Execute("SELECT objectid, username FROM ".$prefix."_object2user LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid = ".$prefix."_object2user.objectid) WHERE ".$prefix."_object2user.userid='$user_id' AND buddylist = 1");
		while(!$recordset->EOF) {
			$row = $recordset->fields;
			if(checkuseronline($row[objectid])) {
				if($online) $online .= ", ";
				$online .= "<a href=\"members.php?mode=profile&userid=".$row[objectid]."&boardid=$boardid$session\">".$row[username]."</a>";
			} else {
				if($offline) $offline .= ", ";
				$offline .= "<a href=\"members.php?mode=profile&userid=".$row[objectid]."&boardid=$boardid$session\">".$row[username]."</a>";
			}
		}
		eval("dooutput(\"".gettemplate("profile_buddy")."\");");
	}

	if($mode=="ignore") {
		if($send == "send" && $ignorelist) {
			$ignorelist = explode(",",$ignorelist);
			for($i = 0; $i < count($ignorelist); $i++) {
				$ignorelist[$i] = getUserid(trim($ignorelist[$i]));
				if(!$ignorelist[$i] || $ignorelist[$i]==$user_id) continue;
				if(check_userobject($user_id,$ignorelist[$i],"ignorelist")) $conn->Execute("DELETE FROM ".$prefix."_object2user WHERE userid = '$user_id' AND objectid = '$ignorelist[$i]' AND ignorelist = 1");
					else $conn->Execute("INSERT INTO ".$prefix."_object2user (userid,objectid,ignorelist) VALUES ('$user_id','$ignorelist[$i]','1')");
			}
		}	

		$recordset = &$conn->Execute("SELECT objectid, username FROM ".$prefix."_object2user LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid = ".$prefix."_object2user.objectid) WHERE ".$prefix."_object2user.userid='$user_id' AND ignorelist = 1");
		while(!$recordset->EOF) {
			$row = $recordset->fields;
			if($ignoreusers) $ignoreusers .= "<br>";
			$ignoreusers .= "<a href=\"members.php?mode=profile&userid=".$row[objectid]."&boardid=$boardid$session\">".$row[username]."</a>";
			$recordset->MoveNext();
		}
		eval("dooutput(\"".gettemplate("profile_ignore")."\");");
	}

	if($mode=="subscripe") {
		$recordset = &$conn->Execute("
			SELECT
			".$prefix."_object2user.objectid as boardid,
			".$prefix."_boards.*,
			".$prefix."_posts.threadparentid,
			".$prefix."_posts.userid,
			".$prefix."_posts.posttime,
			".$prefix."_threads.threadname,
			".$prefix."_threads.topicicon,
			".$prefix."_threads.boardparentid as parentid,
			".$prefix."_user_table.username	
			FROM ".$prefix."_object2user
			LEFT JOIN ".$prefix."_boards ON (".$prefix."_object2user.objectid = ".$prefix."_boards.boardid)
			LEFT JOIN ".$prefix."_posts ON (".$prefix."_posts.postid=".$prefix."_boards.lastpostid) 
			LEFT JOIN ".$prefix."_threads ON (".$prefix."_threads.threadid=".$prefix."_posts.threadparentid) 
			LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid=".$prefix."_posts.userid) 
			WHERE ".$prefix."_object2user.userid = '$user_id' AND ".$prefix."_object2user.favboards = 1
			ORDER by boardparentid ASC, sort ASC");
		while (!$recordset->EOF) {
			$row = $recordset->fields;
			if($row[invisible] && !check_boardobject($row[boardid],$user_group,"boardpermission")) continue; 
			if(!$firstid) $firstid = $row[boardparentid];
			$boardcache[$row[boardparentid]][$row[sort]][$row[boardid]] = $row;
			$recordset->MoveNext();
		}
		$boardbit = makeforumbit($firstid,1,1);
		$recordset->close();
		if($boardbit) eval ("\$subscripe_boards = \"".gettemplate("profile_subscripe_board")."\";");
			$recordset = &$conn->Execute("SELECT DISTINCT ".$prefix."_threads.threadid, ".$prefix."_threads.* FROM ".$prefix."_threads, ".$prefix."_object2user WHERE ".$prefix."_object2user.objectid = ".$prefix."_threads.threadid AND ".$prefix."_object2user.userid = '$user_id' AND ".$prefix."_object2user.favthreads = 1 ORDER by important DESC, timelastreply DESC");
			if($recordset->RecordCount()) {
				while(!$recordset->EOF){						
					$threads = $recordset->fields;
					unset($folder_image);
					unset($thread_link);
					unset($rate);
					unset($anonymous_lp);
					unset($anonymous);
					unset($thread_starter);
					unset($lastauthor);
				
					$sthreadname = "sthread_".$threads[threadid];	
					if($old_time <= $threads[timelastreply] && $$sthreadname < $threads[timelastreply]) $folder_image .= "new";		
					if($threads[replies] > "15" || $threads[views] > "150") $folder_image .= "hot";
					if($threads[flags]==1) $folder_image .= "lock";
					$folder_image = "<img src=\"images/".$folder_image."folder.gif\">";
				
					if($threads[topicicon]) $posticon = "<img src=\"$threads[topicicon]\">";
						else $posticon = "&nbsp;";
		
					if($old_time <= $threads[timelastreply] && $$sthreadname < $threads[timelastreply]) eval ("\$thread_link .= \"".gettemplate("board_gofirstnew")."\";");
					$thread_link .= "<font  face=\"{font}\"><b>";
					if($threads[important]) eval ("\$thread_link .= \"".gettemplate("board_important")."\";");
					if($threads[pquestion]) eval ("\$thread_link .= \"".gettemplate("board_poll")."\";");
					$thread_link .= "<a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session\">".prepare_topic($threads[threadname])."</a></b></font>";
					if(($threads[replies]+1)/$eproseite > 1) $thread_link .= "<font  face=\"$font\"> ( <img src=\"images/multipage.gif\"> <a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session&page=1\">1</a> <a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session&page=2\">2</a> ";
					if(($threads[replies]+1)/$eproseite > 2) $thread_link .= "<a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session&page=3\">3</a> ";
					if(($threads[replies]+1)/$eproseite > 3) $thread_link .= "<a class=\"link\" href=\"thread.php?threadid=".$threads[threadid]."&boardid=$threads[boardparentid]&styleid=$styleid$session&page=4\">4</a> ";
					if(($threads[replies]+1)/$eproseite > 4) {
						$pagesx=ceil(($threads[replies]+1)/$eproseite);
						eval ("\$thread_link .= \"".gettemplate("board_lastpage")."\";");
						$pages = 0;
					}
					if(($threads[replies]+1)/$eproseite > 1) $thread_link .= ")";
					eval ("\$thread_link .= \"".gettemplate("profile_subscripe_delthread")."\";");
		
					$starttime = formatdate($threads[starttime],$longdateformat,1);
					if($threads[authorid]) $thread_starter = getUsername($threads[authorid]);
						else eval ("\$anonymous = \"".gettemplate("lg_anonymous")."\";");
					$lastposttime = formatdate($threads[timelastreply],$longdateformat,1);
					$recordset = &$conn->Execute("SELECT userid FROM ".$prefix."_posts WHERE threadparentid='$threads[threadid]' ORDER by posttime DESC LIMIT 1");
					$lastauthorid = $recordset->fields[userid];
					if($lastauthorid) $lastauthor = getUsername($lastauthorid);
						else eval ("\$anonymous_lp = \"".gettemplate("lg_anonymous")."\";");
		
					eval ("\$last_post = \"".gettemplate("board_lastpost")."\";");
				
					if($threads[rated] && $threads[rate_points]) {
						$j = round($threads[rate_points]/$threads[rated]);
						for ($j; $j > 0; $j--) $rate .= "<img src=\"images/star.gif\" border=0>";
					} else $rate = "&nbsp;";
		
					eval ("\$threadbit .= \"".gettemplate("board_threadbit")."\";");
					$recordset->MoveNext();
				}
				$recordset->close();
				eval ("\$subscripe_threads .= \"".gettemplate("profile_subscripe_thread")."\";");
			}
			eval("dooutput(\"".gettemplate("profile_subscripe")."\");");
		}

} else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
?>

Return current item: Chinese Project Forum