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

📄 step_5.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
字号:
<?php

import_request_variables( "P" );

$enc_types = array(		'none' => 'not encrypted (plain text)',
						'md5'  => 'md5',
						'mysql_pass' => 'MySQL Password Function',
					 );

$dbpref = '';
$errmsg = connectToDB('','','','', $dbpref);

function processUpdate()
{
	global $table_name, $user_fld, $pass_fld,
		   $profile_path, $moderator_fld, $spy_fld, $user_id_fld,
		   $encode_type, $spy_value, $profile_path, $profile_arg, $moderator_value,
		   $logoff;

	//check spy
	if( $spy_fld != '' && trim($spy_value) == '')
	{
		$spy_fld = '_#_';
		$spy_value = '_#_';
	}

	//---

	//---
	$fname = './inc/cmses/defaultUsrExtCMS.php';
	if( ! file_exists($fname) ) return "File '$fname' not found.";
	if( ! is_writable($fname) ) return "File '$fname' not writable.";

	//all Ok process

	$fname = './inc/cmses/defaultUsrExtCMS.php';
	$ftmpl = './inc/cmses/defaultUsrExtCMS_tmpl.php';

	$contents = getConfigData($ftmpl);

	$old_val = array( '%users%',
					  '%login%',
					  '%id%',
					  '%password%',
					  '%roles%',
					  '%encode_type%',
					  '%spy_fld%',
					  '%spy_value%',
					  '%profile_path%',
					  '%profile_arg%',
					  '%moderator_fld%',
					  '%moderator_value%',
					  '%logoff%');

	$new_val = array( $table_name,
					  $user_fld,
					  $user_id_fld,
					  $pass_fld,
					  $moderator_fld,
					  $encode_type,
					  $spy_fld,
					  $spy_value,
					  $profile_path,
					  str_replace('{','{$',$profile_arg),
					  $moderator_fld,
					  $moderator_value,
					  $logoff );

	if( $spy_value == '_#_' )$spy_value = '';

	$contents = str_replace($old_val, $new_val, $contents);

	$res = writeConfig($contents,$fname);

	if(!$res) return "<b>Could not write to '$fname' file</b>";

	return '';
}


if( $_POST['submit_btn'] )
{
		$step = 6;

		//---
		$errmsg = processUpdate();
		//---

		//FOR TESTING

		//if( $errmsg == '') $errmsg = '*** defaultUsrExtCMS.php updated successful plese test your chat *** only for test ***';

		//-----------
		if( $errmsg == '')
			{
				//redirect_inst to step 3
				echo '<script language="JavaScript" type="text/javascript">
					<!--// redirect_inst
			  			window.location.href = "install.php?step='. $step .'";
					//-->
				 </script>
				';

				die;
			}
}
//----
//get tables
$res = db_get_array('SHOW TABLE STATUS');
$table_list = array();

foreach($res as $k=>$v)
{
	$table_list[$v['Name']] = $v['Name'];
}
//get fields
if( !isset($table_name) || $table_name == '') $table_name = $res[0]['Name'];

$res = db_get_array("SHOW FIELDS FROM `$table_name`", 'Field');
$field_list = array();
foreach($res as $k=>$v)
{
	$field_list[$k] = $v['Field'];
}

if( !$profile_path )
{
	$request = $_SERVER['SCRIPT_NAME'];
	$docroot = ( preg_match( '/\/(.+)\/.*/', $request, $matches ) ) ? '/'. $matches[1] .'/' : '/';
	$profile_path = 'http://' . $_SERVER['HTTP_HOST'] . $docroot . 'profile.php';
}

if( !$profile_arg ) $profile_arg = '?user={...}';

if( !$logoff )
{
   $logoff = 'false';
}

//----
include INST_DIR . 'header.php';
?>

<TR>
	<TD colspan="2"></TD>
</TR>
<TR>
	<TD colspan="2" class="subtitle">Step 5: Integrating FlashChat with an existing user database</TD>
</TR>
<TR>
	<TD colspan="2" class="normal">
	<p>You have specified that FlashChat should draw from an existing user database. This will configure the "/inc/cmses/defaultCMS.php" file so that only your existing users are allowed to login to FlashChat.
	</p>
	<p>Please complete the options below so that FlashChat knows how to retrieve user information from your database:
	</p>
	</TD>
</TR>


<tr ><td colspan=2 class="error_border" ><font color="red"><?php echo @$errmsg; ?></font></td></tr>

<FORM action="install.php?step=5" method="post" align="center" name="installInfo">
	<TR >
		<TD colspan="2" >
			<TABLE  class="body_table" border="0" cellspacing="10">

				<TR>
					<TD width="10%" nowrap align="right">Table containing user names and passwords:</TD>
					<TD> <?php echo htmlSelect("table_name", $table_list, $table_name, 'onChange="installInfo.submit();"'); ?></TD>
				</TR>
				<TR>
					<TD nowrap align="right">User "ID" field:	</TD>
					<TD> <?php echo htmlSelect("user_id_fld", $field_list, $user_id_fld, 'onChange="addUserID(this,profile_arg);"'); ?> (this should be a unique, primary key field)</TD>
				</TR>
				<TR>
					<TD nowrap align="right">Username field:	</TD>
					<TD> <?php echo htmlSelect("user_fld", $field_list, $user_fld); ?></TD>
				</TR>
				<TR>
					<TD nowrap align="right">Password field:	</TD>
					<TD> <?php echo htmlSelect("pass_fld", $field_list, $pass_fld); ?></TD>
				</TR>
				<TR>
					<TD colspan="2">
						If the password in this table and field are encrypted, which of the following encryption types is used?

						<?php
						    echo htmlSelect("encode_type", $enc_types, $encode_type);
						?>

					</TD>

				</TR>
				<TR>
					<td colspan="2">
					Full URL path to profile.php (or similar file):<br>
					<INPUT type="text" size="91" name="profile_path" value="<?php echo $profile_path ?>">.<br>
					This is the file that FlashChat will attempt to access when a user's profile is requested from the FlashChat interface.
					</td>
				</TR>

				<TR>
					<td colspan="2">
					URL string for user profile information, relative to this path. The user name or id should be enclosed in {}, and should indicate the field name that FlashChat should use when passing the information to the profile PHP file:<br>
					<INPUT type="text" size="91" name="profile_arg" value="<?php echo $profile_arg ?>"><br>
					For example: ?user={user_id}
					</td>
				</TR>

				<TR>
					<td colspan="2">
						<p>FlashChat needs to know how moderators and spies are determined in your user database.<br>Please complete the following (field = value)</p>
						A user is a moderator if the following is true...<br>

						<?php echo htmlSelect("moderator_fld", $field_list, $moderator_fld); ?> = <INPUT type="text" size="41" name="moderator_value" value="<?php echo $moderator_value ?>"><br>
						(optional) A user is a spy if the following is true...<br>
						<?php echo htmlSelect("spy_fld", $field_list, $spy_fld); ?> = <INPUT type="text" size="41" name="spy_value" value="<?php echo $spy_value ?>"><br>
					</td>
				</TR>

				<TR>
					<td colspan="2">
						When a user logs out of FlashChat, which of the following should occur?<br>
						<INPUT type="radio" name="logoff" value="false" <?php if($logoff == 'false')echo 'CHECKED' ;?> >The user should remain logged-in to my system.<br>
						<INPUT type="radio" name="logoff" value="true"  <?php if($logoff == 'true') echo 'CHECKED' ;?>>The user should be logged-out of my system.
					</td>
				</TR>

			</TABLE>
		</td>
		</tr>
	<TR>
		<TD>&nbsp;</TD>
		<TD align="right">
			<INPUT type="submit" name="submit_btn" value="Continue >>" onClick="javascript:return fieldsAreValid('spy_fld spy_value');">
		</TD>
	</TR>
</FORM>
	<tr>
	<td colspan="2">
	&nbsp;
	</td>
	</tr>


	<script type="text/javascript">
		addUserID(document.installInfo.user_id_fld, document.installInfo.profile_arg);
	</script>

<?php
include INST_DIR . 'footer.php';
?>

⌨️ 快捷键说明

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