<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>all</title>
</head>
<body>

<?
			include("config.php");
			
			$i=1;
			$g=1;
			$result = mysql_query('select * from p1_order_info where delivered = 0 and aid = 0 and vid = 0 limit 2000'); 
            while($row = mysql_fetch_array($result)){ 
				$i=$i+1;
				$oid = $row['oid'];
				$query = mysql_query("select * from p1_out_order where status = 4 and stop1 = 1 and oid = ".$oid); 	
					if (mysql_num_rows($query) <> "0")
						{
							$g=$g+1;
							$date1 = substr(mysql_result($query,0,"status4_dt"),0,10);
							$time1 = substr(mysql_result($query,0,"status4_dt"),11,8); 
							mysql_query("UPDATE p1_order_info SET  delivered  = 1 , delivered_d = '".$date1."' , delivered_t = '".$time1."' where oid = $oid");	
						}
			}

			echo $i;
			echo "<br />".$g;
			
			

?>


</body>
</html>
