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

include("ie_global.php");
include("ie_config.php");
include("ie_tpl.php");
include("lang.inc.php");
include_once("ie_count.php");
check( "logged" );

//-----------------------------------
$time_start = getmicrotime();
//-----------------------------------

// get the value of dir list
$img_list = $img_dir.'/list.inc.php';
@$ie_list = file( $img_list );
$list_count = count ( $ie_list );

for ($i = 0 ; $i < $list_count ; $i++ )
{
	$list_result[$i] = array();
	$list_result[$i] = explode ( "|" , $ie_list[$i] );
	$lt = $list_result[$i];
	$menu .= '<li><span lang="zh-cn">'.$aw_txt[0].' '.$lt[1].' '.$aw_txt[1].'</span></li>';
	$menu2 .= '<option value="'.$lt[0].'">'.$lt[1].'</option>';
	$menu3 .= '<li><span lang="zh-cn"><a href="ie_showdir.php?view=admin&dir='.$lt[0].'">'.$lt[1].' </a></span></li>';
}


if ( $dir<>'' )
{
	// get the list	
	$img_list2 = $img_dir.'/'.$dir.'/list.inc.php';
	@$ie_list2 = file( $img_list2 );
	$list_count2 = count ( $ie_list2 );
	//echo $list_count;

	for ($i = 0 ; $i < $list_count2 ; $i++ )
	{
		$list_result2[$i] = array();
		$list_result2[$i] = explode ( "|" , $ie_list2[$i] );		
	}
}



// get the action

// ----------------------------
// action == ''

if ( !isset( $action ) )
{
	$action = 'showindex';
}

// -----------------------------
// action == showindex

if ( $action == 'showindex' )
{
	//show the list
	$text_content = '
<p><span lang="zh-cn">'.$aw_txt[2].'<font size="5" color="#00FF00" face="Comic Sans MS"> 
IE++ </font>'.$aw_txt[3].'</span></p>
<p><span lang="zh-cn">'.$aw_txt[4].'</span></p>
<p><span style="background-color: #FFFF00" lang="zh-cn"> '.$aw_txt[5].'</span></p>
<p><span lang="zh-cn">&nbsp;&nbsp; £­ '.$aw_txt[6].'</span></p>
<ul>
  <li><span lang="zh-cn"><a href="admin_wizard.php?action=addpic">'.$aw_txt[7].'</a></span></li>
  <li><span lang="zh-cn"><a href="admin_wizard.php?action=addcate">'.$aw_txt[8].'</a></span></li>
  <li><span lang="zh-cn"><a href="admin_wizard.php?action=modifypic">'.$aw_txt[9].'</a></span></li>
  <li><span lang="zh-cn"><a href="admin_wizard.php?action=modifycate">'.$aw_txt[10].'</a></span></li>
  <li><span lang="zh-cn">'.$aw_txt[11].' </span></li>
</ul>
<p><span lang="zh-cn"><font color=red>'.$aw_txt[12].'</font></span></p>
<p><span style="background-color: #FFFF00" lang="zh-cn">'.$aw_txt[13].'</span></p>
<p><span lang="zh-cn">&nbsp;&nbsp; £­ '.$aw_txt[14].'</span></p>
<ul>
  <li><span lang="zh-cn">'.$aw_txt[15].'</span></li>
  <li><span lang="zh-cn">'.$aw_txt[16].'</span></li>
  <li><span lang="zh-cn">'.$aw_txt[17].'</span></li>
  <li><span lang="zh-cn">'.$aw_txt[18].'</span></li>
</ul>
<p><span style="background-color: #FFFF00" lang="zh-cn">'.$aw_txt[19].'</span></p>
<p><span lang="zh-cn">&nbsp;&nbsp; £­'.$aw_txt[20].'</span></p>
<ul>
  <li><span lang="zh-cn">'.$aw_txt[21].'</span></li>'
.$menu.'
</ul>
<p>¡¡</p>
';

tpl_show( $text_content,$aw_txt[22]);

}

// -------------------------------------

