Example #1
0
function load($num)
{
    $connection = mysqli_connect("*****", "*****", "*****", "*****");
    if (!$connection) {
        die('Could not connect: ' . mysql_error());
    }
    $max = total();
    do {
        $new = rand(1, $max);
    } while ($new == $num);
    $sql = "select * from ***** where id='{$new}'";
    $result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
    $temparray = array();
    while ($row = mysqli_fetch_assoc($result)) {
        $temparray[] = $row;
    }
    echo json_encode($temparray);
}
Example #2
0
		<th>Product</th>
		<th></th>
		<th>Price</th>
		<th>Quantity</th>
	</thead>
	<tbody>
	<?php 
    $i = 0;
    $s = 's';
    $subtotal = 0;
    if ($cart != NULL) {
        $i = 0;
        $s = 's';
        foreach ($cart as $prod) {
            $product = db_get_product_by_id($prod['item#']);
            $subtotal = total($cart);
            $quantity = $prod['quantity'];
            ?>
			<tr>
				<td><img class="sml" src="<?php 
            echo $product['image'];
            ?>
"/></td>
				<td>
					<h4><?php 
            echo $product['brand'] . ' ' . $product['name'];
            ?>
</h4>
					<p><?php 
            echo $product['brand'];
            ?>
Example #3
0
function main()
{
    $tests = array("simple", "simplecall", "simpleucall", "simpleudcall", "mandel", "ackermann", "ary", "ary2", "ary3", "fibo", "hash2", "heapsort", "nestedloop", "sieve", "strcat", "binary_trees", "fannkuch", "fasta", "mandelbrot", "meteor_contest", "n_body", "spectral_norm");
    $t0 = $t = start_test();
    foreach ($tests as $test) {
        //    if (!isset($argv[1]) || $argv[1] === $test) {
        $test();
        $t = end_test($t, $test);
        //}
    }
    //if (!getenv('VERIFY')) {
    total();
    //}
}
        echo $cartItem['price'];
        ?>
</span>
                        <span class="cart-qty">QTY : <?php 
        echo $cartItem['qty'];
        ?>
</span>
                        <span class="cart-subtotal">SUBTOTAL : <?php 
        echo $subtotal;
        ?>
</span>

                    </span>

                <?php 
        $total += total($subtotal);
        ?>
            </li>
        <?php 
    }
    ?>

        <span class="shipping-price"><h3>Shipping price:</h3><?php 
    echo $_SESSION['shipping'];
    ?>
</span>
        <span class="cart-total"><h2>ORDER TOTAL : <?php 
    echo $total + $_SESSION['shipping'];
    ?>
</h2></span>
        <a href="payment.php?ttl=<?php 
Example #5
0
function respuestas($id)
{
    $resinfo = mysql_query("SELECT idRespuesta, idSondeo, respuesta\n\t\t\t\t\t\t\t\t\t\t\t\tFROM respuesta");
    while ($respreview = mysql_fetch_array($resinfo)) {
        if ($id == $respreview['idSondeo']) {
            $respuestas[] = array('idRespuesta' => $respreview['idRespuesta'], 'idSondeo' => $respreview['idSondeo'], 'respuesta' => $respreview['respuesta'], 'total' => total($respreview['idRespuesta']));
        }
    }
    return $respuestas;
}
Example #6
0
        function totalg2()
        {
            global $db;
            $totalg2 = 0;
            $idprt = array_keys($_SESSION['guirlande2']);
            $produites = implode("','", $idprt);
            $totales = $db->query("SELECT id_longueur , prix  FROM longueur_guirlande WHERE id_longueur IN ('{$produites}') ");
            foreach ($totales as $totale) {
                $totalg2 += $totale['prix'] * $_SESSION['guirlande2'][$totale['id_longueur']];
            }
            return $totalg2;
        }
        ?>

			<p class="price_t"> Товаров на сумму: <span><?php 
        $total_pace = print_r(total() + total2() + total_b() + total_j() + total_j2() + total_g() + totalg2());
        ?>
 руб</span></p>

		</div>
		<hr/>
		<div class="form_panier">
			<form method="POST">
				<div class="choix_p_t">
					<h2>Выбрать Способ оплаты </h2>
					<div class="cadrre">
						<div class="form-group">
							<div class="img_cadrre">
								<img src="images/img_cache.png" alt="img_cache">
							</div>
							<div class="choix_trans ">
Example #7
0
$t = end_test($t, "simpleudcall");
mandel();
$t = end_test($t, "mandel");
mandel2();
$t = end_test($t, "mandel2");
ackermann(7);
$t = end_test($t, "ackermann(7)");
ary(50000);
$t = end_test($t, "ary(50000)");
ary2(50000);
$t = end_test($t, "ary2(50000)");
ary3(2000);
$t = end_test($t, "ary3(2000)");
fibo(30);
$t = end_test($t, "fibo(30)");
hash1(50000);
$t = end_test($t, "hash1(50000)");
hash2(500);
$t = end_test($t, "hash2(500)");
heapsort(20000);
$t = end_test($t, "heapsort(20000)");
matrix(20);
$t = end_test($t, "matrix(20)");
nestedloop(12);
$t = end_test($t, "nestedloop(12)");
sieve(30);
$t = end_test($t, "sieve(30)");
strcat(200000);
$t = end_test($t, "strcat(200000)");
total($t0, "Total");
Example #8
0
    }
    fclose($file_count);
    @(list($today, $yesterday, $total, $date, $days) = split("%", $data));
    echo ceil($total / $days);
}
?>
			
						Đang online: <?php 
echo online();
?>
 <br>
						Truy cập hôm nay: <?php 
echo today();
?>
 <br>
						Truy cập hôm qua: <?php 
echo yesterday();
?>
 <br>
						Tổng số truy cập: <?php 
total();
?>
 <br>
						Truy cập trung bình: <?php 
avg();
?>
 <br>
				   
    	</td>
    </tr> 
</table>
Example #9
0
    $table .= "<td> Q Demand</td>";
    for ($i = 0; $i < count($ss['qDemand']); $i++) {
        $table .= "<td>" . $ss["qDemand"][$i] . "</td>";
    }
    $table .= "</tr>";
    // body table
    $table .= "</table>";
    return $table;
}
function total($ss)
{
    $demand = $ss["demand"];
    $hasilDemand = $ss["hasilDemand"];
    $total = 0;
    //print_r(json_encode($demand));
    for ($h = 0; $h < count($ss['qSupply']); $h++) {
        for ($i = 0; $i < count($ss['qDemand']); $i++) {
            if ($hasilDemand[$h][$i] > 0) {
                $total += $hasilDemand[$h][$i] * $demand[$h][$i];
            }
        }
    }
    return $total;
}
function toRp($nilai)
{
    return number_format($nilai, 0, '.', ',');
}
echo createViewTable($ss);
echo "<strong>Total : Rp. " . toRp(total($ss)) . "</strong>";
Example #10
0
File: index.php Project: nailton/TJ
<?php

// require common code
require_once "Comon/common.php";
// Index of the last entry
$result = mysql_query("SELECT MAX(`index`) FROM `processos`");
$array = mysql_fetch_row($result);
$index = $array[0];
//Retrinving number of files in each class from current month and
// atribuiting it to a given session variable
$_SESSION["RELATOR"] = total('RELATOR');
$_SESSION["REVISOR"] = total('REVISOR');
$_SESSION["TOTAL"] = $_SESSION["RELATOR"] + $_SESSION["REVISOR"];
?>

<!DOCTYPE html>

<html>

	<head>
	  	<title>JP: Processos</title>
	    <link href="css/index.css" rel="stylesheet" media="screen and (max-height: 800px)">
	    <link href="css/index-job.css" rel="stylesheet" media="screen and (min-height: 800px)">
	    <link href="http://fonts.googleapis.com/css?family=Just Me Again Down Here" rel="stylesheet" type="text/css">
	    <link href="http://fonts.googleapis.com/css?family=Mouse Memoirs" rel="stylesheet" type="text/css">
	    <meta charset='utf-8'> 
	</head>

  		<?php 
top_site();
?>
Example #11
0
                $errorCVC = true;
                unset($_SESSION['errorCVC']);
            }
            if (array_key_exists('errorMY', $_SESSION)) {
                $errorMY = true;
                unset($_SESSION['errorMY']);
            }
            if (array_key_exists('errorDate', $_SESSION)) {
                $errorDate = true;
                unset($_SESSION['errorDate']);
            }
        }
        db_connect();
        $user_id = $_GET['user_id'];
        $cart = get_cart($user_id);
        $total = total($cart);
        ?>
<h1>Payment</h1>

<div class="stepwizard">
    <div class="stepwizard-row">
        <div class="stepwizard-step">
            <a href="cart_page.php" class="btn btn-default btn-circle">1</a>
            <p>Cart</p>
        </div>
        <div class="stepwizard-step">
           <a href="checkout.php" class="btn btn-default btn-circle">2</a>
            <p>Shipping</p>
        </div>
        <div class="stepwizard-step">
            <button type="button" class="btn btn-primary btn-circle" >3</button>
Example #12
0
function Somar($var)
{
    global $conexao;
    $userid = $_SESSION['userid'];
    $total = total() + $var;
    $comandoSql = "UPDATE usuario SET total = ? WHERE userid = ?";
    $stmt = $conexao->prepare($comandoSql) or trigger_error("triggererror " . $conexao->error);
    $stmt->bind_param('is', $total, $userid);
    $stmt->execute();
    $stmt->close();
}
Example #13
0
    ?>
</td>
            <td class="cart-remove"><input type="checkbox" name="remove[]" value="<?php 
    echo $id;
    ?>
"></td>
          </tr>

      <?php 
}
?>

      <tr class="cart-total">
        <td colspan="4">TOTAL</td>
        <td class="cart-price">$<?php 
echo number_format(total(), 2);
?>
</td>
        <td></td>
      </tr>
    </tbody>

  </table>

  <div class="cart-submits">
    <input type="submit" name="update" value="Update Cart">
    <input type="submit" name="checkout" value="Check Out">
  </div>

</form>
Example #14
0
/**
 * Verifica se o USUÁRIO está autenticado
 *
 * @name is_on
 * @return bool
 */
function is_on()
{
    $login = str($_SESSION["login"]);
    $senha = str($_SESSION["senha"]);
    $sel = sel("usuarios", "usuario = '{$login}' and senha = '{$senha}'", "", "");
    if (total($sel) == 0) {
        return false;
    } else {
        $ids = $_SESSION["idsession"];
        $sel = sel("sessoes", "ids = '{$ids}' and usuario = '{$usuario} and senha = '{$senha}'", "", "");
        if (total($sel) == 0) {
            return false;
        } else {
            return true;
        }
    }
}
Example #15
0
 /**
  * Get cart sub total.
  */
 function get_sub_total($cart, $options = null)
 {
     // Add item totals.
     foreach ((array) $cart['items'] as $item) {
         $should_add_to_total = !$item['is_cancelled'] && !$item['is_returned'] || $cart['order']['status'] == 'cancelled' || $cart['order']['status'] == 'returned';
         if ($should_add_to_total) {
             $sub_total += $item['price'] * $item['quantity'];
             $sub_cost += $item['cost'] * $item['quantity'];
         }
     }
     // Return sub cost?
     if ($options['cost']) {
         return $sub_cost;
     }
     $orig_sub_total = $sub_total;
     // Apply discounts.
     $sub_total = Discounts::apply_sub_total($cart, $sub_total, $cart['discounts']);
     // Discount total?
     if ($options['discount']) {
         return abs($orig_sub_total - total($sub_total));
     }
     return $orig_sub_total;
 }
Example #16
0
<?php

$file = file('input.txt');
function wrappingPaper($length, $width, $height)
{
    $lowest = min([$length * $width, $width * $height, $height * $length]);
    return 2 * $length * $width + 2 * $width * $height + 2 * $height * $length + $lowest;
}
function ribbonLength($length, $width, $height)
{
    $array = [$length, $width, $height];
    sort($array, SORT_NUMERIC);
    $ribbon = $array[0] + $array[0] + ($array[1] + $array[1]);
    return $length * $width * $height + $ribbon;
}
function total($input)
{
    $paper = 0;
    $ribbon = 0;
    foreach ($input as $present) {
        $sides = explode('x', $present);
        $paper += wrappingPaper($sides[0], $sides[1], $sides[2]);
        $ribbon += ribbonLength($sides[0], $sides[1], $sides[2]);
    }
    return [$paper, $ribbon];
}
echo $part_1 = total($file)[0] . PHP_EOL;
echo $part_2 = total($file)[1] . PHP_EOL;
Example #17
0
<?php

//带& 传进来的是变量
function total($dirname, &$dirnum, &$filenum)
{
    $dir = opendir($dirname);
    readdir($dir) . "<br/>";
    //. 代表当前目录
    readdir($dir) . "<br/>";
    // ..代表上级目录 我们不把. 和..输出 只读
    //当文件名存在的时候就将它输出  会把所有的文件和目录输出
    while ($filenameaa = readdir($dir)) {
        echo $filenameaa . "<br/>";
    }
    //我们在demo4中用循环的方式来输出所有的文件名
}
$dirnum = 0;
$filennum = 0;
total("E:/xampp/phpMyAdmin", $dirnum, $filenum);
echo "目录总数:" . $dirnum;
echo "目录总数:" . $filennum;
Example #18
0
      <input type="hidden" name="rm" value="2" />
      <input type="hidden" name="tax" value="0" />
      <input type="hidden" name="no_note" value="1" />
      <input type="hidden" name="no_shipping" value="1" />
      <div class="dg_body_background_basket_continue_shopping">
      <button class="dg_btn" type="button" onclick="javascript:location.href='<?php 
echo JRoute::_('index.php?option=com_datsogallery' . $itemid);
?>
';">
      <span><span><?php 
