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

📄 profile.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
	include_once('inc/common.php');


	// ******** Start of customization variables
	$enable_reg  = false;						// Enable registration options for admin/moderators and spies if set to true, set to false to disable these options
	

	$ext             = array('.gif', '.jpg', '.png', '.bmp');  // limit upload to these file types only
	$ufolder         = './nick_image/';			// picture upload folder
	$max_file_size   = 500*1024;                // max picture file size in bytes
	$edit_allowed    = true;					// limitation for guest chatters (only show registered users if false) if FlashChat in two instance mode
	$pictureWidth    = 180;						// picture display width limit pixels
	$thumbWidth      = 90;						// thumbnail picture display width limit in gallery pixels
	$showAllProfiles = true;					// display list of links to all active profiles at each page
	$showGallery     = true;					// when displaying all profiles: use gallery style
	$FC_owner_email  = 'xyz@your_domain.com';	// FlashChat owner email address, set as sender/reply to in password change
	$FC_owner_name   = 'FlashChat Owner name';	// FlashChat owner name (link text)
	$pics_row	     = 4;						// number of pictures per row when in showGallery mode
	$default_country = 'USA';					// default country in english at registration (must be found in /chat/inc/country.inc
	$profiles_per_page = 50;					// visible profiles per page


	include_once('./profile/en.php');					//default language is en ie english
    if ($req['lang'] == 'xx')include_once('./profile/xx.php');	// replace xx with your language attribute and make available this file in /chat/profile directory
											// duplicate this /profile/en.php if you need more than two languages
											// remember UTF-8 characters but not for messages t23-t27 (error messages)
	// ******** End of customizations


	define('CRLF', "\r\n");

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

	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
	header("Cache-Control: no-store, no-cache, must-revalidate");
	header("Cache-Control: post-check=0, pre-check=0", false);
	header("Pragma: no-cache");

	$userid = 0;
	$error = false;

	$cmsclass = strtolower( $GLOBALS['fc_config']['CMSsystem'] );

	$manageUsers = ($cmsclass == 'defaultcms') || ($cmsclass == 'statelesscms');
	if(!$manageUsers){die("Profiles are only supported for defaultCMS and statelessCMS");}

	$req['change_id'] = $req['userid'];
	if(isset($req['flashchatid'])) {
		$req['id'] = $req['flashchatid'];
		$conn =& ChatServer::getConnection($req);
		$req['id'] = $conn->userid;
		if(!$req['id']) die ('<center><b>NoNo<br>You must be logged in to FlashChat to use this command</b></center>');
		$req['lang'] = $conn->lang;
		$user = $GLOBALS['fc_config']['cms']->getUser($req['id']);
		$req['roles'] = $user['roles'];

		if(isset($req['admin_user_edit'])) $req['change_id'] = $req['cid'];
		if($req['admin_user_edit'] == 'hidden_edit') $req['change_id'] = $req['cid1'];

	}

	if(!isset($req['lang'])){
		$langStmt = new Statement("SELECT lang FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE id=?");
		$rs = $langStmt->process($req['id']);
		$rec = $rs->next();
		$req['lang'] = $rec['lang'];}


	function removeEvilAttributes($tagSource) {

		$stripAttrib = "' (style|class)=\"(.*?)\"'i";
		$tagSource = stripslashes($tagSource);
		$tagSource = preg_replace($stripAttrib, '', $tagSource);

		return $tagSource;
	}

	function removeEvilTags($source) {

   		$allowedTags =	'<a><br><b><h1><h2><h3><h4><i>' .
					'<img><li><ol><p><strong><table>' .
					'<tr><td><th><u><ul>';
		$source = strip_tags($source, $allowedTags);

		return preg_replace('/<(.*?)>/ie', "'<'.removeEvilAttributes('\\1').'>'", $source);
	}


	function send_style_sheet($msg) {

		$showBackground  = true;					// set to true if you have a nice background to add

		$bgcolor    = '#eeeeee';					// text background color leave empty (= '';) for no color (transparent)
//		$bgcolor	= htmlColor($GLOBALS['fc_config']['themes'][$GLOBALS['fc_config']['defaultTheme']]['enterRoomNotify']);

		$bkgrnd = $GLOBALS['fc_config']['themes'][$GLOBALS['fc_config']['defaultTheme']]['backgroundImage']; // default background is the default theme
//		$bkgrnd = 'http://www.yourdomain.com/mybackgroundfile.jpg';		// uncomment this line to use your own background image

		$background = '<body background="' . $bkgrnd . '">';			// use default theme background jpg
//		$background = '<body bgcolor="' . $bgcolor . '">';			// uncomment this line to use text background color as background

		print '<html><title>' . $msg . '</title>';
		print '<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
		print '<style type="text/css">';
		print '<!--';
		print 'td	 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; background-color: ' . $bgcolor . '; color: #000000;}';
		print 'tr		{border: 1px solid #000000; }';
		print 'h2	 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 16px;	font-weight: bold; width: 50%; background-color1: ' . $bgcolor . '; color: #000000;}';
		print 'h3	 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; width: 50%; background-color1: ' . $bgcolor . '; color: #000000;}';
		print 'h4	 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; width: 50%; background-color1: ' . $bgcolor . '; color: #FF0000;}';
		print '.small 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 10px;	font-weight: normal;}';
		print '.pages 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal;}';
		print 'div.Thanks	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; width: 60%; background-color1: ' . $bgcolor . '; text-align: center; color: #000000;}';
		print 'div.die	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: bold; width: 60%; background-color1: ' . $bgcolor . '; text-align: center; color: #000000;}';
		print '.title 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 16px;	font-weight: bold;}';
		print 'input 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; color: #000000; width: 80%;}';
		print 'textarea 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; color: #000000; width: 80%;}';
		print 'select 	{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 12px;	font-weight: normal; color: #000000; width: 80%;}';
		print 'A 		{font-family: Verdana, Arial, Helvetica, sans-serif;  font-size: 12px;	color: #0000FF;}';
		//print 'a:link 	{font-family: Verdana, Arial, Helvetica, sans-serif;  font-size: 11px;  color: #00CCFF; hover: #FF0000 }';
		//print 'a:link:hover 	{color: #DD6900;}';
		//print 'a:link:visited 	{color: #0099FF;}';
		print 'A:hover 	{font-family: Verdana, Arial, Helvetica, sans-serif;  font-size: 12px;	color: #FF0000;}';
		print '.body_table {border: 1px solid #000000; background-color: ' . $bgcolor . '; }';
		print '-->';
		print '</style></head>';

		if($showBackground) print $background;

	}


	$font = '<center><div class="die"><center><br>';	// some error printouts in file upload section

	$register = false;
	$fc_std_profile = false;
	if($req['register'] == 'true') {$fc_std_profile = true; $register = true;}
	if( isset($req['save']) ) {$fc_std_profile = true;}


//-------------------------------------------------
//generate html combo
//-------------------------------------------------
function htmlSelect($name, $arr, $selected, $addprop='')
{
	$ret = "<SELECT name=\"$name\" $addprop>";

	foreach($arr as $k=>$v)
	{
		if($selected == $k)$sel = 'SELECTED';
		else $sel = '';

		$ret .= "<option value=\"$k\" $sel>$v";
	}

	$ret .=	"</SELECT>";

	return $ret;
}

$gender_arr = array(
				'male'   => $msg['t102'],
				'female' => $msg['t103'],
				'other'  => $msg['t104']
			  );
//---

	if(!$fc_std_profile) {	// addon part

	function makeRandomPassword() 
	{
		$salt = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ0123456789";
		srand((double)microtime()*1000000);
		$i = 0;
		while ($i <= 8) {
			$num = rand() % 56;
			$tmp = substr($salt, $num, 1);
			$pass = $pass . $tmp;
			$i++;
		}
		return $pass;
	}


	function tryagain($msg1, $msg2, $msg3, $type) 
	{
		send_style_sheet($msg3);
		die ('<div align="center"><h3><br>' . $msg1 . '<br>&nbsp;</h3><br><a href="profile.php?' . $type . '=true">' . $msg2 . '</a></div></html>');
	}

	$fields = array(
		't01' => '',
		't02' => '',
		't03' => '',
		't04' => '',
		't05' => '',
		't06' => '',
		't07' => '',
		't08' => '',
		't09' => '',
		't10' => '',
		't11' => '',
		't12' => '',
		't13' => '',
		't14' => '',
		't15' => '',
		't41' => '',
		't42' => '',
		't43' => '',
		't44' => ''
	);

if(isset($req['newpassword'])) {  	// user wants new password sent to registered email address

	send_style_sheet($msg['t56']);

	print '<div align=center><h2>' . $msg['t47'] . '</h2><h3>' . $msg['t120'] . '</h3></div>';

	print '<div align=center><tbody><tr vAlign="top"><center><table border="0" width="600">';
	print '<form action="profile.php" method="post">';
	print '<tr><td align="right" width="250">' . $msg['t48'] . '</td>';
	print '<td align="left"><input type="text" name="nick" size="32" value=""></td></tr>';
	print '<tr><td align="right" width="250">' . $msg['t49'] . '</td>';
	print '<td align="left"><input type="text" name="email" size="32" value=""></td></tr>';

 	print '<tr><td></td><td><input type="submit" name="sendnewpassword" value="' . $msg['t50'] . '"></td></tr>';
	die ('</table></form></div></body></html>');
}

if(isset($req['oldpassword'])) {  	// user wants old password sent to registered email address

	send_style_sheet($msg['t56']);

	print '<div align=center><h2>' . $msg['t61'] . '</h2><h3>' . $msg['t120'] . '</h3></div>';

	print '<div align=center><tbody><tr vAlign="top"><center><table border="0" width="600">';
	print '<form action="profile.php" method="post">';
	print '<tr><td align="right" width="250">' . $msg['t48'] . '</td>';
	print '<td align="left"><input type="text" name="nick" size="32" value=""></td></tr>';
	print '<tr><td align="right" width="250">' . $msg['t49'] . '</td>';
	print '<td align="left"><input type="text" name="email" size="32" value=""></td></tr>';

 	print '<tr><td></td><td><input type="submit" name="sendoldpassword" value="' . $msg['t62'] . '"></td></tr>';
	die ('</table></form></div></body></html>');
}

if(isset($req['sendoldpassword'])) // send old password to registered email address
{  	
	$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}users WHERE login=?");
	$rs = $stmt->process($req['nick']);
	
	if(($rec = $rs->next()) && $rec['profile']) 
	{	
		$profile = unserialize($rec['profile']);
	} 
	else {tryagain($msg['t55'], $msg['t61'], $msg['t57'], 'oldpassword');}

	if( isset( $profile['fullname'] ) && isset( $profile['email'] )) { $profile['t05'] = $profile['email'];}
	
	if($profile['t05'] == $req['email']) 
	{
		if(!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $profile['t05']))
		{
			tryagain($msg['t60'] . ' <a href="mailto:' . $FC_owner_email . '">' . $FC_owner_name . '</a>', $msg['t61'], $msg['t57'], 'oldpassword');
		}
		
		if( $GLOBALS['fc_config']['encryptPass'] )//password encrypted generate new password
		{
			$newPass = makeRandomPassword();	
			$rec['password'] = $newPass;		
		}
		
  		$headers .= "MIME-Version: 1.0\n";
  		$headers .= "Content-type: text/plain; charset=UTF-8\n";
  		$headers .= "X-Mailer: php\n";
  		$headers .= "From: \"" . $FC_owner_name . "\" <" . $FC_owner_email . ">\n";
		
  		if( mail($req['email'], $msg['t63'] . ' ' . $rec['login'], $msg['t64'] . CRLF . CRLF . $rec['password'] . CRLF . CRLF . $msg['t53'], $headers) )
		{
			if( $GLOBALS['fc_config']['encryptPass'] )//setup new password
			{
				$s = new Statement("UPDATE {$GLOBALS['fc_config']['db']['pref']}users SET `password`=MD5(?) WHERE login=? LIMIT 1");
				$r = $s->process($newPass, $req['nick']);
			}			
		}
		else
		{
			tryagain($msg['t59'], $msg['t61'], $msg['t57'], 'oldpassword');
		}
	} 
	else 
	{
		tryagain($msg['t55'], $msg['t61'], $msg['t57'], 'oldpassword');
	}

	send_style_sheet($msg['t56']);
	die ('<div align="center"><h3><br>' . $msg['t65'] . '<br>&nbsp;</h3><br><a href="index.php">' . $msg['t58'] . '</a></div></html>');
}