if ( $action == 'addpic' )
{
	// echo 'addpic';
	if ( !isset( $step ))
	{
		$step = 1;
	}

	if ( $step == 1 )
	{
		//show the form 
		$text_content = '
  <form action="admin_wizard.php" method="post" ENCTYPE="multipart/form-data">
  <span lang="zh-cn">'.$aw_txt[23].'&nbsp;&nbsp; </span>
  <select size="1" name="dir">
'.$menu2.'
  </select><span lang="zh-cn"> </span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_wizard.php?action=addcate">'.$aw_txt[24].'</a> </p>
  <p><span lang="zh-cn">'.$aw_txt[25].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[26].'   </span>
  <input type="text" name="imgid" size="20" style="border: 1px solid #000000">&nbsp;&nbsp;&nbsp;<font color=red>'.$aw_txt[27].'</font><span lang="zh-cn">
  </span></p>
  <p><span lang="zh-cn">'.$aw_txt[28].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[29].'   </span>
  <input type="text" name="imgname" size="20" style="border: 1px solid #000000"></p>
  <p><span lang="zh-cn">'.$aw_txt[30].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[31].'</span><input type="text" name="imgfrom" size="20" style="border: 1px solid #000000" value="'
  .$site_name.
 '"></p>
  <p><span lang="zh-cn">'.$aw_txt[32].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[33].'<select size="1" name="imgrecom">
  <option value="1">'.$aw_txt[34].'</option>
  <option value="2">'.$aw_txt[35].'</option>
  <option value="3" selected>'.$aw_txt[36].'</option>
  <option value="4">'.$aw_txt[37].'</option>
  <option value="5">'.$aw_txt[38].'</option>
  </select></span></p>
  <p><span lang="zh-cn">'.$aw_txt[39].'</span></p>
		';
		
		if ( $smimg_create <> 'on' || $gd_support <> 'enable')
		{
			//upload 2 img then ok~
			$text_content .= '
  <p><span lang="zh-cn">'.$aw_txt[40].'<input type="file" name="file[]" size="19"> </span></p>
  <p><span lang="zh-cn">'.$aw_txt[41].'<input type="file" name="file[]" size="19"> </span></p>
  <p><span lang="zh-cn">[ '.$aw_txt[42].' ]</span></p>
  <input type="hidden" name="picturestyle" value="smoff">							';

		}

		if ( $smimg_create == 'on' && $gd_support == 'enable')
		{
			//
			$text_content .= '
  <p><span lang="zh-cn">'.$aw_txt[43].'<input type="file" name="file" size="19"> </span></p>
  <p><span lang="zh-cn">[ '.$aw_txt[44].' ]</span></p>
  <input type="hidden" name="picturestyle" value="smon">	  
			';
		}
		$text_content .= '
		<input type="hidden" name="action" value="addpic">
		<input type="hidden" name="step" value="2">
		<input type="submit" value="Ìí¼ÓÍ¼Æ¬">
		</form>
		';
		tpl_show( $text_content,$aw_txt[45]);
	}

	if ( $step == 2 )
	{
		//deal with the data 

		// begin to check the data
		
		unset ( $error );

		if ( $dir == '' )
		{
			$error .= $aw_txt[46];
		}
		
		//echo 'imgid='.$imgid;
		if ( $imgid == '' )
		{
			if ( $picturestyle == 'smon' )
			{
				$imgid = $file_name;	
			}
			else
			{
				$imgid = $file_name[0];
			}
			
		}

		if ($admin <> 'on')
		{
			for ($i = 0 ; $i < $list_count2 ; $i++ )
			{
				$lt2 = $list_result2[$i];
				if ($imgid == $lt2[0])
				{
					$error .= $aw_txt[47];
				}
			}
		}
		
		
		
		if ( $imgname == '' )
		{
			$error .= $aw_txt[48];
		}
		
		if ( $imgfrom == '' )
		{
			$error .= $aw_txt[49];
		}
	
		if ( $imgrecom == '' )
		{
			$error .= $aw_txt[50];
		}

		if ( $admin<>'on' )
		{
			//
			if ( $picturestyle == '' )
			{
				$error .= $aw_txt[51];
			}
			else
			{
				//
				if ( ($picturestyle == 'smon') && ( $file_name == '' ) )
				{
					$error .= $aw_txt[52];
				}
			
				if ( ($picturestyle <> 'smon') && ( $file_name[0] == ''  || $file_name[1] == '' ))
				{
					$error .= $aw_txt[52];
				}

				if ( ($picturestyle == 'smon') && (strtolower(get_ext_name($file_name))<>'jpg')&& (strtolower(get_ext_name($file_name)<>'jpeg')))
				{
					$error .= $aw_txt[53];
				}

			}

		}

		
				
		// --------------
		if ( isset( $error ) )
		{
			$error .= '<p><a href="javascript:history.back(-1)">'.$aw_txt[54].'</a></p>';
			tpl_show( $error,$aw_txt[55]);
			exit;
		}

		// all data ok!
		// + add the data
		// + --- copy img
		// + --- update the list

		// ----------------------------------------------------------------------------

		$en_img = $img_dir.'/'.$dir.'/'.$imgid;
		$en_sm_img = $img_dir.'/'.$dir.'/tn/'.$imgid;
	
		

		if ( $admin <> 'on')
		{
			// =================================
					if ( $picturestyle == 'smon' )
		{
			// sm is on ; create sm image~		
			$ok = move_uploaded_file( $file , $en_img );
			
			// +Create img
			
			// +--1 get the size of the img
		    // ------------------------------------------------------------------------------

			$im_size = getimagesize( $en_img );
			// size[0] - width
			// size[1] - heigh
			$st_bl = 164/180;
			$im_bl = $im_size[0]/$im_size[1];

			if ( $smimg_style == 'whole')
			{
				//
				if ( $im_bl > $st_bl)
				{
					// is wider create the img according to the height
					
					
					$im_wid = $im_size[0];
					$im_hig = $im_wid / $st_bl;

				}
				else
				{
					// is higher 
					$im_hig = $im_size[1];
					$im_wid = $im_hig * $st_bl;
				}
				
				$im_x0 = ($im_size[0] - $im_wid)/2 ;
				$im_y0 = ($im_size[1] - $im_hig)/2 ;
				$im_x1 = $im_wid;
				$im_y1 = $im_hig;


			}
			else
			{
				if ( $im_bl > $st_bl)
				{
					// is wider create the img according to the height
					$im_hig = $im_size[1];
					$im_wid = $im_hig * $st_bl;

				}
				else
				{
					// is higher 
					$im_wid = $im_size[0];
					$im_hig = $im_wid / $st_bl;
				}

	
				// ----------------------------------
				
				if ( $smimg_style == 'up' )	
				{
					//
					$im_x0 = 0 ;
					$im_y0 = 0 ;
					$im_x1 = $im_wid;
					$im_y1 = $im_hig;
				}
				else
				{					
					//You can add more mode here
					$im_x0 = 0 ;
					$im_y0 = 0 ;
					$im_x1 = $im_wid;
					$im_y1 = $im_hig;

				}


			}
			
			// create the img
			$old_im = ImageCreateFromJPEG($en_img);
			$new_im = ImageCreateFromJPEG( 'images/img_bg.jpg' );
			Imagecopyresized($new_im, $old_im, 0, 0, $im_x0, $im_y0, 164, 180, $im_x1, $im_y1); 
			ImageJpeg( $new_im , $en_sm_img );
			ImageDestroy( $old_im );
			ImageDestroy( $new_im );


			// +--2 

		}
		else
		{
			//picturestyle == 'smoff'
			$im_size = Getimagesize($file[0]);
			move_uploaded_file( $file[0] , $en_img );
			move_uploaded_file( $file[1] , $en_sm_img );
		}

		// ------------------------
		// update the list

			for ($i = 0 ; $i < $list_count2 ; $i++ )
			{
				$ie_u_list .= $ie_list2[$i] ;		
			}

			// create new record
			$l_id = $imgid;
			$l_name = $imgname;
			$l_wh = $im_size[0].'¡Á'.$im_size[1];
			$l_size = intval(filesize($en_img)/1024).'K';
			$l_time = get_sys_date();
			$l_from = $imgfrom;
			$l_hit = 0;
			$l_recom = $imgrecom;

			$l_updated = $l_id.'|'.$l_name.'|'.$l_wh.'|'.$l_size.'|'.$l_time.'|'.$l_from.'|'.$l_hit.'|'.$l_recom."\n";
			$ie_u_list = $l_updated.$ie_u_list;
		
			write2_file_new( $img_dir.'/'.$dir.'/list.inc.php',$ie_u_list );


			for ($i = 0 ; $i < $list_count ; $i++ )
			{
				//
				$lt3 = $list_result[$i];
				if ( $lt3[0] == $dir )
				{
					// ----
					$lt3[5]++;
				}

				$updated_dlist .= $lt3[0].'|'.$lt3[1].'|'.$lt3[2].'|'.$lt3[3].'|'.$lt3[4].'|'.$lt3[5].'|'.$lt3[6];
			}	

			write2_file_new( $img_dir.'/list.inc.php',$updated_dlist );

			// =================================
		}
		else
		{
			// admin == on
			// update the dir list



			for ($i = 0 ; $i < $list_count2 ; $i++ )
			{

				$tln = array();
				$tln = $list_result2[$i];
				// format: 	0 id | 1 name | 2 wh | 3 size | 4 time | 5 from| 6 hit| 7 recommon
				if ( $tln[0] == $imgid)
				{
					// create new record
					$l_id = $tln[0];
					$l_name = $imgname;
					$l_wh = $tln[2];
					$l_size = $tln[3];
					$l_time = $tln[4];
					$l_from = $imgfrom;
					$l_hit = $tln[6];
					$l_recom = $imgrecom;

					$l_updated = $l_id.'|'.$l_name.'|'.$l_wh.'|'.$l_size.'|'.$l_time.'|'.$l_from.'|'.$l_hit.'|'.$l_recom."\n";
					$ie_u_list .= $l_updated;
					//echo $l_updated;
				}
				else
				{
					$ie_u_list .= $ie_list2[$i] ;
				}
						
			}

			write2_file_new( $img_dir.'/'.$dir.'/list.inc.php',$ie_u_list );

		}

				
		//echo $imgid;
		// display the info 
		$content2 = 
		'
		'.$aw_txt[56].'<p>
		'.$aw_txt[57].'<p>
		<a href="javascript:history.back(-1)">'.$aw_txt[54].'</a><p>
		<a href="admin_wizard.php">'.$aw_txt[58].'</a><p>
		';
		tpl_show( $content2,$aw_txt[59]);
		}
}

// ----------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
if ( $action == 'addcate')
{
	// add cates here ....

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

	if ( $step == 1 )	
	{
		// show the from here 
		$text_content = '
 <form action="admin_wizard.php" method="post" ENCTYPE="multipart/form-data">
  <p><span lang="zh-cn">'.$aw_txt[60].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[61].'</span><input type="text" name="dirid" size="20" style="border: 1px solid #000000"></p>
  <p><span lang="zh-cn">'.$aw_txt[62].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[63].'</span><input type="text" name="dirname" size="20" style="border: 1px solid #000000"></p>
  <p><span lang="zh-cn">'.$aw_txt[64].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[65].'</span></p>
  <p><textarea rows="8" name="dirdetail" cols="36"></textarea></p>
  <p><span lang="zh-cn">'.$aw_txt[66].'</span></p>
  <p><span lang="zh-cn"><input type="file" name="dirimg" size="27"><p>[ '.$aw_txt[67].' ]</span></p>
  <input type="hidden" name="action" value="addcate">
  <input type="hidden" name="step" value="2">
  <input type="submit" value="'.$aw_txt[68].'">
</form>
		';
		tpl_show( $text_content,$aw_txt[69].$site_name);

	}

	if ( $step == 2 )
	{
		// deal with the data
		
		// check data
		unset($error2);

		for ($i = 0 ; $i < $list_count ; $i++ )
		{
			$lt4 = $list_result[$i];
			if ( $lt4[0] == $dirid  && $admin<>'on' )
			{
				$error2 .= $aw_txt[70];
			}
		}

		if ($dirname == '')
		{
			$error2 .= $aw_txt[71];
		}

		if ($dirdetail == '')
		{
			$error2 .= $aw_txt[72];
		}

		if ($dirimg_name == '' && $admin<>'on' )
		{
			$error2 .= $aw_txt[73];
		}

		if ( isset( $error2 ) )
		{
			$error2 .= '<p><a href="javascript:history.back(-1)">'.$aw_txt[74].'</a></p>';
			tpl_show( $error2,$aw_txt[75]);
			exit;
		}

		
		if ( $admin == 'on')
		{
			// admin mode

			for ($i = 0 ; $i < $list_count ; $i++ )
			{
			
				$temy = array();
				$temy = $list_result[$i];
				if ( $temy[0] == $dirid )
				{
					$dirninfo =array();
					$dirninfo = $temy ;
					//echo $ie_list2[$i].'<br>';
				}
				
				// -------------------------------------------------------------
				// add
				//format : dir info: 0 id | 1 name | 2 imgsrc | 3 time | 4 hit | 5 sum | 6 detail
				$imgsrc = $dirninfo[2];
				$dl_id = $dirid;
				$dl_name = $dirname;
				$dl_imgsrc = $imgsrc;
				$dl_time = $dirninfo[3];
				$dl_hit = $dirninfo[4];
				$dl_sum = $dirninfo[5];
				$dl_detail = $dirdetail;
		
				$dl_updated = $dl_id.'|'.$dl_name.'|'.$dl_imgsrc.'|'.$dl_time.'|'.$dl_hit.'|'.$dl_sum.'|'.$dl_detail."\n";
	
				for ($i = 0 ; $i < $list_count ; $i++ )
				{
					$temb = array();
					$temb = $list_result[$i];
					if ( $temb[0] == $dirid )
					{
						$dl_org .=$dl_updated;
					}
					else
					{
						$dl_org .=$ie_list[$i];
					}
				}
			}
		}
		else
		{
			// normal
			
			$imgsrc = $dirimg_name;
			//echo $imgsrc; 
			move_uploaded_file( $dirimg ,$img_dir.'/'.$imgsrc );
			@mkdir($img_dir.'/'.$dirid,0700);
			@mkdir($img_dir.'/'.$dirid.'/tn',0700);
			//$as = '';
			//write2_file_new( $img_dir.'/'.$dirid.'/list.inc.php',$as );
			// update the list

			$dl_id = $dirid;
			$dl_name = $dirname;
			$dl_detail = $dirdetail;
			$dl_imgsrc = $imgsrc;
			$dl_time = get_sys_date();
			$dl_hit = 0;
			$dl_sum = 0;
			$dl_detail = $dirdetail;
		
			//format : dir info: id|name|imgsrc|time|hit|sum|detail
			$dl_updated = $dl_id.'|'.$dl_name.'|'.$dl_imgsrc.'|'.$dl_time.'|'.$dl_hit.'|'.$dl_sum.'|'.$dl_detail."\n";
	
			for ($i = 0 ; $i < $list_count ; $i++ )
			{
				$dl_org .=$ie_list[$i];
			}

			$dl_org = $dl_updated.$dl_org;
		}

		
			write2_file_new( $img_dir.'/list.inc.php',$dl_org );

		// ok!
		$con = '
		'.$aw_txt[76].'<p>
		'.$aw_txt[77].'<p>
		<a href="javascript:history.back(-1)">'.$aw_txt[78].'</a><p>
		<a href="admin_wizard.php">'.$aw_txt[79].'</a><p>
		';
		tpl_show( $con,$aw_txt[80]);

		exit;

	}
}



