<?php
	//Checklogin.php 117 没有手机图片 banner_S, 生成并log数据库.lslog

	$ls=$_GET['ls'];
	$source="../images/";
	$handle=dir($source);  
	$bannera=array();
	while($entry=$handle->read()) {   
		if(($entry!=".")&&($entry!="..")){ 
			$srcFile=$source.$entry;
//			 if(!(strpos($entry,"_s.")===false) ) continue; //有小图
			 
			if(!is_dir( $srcFile)&& !(strpos($entry,"banner")===false)) {    //目录 
				  $srcsetstr=srcsetpic($srcFile); //缩小图片
				  $bannera[$entry]= $srcsetstr;
				  $msgstr=$entry.": ".str_replace("w","",str_replace(" srcset= ","",$srcsetstr));
				  $ls_msg.=$msgstr."已添加；";
				  $logmsg= $picsas.": ".$picnas ; 


				  $na=explode(",",$picnas);
				  for($i = 0; $i < count($na) ; $i++)
				  { if(!strpos($entry,$na[$i])===false) continue 2; } //本身是小图，返回
				   
				  $select_sql21="select * from ls_motif where motifPic='".$entry."'";
				  $select_query21=$opendb->query($select_sql21);
				  $select_row21= mysqli_num_rows($select_query21);
				  if($select_row21==0){ //没有大图就没有手机图

					  $select_sql2="select * from ls_motif ";
					  $select_query2=$opendb->query($select_sql2);
					  $select_rows2=mysqli_num_rows($select_query2); //总数
					  $insert_sql= "insert into ls_motif ( motifPic,motif_href,motifText,Num,enable) values ('".$entry."','','',".($select_rows2+1).",1) ";
					  
					  $insert_query=$opendb->query($insert_sql);
					  $addid=$opendb->insert_id();
					  writelog($_SERVER['PHP_SELF'],"add banner_s ".$toFile,"ID: ".$addid,"admin");		
				  }
		   
			}
		}
	}
	if($logmsg!=""){	
		$logmsg=date('Y-m-d h:m:s')."  ".$_SERVER['PHP_SELF']."  _create_banner ".$logmsg ."\r\n";	
		writemsglog($logmsg);}
 	$handle->close(); //关闭指针
	//exit;
?>	

	
