<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Stokta olmayanları kapatır, olanları açar</title>
</head>
<body>
<?php
include("../config.php");
$stok_sifir_sayac=0;
$stok_var_sayac=0;
$link= mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD);
mysql_select_db(DB_DATABASE,$link);
mysql_query("SET NAMES 'utf8'");

$strSQL6= "SELECT * FROM ".DB_PREFIX."product";
$result6= mysql_query($strSQL6,$link);
while ($row6 = mysql_fetch_array($result6))
    {
	$stok_miktari= $row6['quantity'];
	$durum=$row6['status'];;
	$product_id= $row6['product_id'];
	if ($stok_miktari==0){
	$stok_sifir_sayac++;
	$stok_sql= "UPDATE `".DB_PREFIX."product` SET status='0' where product_id=$product_id";
			$stok_update = @mysql_query( $stok_sql, $link );
	echo "<font color=\"red\">Ürün ID =".$product_id." kapatıldı</font><br>\n";
	}
	else {
	$stok_var_sayac++;
	$stok_sql2= "UPDATE `".DB_PREFIX."product` SET status='1' where product_id=$product_id";
			$stok_update2 = @mysql_query( $stok_sql2, $link );
	echo "<font color=\"green\">Ürün ID =".$product_id." açıldı</font><br>\n";
	}

     } 
echo "<font color=\"red\">Stokta olmayan ".$stok_sifir_sayac." adet ürün KAPATILDI</font><br>\n";
echo "<font color=\"green\">Stokta olan ".$stok_var_sayac." adet ürün AÇILDI</font><br>\n";
?>
</body>

</html>