2017-05-12 4 views
0

こんにちは、私はSiteLockを購入し、自分で自分のサイトのSQLインジェクション& XSSが失敗したSiteLock SQLインジェクション&XSS失敗

SQLインジェクションスキャン言っスキャン: URL:https://www.sitename.com/product.php?id=1 説明:インジェクションポイント:GETを。注入パラメータ:id;注入型:数値

XSSスキャン:URLを:https://www.sitename.com/product.php?id=1説明:ID

私はいくつかのいずれかが私を助けることができる可能性があり、それを収集する方法がわかりませんか?

私のPHP関数は、データベースからデータを引き出します。

function get_products_in_cat_page(){ 

$query = query(" SELECT * FROM products WHERE product_category_id = " . escape_string($_GET['id']) . " "); 
confirm($query); 

if(mysqli_num_rows($query) == 0) { 

set_message("Will update soon the new products"); 

} else { 

while($row = fetch_array($query)) { 

$product_image = display_image($row['product_s_image1']); 
$product_image2 = display_image($row['product_s_image2']); 
if ($row['product_quantity'] < 1) { 
    $outofstock = "<div class='sale-flash out-of-stock'>Out of Stock</div>"; 
} else { 
    $outofstock = ""; 
} 

$product = <<<DELIMETER 

<div class="product clearfix" style="padding:8px;"> 
    <div class="product-image"> 
     <a href="product.php?id={$row['product_id']}"><img src="images/{$product_image}" alt="{$row['product_title']}" class="selected"></a> 
     <a href="product.php?id={$row['product_id']}"><img src="images/{$product_image2}" alt="{$row['product_title']}"></a> 
     {$outofstock} 
     <div class="product-overlay"> 
      <a href="include/ajax/quick_view.php?id={$row['product_id']}" class="add-to-cart" data-lightbox="ajax"><i class="icon-shopping-cart"></i><span>Quick View</span></a> 
      <a href="product.php?id={$row['product_id']}" class="item-view"><i class="icon-zoom-in2"></i><span> More info.</span></a> 
     </div> 
    </div> 
    <div class="product-desc center"> 
     <a href="product.php?id={$row['product_id']}"> 
     <div class="product-title"><h3 style="font-size:15px;">{$row['product_title']}</h3></div> 
     </a> 
     <div class="product-price">&#36;{$row['product_price']}</div> 
     <div class="product-rating"> 

     </div> 
    </div> 
</div> 


DELIMETER; 

echo $product; 

} 
} 


} 

答えて

0

mysqli_real_escape_stringは整数に[ 'ID'] $ _GETをもたらし、あなたのケースでより良い動作しますが、

WHERE product_category_id = ".(int)$_GET['id'] 
十分以上のものです
関連する問題