//--------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------

// modify the picture

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

	if ( $step == 1 )
	{
		// redirect 
		$con = '
		'.$aw_txt[81].'<p>
		<ul>'.$menu3.'</ul>
		';
		tpl_show( $con,$aw_txt[82]);
	}

	if ( $step == 2 )
	{
		// input data

		if ( $style == 'delete' )
		{
			//update the list
		
			for ($i = 0 ; $i < $list_count2 ; $i++ )
			{
			
				$temx = array();
				$temx = $list_result2[$i];
				if ( $temx[0] <> $picid )
				{
					$ie_u_list .= $ie_list2[$i] ;
					echo $ie_list2[$i].'<br>';
				}
				else
				{
					// update the dir list
					for ($j = 0 ; $j < $list_count ; $j++ )
					{
						//
						$lt3 = $list_result[$i];
						if ( $lt3[0] == $dir )
						{
							// ----
							$lt3[5]--;
						}

					$updated_dlist .= $lt3[0].'|'.$lt3[1].'|'.$lt3[2].'|'.$lt3[3].'|'.$lt3[4].'|'.$lt3[5].'|'.$lt3[6];
					}	

				write2_file_new( $img_dir.'/list.inc.php',$updated_dlist );

				}
					
			}

			//  ----------------
			//echo "<p><p>$img_id $img_name ||||+++++++++++++++++<p><p>";


			write2_file_new( $img_dir.'/'.$dir.'/list.inc.php',$ie_u_list );

			$con = '
			'.$aw_txt[83].'<p>
			<a href="javascript:history.back(-1)">'.$aw_txt[84].'</a><p>
			<a href="admin_wizard.php">'.$aw_txt[85].'</a><p>
			';

			tpl_show( $con,$aw_txt[86]);

		}//delete 

		if ( $style == 'modify' )
		{
			for ($i = 0 ; $i < $list_count2 ; $i++ )
			{
			
				$teml = $list_result2[$i];
				//echo $teml[0].'<p>';
				if ( $teml[0] == $picid )
				{
					$pic_info = array();
					$pic_info = $list_result2[$i];
				}
					
			}

			// get the picture info
			// format: 	0 id | 1 name | 2 wh | 3 size | 4 time | 5 from| 6 hit| 7 recommon
			// show modify form
				$text_content = '
 <form action="admin_wizard.php" method="post" ENCTYPE="multipart/form-data">
  <input type="hidden" name="dir" value="'.$dir.'">	
  <p><span lang="zh-cn">'.$aw_txt[87].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[88].$pic_info[0].'  </span></p>
  <input type="hidden" name="imgid" value="'.$pic_info[0].'">
  <p><span lang="zh-cn">'.$aw_txt[89].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[90].'</span>
  <input type="text" name="imgname" size="20" style="border: 1px solid #000000" value="'.$pic_info[1].'"></p>
  <p><span lang="zh-cn">'.$aw_txt[91].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[92].'</span><input type="text" name="imgfrom" size="20" style="border: 1px solid #000000" value="'
  .$pic_info[5].
 '"></p>
  <p><span lang="zh-cn">'.$aw_txt[93].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[94].'<select size="1" name="imgrecom">
  <option value="1">'.$aw_txt[95].'</option>
  <option value="2">'.$aw_txt[96].'</option>
  <option value="3" selected>'.$aw_txt[97].'</option>
  <option value="4">'.$aw_txt[98].'</option>
  <option value="5">'.$aw_txt[99].'</option>
  </select></span></p>
  <p><span lang="zh-cn">'.$aw_txt[100].'</span></p>
  <input type="hidden" name="action" value="addpic">
  <input type="hidden" name="step" value="2">
  <input type="hidden" name="admin" value="on">
  <input type="submit" value="'.$aw_txt[101].'">
</form>
				';

		tpl_show( $text_content,$aw_txt[102]);


		}//modify
		

	}//step2

}//modifypic


// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------

// modifydir

if ( $action == 'modifycate')
{
	//
	if ( $step == '' )
	{
		$step = 1;
	}

	if ( $step == 1 )
	{
		// redirect
		echo '<script>location="ie_main.php?view=admin"</script>';

	}


	if ( $step == 2 )
	{
		if ( $style == 'delete' )
		{
			// ---------------Delete-----------------
			//update the list
		
			for ($i = 0 ; $i < $list_count ; $i++ )
			{
			
				$temy = array();
				$temy = $list_result[$i];
				if ( $temy[0] <> $cdir )
				{
					$ie_n_list .= $ie_list[$i] ;
					//echo $ie_list2[$i].'<br>';
				}
				

				write2_file_new( $img_dir.'/list.inc.php',$ie_n_list );

			}//for

			$con = '
			'.$aw_txt[103].'<p>
			<a href="javascript:history.back(-1)">'.$aw_txt[104].'</a><p>
			<a href="admin_wizard.php">'.$aw_txt[105].'</a><p>
			';
			tpl_show( $con,$aw_txt[106]);
			exit;
					
			// ---------------Delete-----------------

		}//delete

		if ($style == 'modify')
		{
			// -------------------------------------------------------
			for ($i = 0 ; $i < $list_count ; $i++ )
			{
				$ltv = array();
				$ltv = $list_result[$i];

				if ( $cdir == $ltv[0] )
				{
					$cateinfo = $ltv;
				}
				//format : dir info: 0 id | 1 name | 2 imgsrc | 3 time | 4 hit | 5 sum | 6 detail
			}
				//show the info
			$con = '
<form action="admin_wizard.php" method="post" ENCTYPE="multipart/form-data">
  <p><span lang="zh-cn">'.$aw_txt[107].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[108].$cateinfo[0].'</span>
	<input type="hidden" name=dirid value="'.$cateinfo[0].'">
  </p>
  <p><span lang="zh-cn">'.$aw_txt[109].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[110].'</span><input type="text" name="dirname" size="20" style="border: 1px solid #000000" value="'.$cateinfo[1].'"></p>
  <p><span lang="zh-cn">'.$aw_txt[111].'</span></p>
  <p><span lang="zh-cn">'.$aw_txt[112].'</span></p>
  <p><textarea rows="8" name="dirdetail" cols="36">'.$cateinfo[6].'</textarea></p>
<input type="hidden" name="action" value="addcate">  
<input type="hidden" name="step" value="2">
  <input type="hidden" name="admin" value="on">
  <input type="submit" value="'.$aw_txt[113].'">
</form>
			';

		tpl_show( $con,$aw_txt[114]);


			// -------------------------------------------------------
		}//modify


	
	}//step2
}//modify die

//--------------------------------------
if ($show_runtime == 'on')
{
	$time_end = getmicrotime();
	$time = $time_end - $time_start;
	echo '<br><font face="Arial"><span style="font-size: 7pt"><center>Run time : '.$time.' s Pageview : '. $ie_counter .'</center></span></font>';

}
//--------------------------------------
?>