⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
📖 第 1 页 / 共 3 页
字号:
		$rec = $rs->next();
		$limit = "";
		$all_profiles = $rec['users_amount'];
		if( $all_profiles > $profiles_per_page )
		{
			$limit = " LIMIT " . $page_num*$profiles_per_page . ", $profiles_per_page ";
		}		
		//---
		$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}users WHERE profile <> '' ORDER BY login $limit");
		$rs = $stmt->process();

		if($rs->hasNext()) 
		{
						
			print "</table><center><div width=50%><h2>{$msg['t22']}</h2></div></center>";
			
			//---
			if( $all_profiles > $profiles_per_page )
			{
				echo "<div align=center class=pages>All profeles {$all_profiles} | Showing Profiles ". 
				($page_num*$profiles_per_page+1). '-' . min((($page_num+1)*$profiles_per_page), $all_profiles)  .
				" | Page ";
								 
				for($i=1; $i<=ceil($all_profiles/$profiles_per_page); $i++)
				{
					if($i == $page_num+1)
					{
						echo "$i ";
						continue;
					}
				
					echo "<a href=\"profile.php?userid={$_REQUEST['userid']}&lang={$_REQUEST['lang']}&pg=$i\">$i</a> ";
					
				}
				
				echo "</div> ";
			}
			
			//---
						
			
			if(!$showGallery) print '<table align=center border=0 cellpadding=5 cellspacing=0 width=30%>';
			else	print '<table align=center border=0 cellpadding=5 cellspacing=2 width=80%><tr>';

			$pics = 1;
			while($rec = $rs->next()) 
			{
				if(isset($rec['profile'])){
					$profile = unserialize($rec['profile']);
					if($showGallery) {
						$pict_msg = $msg['t45'];
						if(!$profile['t12']) {
							$profile['t12'] = 'flashChat_slogo.png';
							$pict_msg = $msg['t68'];
						}
						$profileLink  = '<td align=center valign=middle width=18%><a href="' . $profile['t12'] . '" target="_blank"><img border=0 width=' . $thumbWidth . ' border=0 src="' . $profile['t12'] . '" alt="' . $pict_msg . '"></a> ';
						$profileLink .= "<br><a href=\"profile.php?pg={$_REQUEST['pg']}&userid=" . $rec['id'] . '&lang=' . $req['lang'] . '" title="' . $msg['t46'] . '" target="_self">' . $rec['login'] . '</a>';

 						if($req['flashchatid'] && ($req['roles'] == ROLE_ADMIN)) {
							$profileLink .= '<br><form action="profile.php" method="post" name="fc_profile">';
							$profileLink .= '<input type="hidden" name="flashchatid" value="' . $req['flashchatid'] . '">';
							$profileLink .= '<input type="hidden" name="lang" value="' . $req['lang'] . '">';
							$profileLink .= '<input type="hidden" name="userid" value="' . $req['id'] . '">';
							$profileLink .= '<input type="hidden" name="cid" value="' . $rec['id'] . '">';
							$profileLink .= '<input type="submit" name="admin_user_edit" value="Edit">';
							$profileLink .= '</form>';
						}

						print $profileLink . '</td>';

						if($pics++ == $pics_row) {
							$pics = 1;
							print '</tr><tr>';
						}

					} else {

						$profileLink = '<tr>';
						if($profile['t12']) {
							  $profileLink .= '<td align="right"><a href="' . $profile['t12'] . '" target="_blank"><img border=0 height=10 width=15 border=0 src="./profile/camera.gif" alt="' . $msg['t45'] . '"></a> ';
						} else {$profileLink .= '<td></td>';}
						$profileLink .= '<td align="left"><a href="profile.php?userid=' . $rec['id'] . '&lang=' . $req['lang'] . '" title="' . $msg['t46'] . '">' . $rec['login'] . '</a></td></tr>';
						print $profileLink;
					}
				}
			}
		}
	}
	print '</table></center></tr></tbody></div></div></body></html>';

 } else {
	print '<html><head><title>' . $msg['t17'] . $req['userid'] . '</title></head><body>';
	print '<center><h4>' . $msg['t17'] . $req['userid'] . '</h4></center></body></html>';
}

} else {  // start of FlashChat standard registration page

	include_once('inc/country.inc.php');

	$req = array_merge($_GET, $_POST);

	$fields = array(
		'fullname' => '',
		'email' => '',
		'site' => '',
		'icq' => '',
		'aim' => '',
		'yim' => '',
		'msnm' => '',
		'comments' => '',

		'gender' => '',
		'age' => '',
		'location' => ''
	);


	if( isset($req['save']) )
	{
		//$user = ChatServer::getUser($userid);

		if( $req['register'] )
		{
			//check if user existing
			$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}users WHERE login=? LIMIT 1");
			$usr = $stmt->process($req['user_name']);

			if( $usr->numRows > 0 || Message::replaceBadWord($req['user_name']) != $req['user_name'])
			{
				$register_succ = false;
				$register = true;
				$errmsg = str_replace('[user_name]', $req['user_name'], $msg['t100']);
				$req['user_name'] = '';

			}
			else
			{
				if( $usr->numRows != 0 )
				{
					$req['role'] = ROLE_USER;//always insert user 
				}
				//---
				$stmt = new Statement("INSERT INTO {$GLOBALS['fc_config']['db']['pref']}users (login,password,roles) VALUES (?,?,?)");
				if( !isset($req['role']) ) $req['role'] = ROLE_USER;
				if( $GLOBALS['fc_config']['encryptPass'] > 0 ) {$req['password'] = md5($req['password']);}

				$userid = $stmt->process($req['user_name'] , $req['password'], $req['role']);
				unset($req['user_name'] ,$req['password'],$req['register'], $req['role']);
				if( isset($userid) && $userid > 0 )	$register_succ = true;
			}
		}

		if($req['gender'] == 'male')   $req['gender'] = $msg['t102'];
		if($req['gender'] == 'female') $req['gender'] = $msg['t103'];
		if($req['gender'] == 'other')  $req['gender'] = $msg['t104'];

		foreach($fields as $k => $v)
		{
			$fields[$k] = removeEvilTags($req[$k]);
		}
		$stmt = new Statement("UPDATE {$GLOBALS['fc_config']['db']['pref']}users SET profile=? WHERE id=?");
		$stmt->process(serialize($fields), $userid);

		$req['userid'] = $userid;
	}

	$edit = (isset($req['userid']) && ($req['userid'] != SPY_USERID) && ($userid == $req['userid'])) || $register;

	$user = ChatServer::getUser($req['userid']);

	$stmt = new Statement("SELECT profile FROM {$GLOBALS['fc_config']['db']['pref']}users WHERE id=?");
	$rs = $stmt->process($req['userid']);

	if(($rec = $rs->next()) && $rec['profile']) {
		$profile = unserialize($rec['profile']);
	} else {
		$profile = array();
	}

	$req = array_merge($fields, $profile, $req);



	if( $register_succ === true ) {
	send_style_sheet($msg['t101']); ?>

	<div align="center">
	  <br>
	  <h2><?php echo $msg['t105']?></h2></div>

	  <center><div class="Thanks"><?php echo str_replace('[user_name]', $_POST['user_name'], $msg['t106'])?>
	  <br><br><a href="index.php"><?php echo $msg['t108']?></a><br>&nbsp;
	</div></center>

<?php
		die;
	}

	if($user || $register) {

		if(!$register){ $msgt = "Profile for user &quot;{$user['login']}&quot;"; }
			else { $msgt =  $msg['t101'];
				 $req['location'] = $default_country;
				}

		send_style_sheet($msgt); ?>

<script language="Javascript">
<!--
function formIsValid() {
	// check to make sure a valid username has been entered
	if ( document.userInfo.user_name.value == "" )
	{
		alert('<?php echo $msg['t109']?>');
		return false;
	}
	if ( document.userInfo.password.value == "" )
	{
		alert('<?php echo $msg['t110']?>');
		return false;
	}
	if ( document.userInfo.password.value != document.userInfo.password2.value )
	{
		alert('<?php echo $msg['t111']?>');
		return false;
	}

	return true;
}
</SCRIPT>

			<center>
				<div><h2><?php if(!$register){ echo "Profile for user &quot;{$user['login']}&quot;"; } else { echo $msg['t101'];} ?></h2><h3>
				<?
					echo $msg['t119'];

					//---check if is registered users
					$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}users LIMIT 1");
					$rs = $stmt->process();
					$firstUser = $rs->numRows == 0;
					//---

				?></h3></div>

				<?php if($firstUser){ ?>
				<table border="0" align="center" cellpadding="5" width="60%">
				<tr>
				<td style="background:transparent">Since you are the first user to register, you will be assigned moderator priviledges. After registration, you may login to the FlashChat <a href="admin.php" target="_blank">admin panel</a> to create additional moderators, or perform other administrative tasks.
				</td>
				</tr>
				</table>


				<?	} ?>

				<div align=center>

				<?php if( $errmsg != '') echo "<h4>$errmsg</h4>";	?>

				<?php if($edit) { ?>
					<form action="profile.php" method="post" name="userInfo">
					<input type="hidden" name="register" value="<?php echo $register?>">
				<?php } ?>
				<table border="0" align="center" cellpadding="5" width="60%">

					<?php if($register){?>
					<tr><td align="right" width="30%" nowrap ><?php echo $msg['t112']?></td><td><input type="text" name="user_name" value="<?php echo $req['user_name']?>"></td></tr>
					<tr><td align="right" ><?php echo $msg['t113']?></td><td><input type="password" name="password" value=""></td></tr>
					<tr><td align="right" nowrap><?php echo $msg['t114']?></td><td><input type="password" name="password2" value=""></td></tr>
<?php
						if($enable_reg) { ?>
							<tr><td align="right" nowrap valign="middle"><?php echo $msg['t115']?></td>
							<td align="left" nowrap><INPUT type="radio" name="role" value="<?php echo ROLE_USER;?>" style="width:auto" <?php if($req['role'] == ROLE_USER || !isset($req['role']))echo 'CHECKED'; ?> > <?php echo $msg['t116']?>
											 <br><INPUT type="radio" name="role" value="<?php echo ROLE_ADMIN;?>" style="width:auto" <?php if($req['role'] == ROLE_ADMIN)echo 'CHECKED'; ?> > <?php echo $msg['t117']?>
											 <br><INPUT type="radio" name="role" value="<?php echo ROLE_SPY;?>" style="width:auto"   <?php if($req['role'] == ROLE_SPY)echo 'CHECKED'; ?>> <?php echo $msg['t118']?>
							</td></tr>
<?php						}
						elseif($firstUser)
						{?>

						<tr><td align="right" nowrap valign="middle"><?php echo $msg['t115']?></td>
							<td align="left" nowrap><INPUT CHECKED type="radio" name="role" value="<?php echo ROLE_ADMIN;?>" style="width:auto" <?php if($req['role'] == ROLE_ADMIN)echo 'CHECKED'; ?> > <?php echo $msg['t117']?>
							</td></tr>

						<?php

						}
						elseif($GLOBALS['fc_config']['liveSupportMode'])
						{?>
							<tr><td align="right" nowrap valign="middle"><?php echo $msg['t123']?></td>
							<td align="left" nowrap><INPUT CHECKED type="radio" name="role" value="<?php echo ROLE_CUSTOMER;?>" style="width:auto" <?php if($req['role'] == ROLE_CUSTOMER)echo 'CHECKED'; ?> > <?php echo $msg['t123']?>
							</td></tr>
					  <?php	
						}						
					  }
					  ?>

					<tr><td align="right" width="30%" nowrap><?php echo $msg['t01']?></td><td><?php if($edit) { ?><input type="text" name="fullname" value="<?php echo $req['fullname']?>"><?php } else { ?><?php echo $req['fullname']?><?php } ?></td></tr>

					<tr><td align="right"><?php echo $msg['t43']?></td><td><?php if($edit) { echo htmlSelect('gender', $gender_arr, $req['gender']); } else { echo $gender_arr[$req['gender']]; } ?></td></tr>

					<tr><td align="right"><?php echo $msg['t04']?></td><td><?php if($edit) { ?><input type="text" name="age" value="<?php echo $req['age']?>"><?php } else { ?><?php echo $req['age']?><?php } ?></td></tr>

					<tr><td align="right"><?php echo $msg['t44']?></td><td><?php if($edit) {  echo htmlSelect('location', $countries, $req['location']); } else { echo $countries[$req['location']]; } ?></td></tr>

					<tr><td align="right"><?php echo $msg['t05']?></td><td><?php if($edit) { ?><input type="text" name="email" value="<?php echo $req['email']?>"><?php } else { ?> <a href="mailto:<?php echo $req['email']?>"><?php echo $req['email']?></a><?php } ?></td></tr>
					<tr><td align="right"><?php echo $msg['t07']?></td><td><?php if($edit) { ?><input type="text" name="site" value="<?php echo $req['site']?>"><?php } else { ?> <a href="<?php echo $req['site']?>" target="_blank"><?php echo $req['site']?></a><?php } ?></td></tr>
					<tr><td align="right"><?php echo $msg['t10']?></td><td><?php if($edit) { ?><input type="text" name="icq" value="<?php echo $req['icq']?>"><?php } else { ?><?php echo $req['icq']?><?php } ?></td></tr>
					<tr><td align="right"><?php echo $msg['t41']?></td><td><?php if($edit) { ?><input type="text" name="aim" value="<?php echo $req['aim']?>"><?php } else { ?><?php echo $req['aim']?><?php } ?></td></tr>
					<tr><td align="right"><?php echo $msg['t42']?></td><td><?php if($edit) { ?><input type="text" name="yim" value="<?php echo $req['yim']?>"><?php } else { ?><?php echo $req['yim']?><?php } ?></td></tr>
					<tr><td align="right"><?php echo $msg['t06']?></td><td><?php if($edit) { ?><input type="text" name="msnm" value="<?php echo $req['msnm']?>"><?php } else { ?><?php echo $req['msnm']?><?php } ?></td></tr>
					<tr><td align="right" valign="top"><?php echo $msg['t13']?></td><td><?php if($edit) { ?><textarea name="comments" rows="6" cols="30"><?php echo $req['comments']?></textarea><?php } else { ?><?php echo nl2br($req['comments'])?><?php } ?></tr>
					<?php if($edit) { ?>
					<tr><td></td><td><input type="submit" name="save" value="<?php echo $msg['t14']?>" onClick="javascript:return formIsValid();"></td></tr>
					<?php } ?>
				</table>
				<?php if($edit) { ?>
					</form>
				<?php } ?>
			</center>

<?php } else { ?>
		<title><?php echo $msg['t17']?> <?php echo $req['userid']?></title>
		</head>
		<body>
			<center><h4><?php echo $msg['t17']?> <?php echo $req['userid']?></h4></center>
<?php } ?>
	</body>
	</html>
<?php } ?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -