混淆代码是什么意思?

时间:2016-11-05 17:26:26

标签: javascript

所以我在一个网站上,我正在窥视源代码,所有的JavaScript代码都被混淆了(像往常一样)。我不知道混淆代码通常是什么,但我认为它是这样的:

var1 > 10 / 2, var1 = 0

相同
if(var1 > 10 / 2){
    var1 = 0;
}
这是怎么回事?如果没有,请告诉。

1 个答案:

答案 0 :(得分:2)

当您将代码放在console.log中的某些括号内时,您可以看到发生了什么。您需要一些额外的括号,因为console.log将逗号作为参数的分隔符读取。

Comma Operator

  

逗号运算符计算每个操作数(从左到右)并返回最后一个操作数的值。

<div id="product_box"> 
                    <form action="" method="post" enctype="multiple/form-data">
                        <table align="center" width="700" bgcolor="white">

                    </tr>
                            <tr align="center">
                                <th>Delete</th>
                                <th>Product(s)</th>
                                <th>Shop</th>
                                <th>Single Price</th>
                                <th>Quantity</th>
                                <th>Update Quantity</th>

                            </tr>   

                <?php

                    global $con;

                    include("include/db.php");

                    $total = 0;

                    $ip=getip();


                    $user_email = $_SESSION['user_email'];

                    $get_id = "select * from user where user_email='$user_email'";

                    $run_id = mysqli_query($con,$get_id);

                    $row_id = mysqli_fetch_array($run_id);

                    $user_id =  $row_id['user_id'];

                    $sqlproinfo=mysqli_query($con,"select * from productorder join product on productorder.product_id=product.product_id where ip_add='$ip' and user_id='$user_id'");

                    while($p_info=mysqli_fetch_array($sqlproinfo)){
                        $pro_id = $p_info['product_id'];

                    $sqlpinfo=mysqli_query($con,"select * from product inner join vendor on product.shop_name=vendor.vendor_id where product_id='$pro_id'");

                    while($pp_info=mysqli_fetch_array($sqlpinfo)){

                        $product_price = array($pp_info['price']);

                        $pro_name=$pp_info['product_name'];

                        $shop_name = $pp_info['shop_name'];

                        $product_image = $pp_info['product_image'];

                        $single_price = $pp_info['price'];

                        $value = array_sum($product_price);

                        $total += $value;


                        $sqlqtyinfo=mysqli_query($con,"select * from productorder where ip_add='$ip' AND product_id='$pro_id' and user_id='$user_id'");

                        $qty_info=mysqli_fetch_array($sqlqtyinfo);

                        $qty=$qty_info['quantity'];

                        $total = $total * $qty;
                ?>

            <tr align="center"> 
                <td><input type="checkbox" name="remove[]" value="<?php echo $pro_id;?>"/></td>

                <td><?php echo $pro_name; ?><br><img src="adminvendor_area/product_image/<?php echo $product_image;?>" width="60" height="60"/></td>

                <td><?php echo $shop_name; ?></td>


                <td><?php echo "MYR" . $single_price; ?></td>

                <td><input type='number' style="-moz-box-sizing: border-box; width: 80px;" min='1' max='99' step='1' value='<?php echo "$qty"; ?>'  name='qty[<?php echo "$pro_id";?>]' /></td>

                 <?php
                    echo"<td><input type='submit' name='updatecart[$pro_id])' value='$pro_id' style='color: rgba(0, 0, 0, 0);'/></td>";

                     if(isset($_POST['updatecart'][$pro_id])){

                        $user_email = $_SESSION['user_email'];

                    $get_id = "select * from user where user_email='$user_email'";

                    $run_id = mysqli_query($con,$get_id);

                    $row_id = mysqli_fetch_array($run_id);

                    $user_id =  $row_id['user_id'];
                    $qty = $_POST['qty'][$pro_id];
                    $special_id = $_POST['updatecart'][$pro_id];
                    $sqlqty = mysqli_query($con, "UPDATE productorder SET quantity='$qty' WHERE product_id='$special_id' AND ip_add='$ip' and user_id='$user_id'");

                    echo "<script>alert('Quantity has been updated!')</script>";
                    echo "<script>window.open('cart.php','_self')</script>";}


                }}?>
            </tr>

                <tr>
                    <td colspan="4" align="right"><b>Sub Total:</b></td>
                    <td><?php total_price();?></td>
                </tr>

相关问题