site/add_cart.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
if(empty($_SESSION['username']))
{
    echo '<script>';
    echo 'alert("请您先登录.");';
    echo 'window.location.href = "dashboard/";';
    echo '</script>';
    die();
}
$sql = "SELECT * FROM products WHERE id='".$_GET['init']."'";
$p = $db->execute_dql($sql);
$p = $p[0];

if($_SESSION['userid']==$p['uid'])
{
    echo '<script>';
    echo 'alert("您不可以购买.");';
    echo 'window.history.back(-1);';
    echo '</script>';
    die();

}
if($_SESSION['usertype']==3)
{
    echo '<script>';
    echo 'alert("您不可以购买.");';
    echo 'window.history.back(-1);';
    echo '</script>';
    die();

}


$total = 0;
$items=0;
if(!isset($_GET['num']))
{
    $_GET['num'] = 1;
}
$cart = $_SESSION['cart'];

if(empty($cart))
{
    $_SESSION['cart'] = array(array($p,$_GET['num']));
    $items = 1;
    $total+=1*$p['price']*$_GET['num'];

}else{

    $cart[count($cart)] = array($p,$_GET['num']);
    $_SESSION['cart'] = $cart;
    $items = count($cart);
    foreach($cart as $c)
    {
        $total+=$c[0]['price']*$c[1]*1;
    }
}
$_SESSION['TotalCartMoney'] = $total;
$_SESSION['TotalCartNum'] = $items;
echo '<script>';
后面还有 4 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。