<?php
// -------------------------------------------------
// included files

include("ie_global.php");
include("ie_config.php");
include("ie_tpl.php");
include("lang.inc.php");


// ------------------------------------------------
if (file_exists('setup.lock'))
{
	$con = $sp_txt[0];
	tpl_show( $con,$sp_txt[1]);
	exit;

}

if ( $step == '')
{
	$step = 1 ;
}

if ( $step ==1 )
{
	//show the 
	$con = '
 <form action="setup.php" method="post">
  <p><span lang="zh-cn">'.$sp_txt[2].' </span></p>
  <p><span lang="zh-cn">'.$sp_txt[3].' </span>
  <input type="text" name="name" size="20" style="border: 1px solid #000000"></p>
  <p><span lang="zh-cn">'.$sp_txt[4].' </span>
  <input type="password" name="pass1" size="20" style="border: 1px solid #000000"></p>
  <p><span lang="zh-cn">'.$sp_txt[5].' </span>
  <input type="password" name="pass2" size="20" style="border: 1px solid #000000"></p>
  <input type="hidden" name="step" value="2">
  <p> </p>
  <p> </p>
  <input type="submit" value="'.$sp_txt[6].'">
</form>
	';
	$tmp1 = new tpl( "admin_center.htm" );
	$tmp1->assign( "content", $con );
	$tmp1->assign( "page_title", $sp_txt[7] );
	$tmp1->printe();
}

if ( $step == 2 )
{
	if ( $pass1 <> $pass2 )
	{
		$con = '
		'.$sp_txt[8].'<p>
		<a href="javascript:history.back(-1)">'.$sp_txt[9].'</a><p>
		';
		tpl_show( $con,$sp_txt[10]);
		exit;
	}

	// Create the account
	$txt = '
	$superadmin = "'.$name.'";'."\n".'
	$password = "'.$pass1.'";'."\n";
	$text ='<'.'?php '."\n".$txt.'?'.'>';

	write2_file_new( 'admin.inc.php',$text );
	write2_file_new( 'setup.lock','locked' );

	$con = '
	'.$sp_txt[11].'<p>
	<a href="login.php">'.$sp_txt[12].'</a><p>
	';
	tpl_show( $con,$sp_txt[13]);

}

?>