A vegso kod ami a szerveren elv mukodik normalisan, most lesz tesztelve. Igen, raklap szar, de ha mukodik, akkor nincs problema, igaz? ¯\_(ツ)_/¯
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
$conn = mysqli_connect("localhost","szopjkecsket","fasz","buziwinfos");
if($conn){
$termekek = array(3074,3076,3077,3087,3116,3123,3127,3155,3160,3163,3170,3171,3172,3180,3179,3183,3185,3187,3189,3194,3195,3205,3218,3223,3233,3240,3239,3349,3248,3272,3273,3275,3294,3296,3293,3303,3313,3314,3312,3315,3326,3328,3327,3333,3335,3334,3342,3341,3348,3349,3347)
$arg="'<span class=\"amount-projektor\">'";
$termekmenny = count($termekek);
for($i=0;$i<$termekmenny;$i++)
{
$command = shell_exec("/usr/local/bin/php $termekek[$i].php | grep -A1 ".$arg);
$storage = $command;
//echo $command;
if(strpos($storage, "Brak") !== false)
{
$result = mysqli_query($conn, "UPDATE `wp7k_wc_product_meta_lookup` SET `stock_status` = 'outofstock' WHERE `wp7k_wc_product_meta_lookup`.`product_id` = $termekek[$i];");
}else if(strpos($storage, "szt.")){
//echo "van";
$tmp = strpos($storage,"szt.");
//echo $tmp-5;
$tmp = $tmp-3;
$tmp = substr($storage,$tmp,1);
//echo $tmp;
$result = mysqli_query($conn, "UPDATE `wp7k_wc_product_meta_lookup` SET `stock_quantity` = '$tmp' WHERE `wp7k_wc_product_meta_lookup`.`product_id` = $termekek[$i];");
if($result){
echo "siker";
}else{
echo mysqli_error($conn);
}
}else{
echo "nem letezik";
$result = mysqli_query($conn, "UPDATE `wp7k_wc_product_meta_lookup` SET `min_price` = '0' WHERE `wp7k_wc_product_meta_lookup`.`product_id` = $termekek[$i];");
}
sleep(5);
}
}
?> |