echo JText::_('COM_DATSOGALLERY_CONTINUE_SHOPPING');
?>
</span></span></button></div> <div class="dg_body_background_basket_subtotal"><?php 
echo $showtax;
echo JText::_('COM_DATSOGALLERY_BASKET_TOTAL');
?>
: <?php 
echo currencySymbol($ad_pp_currency);
?>
<span id="total"><?php 
echo total();
?>
</span><button type="submit" class="dg_btn"><span><span><?php 
echo JText::_('COM_DATSOGALLERY_CHECKOUT');
?>
</span></span></button></div>
    </form>
  </div>
  <br />
 <br />
<br />
        echo '<pre>';
        if (is_array($array)) {
            print_r($array);
        }
        echo '</pre>';
    }
}
if (!function_exists('total')) {
    function total($array)
    {
        if (is_array($array)) {
            $total = count($array);
            echo '<h3>Total: ' . $total . '</h3>';
        }
    }
}
//Start test
require dirname(__DIR__) . '/font-awesome.class.php';
//Init font awesome
$fa = new Smk_FontAwesome();
$css_path = dirname(__FILE__) . '/font-awesome/css/font-awesome.css';
$icons = $fa->getArray($css_path);
//Total icons
total($icons);
smk_print($icons, 'Basic:');
smk_print($fa->sortByName($icons), 'Sort by key name:');
smk_print($fa->onlyClass($icons), 'Only HTML class, no unicode:');
smk_print($fa->onlyUnicode($icons), 'Only unicode, no HTML class:');
smk_print($fa->readableName($icons), 'Only HTML class, readable:');
$test_fail = $fa->getArray($css_path, 'fail-');
smk_print($fa->readableName($test_fail), 'This test should fail(empty array):');
Example #20
0
 /**
  * Process and validate data for default methods.
  */
 function process_default_methods($payment)
 {
     $settings = get("/settings/payments");
     // Adjust amount for refunds/credits.
     if (in_array($payment['action'], array('credit', 'refund'))) {
         $payment['amount'] = -abs($payment['amount']);
     }
     switch ($payment['method']) {
         // Cash payment.
         case 'cash':
             $payment['status'] = 'success';
             break;
             // Credit payment.
         // Credit payment.
         case 'credit':
             if ($payment['action'] == 'charge') {
                 // Check account balance before charge.
                 $account = get("/accounts/{$payment['account_id']}");
                 if ($account['balance'] < $payment['amount']) {
                     throw new Exception("Account lacks funds (\$" . total($account['balance']) . ")");
                 }
             }
             $payment['status'] = 'success';
             break;
             // Invoice payment.
         // Invoice payment.
         case 'invoice':
             // Default due date based on account terms.
             if ($account = get("/accounts/{$payment['account_id']}")) {
                 // Net days by account terms or default setting.
                 $net_days = $account['terms']['net_days'] ?: $settings['invoice']['net_days'];
                 if ($net_days) {
                     $payment['date_due'] = date('Y-m-d', time() + $net_days * 86400);
                 }
             }
             break;
     }
     return $payment;
 }
Example #21
0
     // retrieve order id in input name
     $id = str_replace('_qty', '', $key);
     // compare orders ids
     if (array_key_exists($id, $_SESSION['orders'])) {
         // update quantity
         $_SESSION['orders'][$id]['quantity'] = $quantity;
     }
 }
 // checkout
 if (isset($_POST['checkout'])) {
     // error if cart is empty
     if (empty($_SESSION['orders'])) {
         error_message('please add some items to the cart before checking out');
     }
     // remember total
     $total = total();
     // unset session variables
     $_SESSION = [];
     // clear cookie
     if (!empty($_COOKIE[session_name()])) {
         setcookie(session_name(), '', time() - 42000);
     }
     session_destroy();
     // render checkout page
     render('header', ['title' => 'Checkout']);
     render('checkout', ['total' => $total]);
     render('footer');
     exit;
 }
 // redirect to self to avoid form resubmission
 header('Location: ' . $_SERVER['REQUEST_URI']);
Example #22
0
</head>
<body>

<form action="4-1-1.php" method="post">
	請輸入營業員「阿寶」的三個月業績(單位:千元)<br>
	第一個月:<input type="text" name="bob[]"><br>
	第二個月:<input type="text" name="bob[]"><br>
	第三個月:<input type="text" name="bob[]"><br>
	請輸入營業員「阿花」的三個月業績(單位:千元)<br>
	第一個月:<input type="text" name="flower[]"><br>
	第二個月:<input type="text" name="flower[]"><br>
	第三個月:<input type="text" name="flower[]"><br>
	<input type="submit">
</form>
<?php 
if (@$_POST['bob'] != "" && @$_POST['flower'] != "") {
    echo "阿寶業績" . total(@$_POST['bob']) . "千元<br>";
    echo "阿花業績" . total(@$_POST['flower']) . "千元<br>";
}
function total($array)
{
    $total = 0;
    foreach ($array as $key => $value) {
        $total += $value;
    }
    return $total;
}
?>

</body>
</html>