var Arrays = new Array();
var b = true; //вводим переменную
$('#wrap').on('click', 'li', function() {
var baseQuantity = 10;
var delivery = 300;
var thisID = $(this).attr('id');
var itemname = $(this).find('div .name').html();
var itemprice = +$(this).find('div .price').html();
...
if ( b ) { // и единоразово прибавляем 300
var prev_charges = +$('.cart-total span').html();
prev_charges = prev_charges + delivery;
$('.cart-total span').html(prev_charges);
b = false;
}
});
<?php
if ( isset($_POST['id']) AND isset($_POST['chkVal']) ) {
$id = (int)$_POST['id'];
$chkVal = (int)$_POST['chkVal'];
@mysql_query("UPDATE yandex SET chec='$chkVal' WHERE id='$id'");
}
<?php
$file = file('test.txt');
$i = 0;
foreach($file as $line) {
$i++;
$arr = explode(';', $line);
$v = $arr[0];
$ip = $arr[1];
$output = shell_exec("ping $ip -n 1");
$text = iconv("cp866","utf-8", $output);
$pos = strpos($text, "потеряно = 1");
if ( $pos > 0 ) {
echo "<a href='http://$ip:8080' title='$v'>Offline</a><br>";
} else {
if (strlen($text) > 300 ) {
echo "<a href='http://$ip:8080' title='$v'>Online</a><br>";
} else {
echo "<a href='http://$ip:8080' title='$v'>-</a><br>";
}
}
}
?>
<?php
$file = file('test.txt');
$i = 0;
foreach($file as $line) {
$i++;
$arr = explode(';', $line);
$v = $arr[0];
$ip = $arr[1];
$output = shell_exec("ping $ip -n 1");
$text = iconv("cp866","utf-8", $output);
$pos = strpos($text, "потеряно = 1");
if ( $pos > 0 ) {
echo "<b style='color:red;'>Недоступен</b>";
} else {
if (strlen($text) > 300 ) {
echo "Доступен";
} else {
echo "<b style='color:red;'>Нет такого</b>";
}
}
}
?>
<?php
$ip = '178.248.232.5';
$output = shell_exec("ping $ip -n 1");
$text = iconv("cp866","utf-8", $output);
echo $text.'<br>';
?>