if(isset($req['sendnewpassword'])) {  	// send new password to registered email address

	$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}users WHERE login=?");
	$rs = $stmt->process($req['nick']);
		
	if(($rec = $rs->next()) && $rec['profile']) {$profile = unserialize($rec['profile']);} else {tryagain($msg['t55'], $msg['t47'], $msg['t57'], 'newpassword');}
	
	if($profile['fullname']) { $profile['t05'] = $profile['email'];}
	
	if($profile['t05'] == $req['email']) 
	{
		if(!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $profile['t05']))
		{tryagain($msg['t60'] . ' <a href="mailto:' . $FC_owner_email . '">' . $FC_owner_name . '</a>', $msg['t47'], $msg['t57'], 'newpassword');}
		
		$newpassword = makeRandomPassword();
  		$headers .= "MIME-Version: 1.0\n";
  		$headers .= "Content-type: text/plain; charset=UTF-8\n";
  		$headers .= "X-Mailer: php\n";
  		$headers .= "From: \"" . $FC_owner_name . "\" <" . $FC_owner_email . ">\n";
  		if(mail($req['email'], $msg['t51'] . ' ' . $rec['login'], $msg['t52'] . CRLF . CRLF . $newpassword . CRLF . CRLF . $msg['t53'], $headers)) 
		{
			$stmt = new Statement("UPDATE {$GLOBALS['fc_config']['db']['pref']}users SET password=? WHERE id=?");
			if( $GLOBALS['fc_config']['encryptPass'] > 0 ) {$newpassword = md5($newpassword);}
			$stmt->process($newpassword, $rec['id']);
		} 
		else {tryagain($msg['t59'], $msg['t47'], $msg['t57'], 'newpassword');}
	} 
	else {tryagain($msg['t55'], $msg['t47'], $msg['t57'], 'newpassword');}

	send_style_sheet($msg['t56']);
	die ('<div align="center"><h3><br>' . $msg['t54'] . '<br>&nbsp;</h3><br><a href="index.php">' . $msg['t58'] . '</a></div></html>');
}

⌨️ 快捷键说明

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