Magento Current Stock Status PHP Script

// error_log("auto");
$dabas = mysqli_connect("localhost","root","","dbname");

if($dabas == false)
die("Error: Could Not Connect." .mysqli_connect_error());

$sql = "SELECT cpe.sku AS Sku, cpev.value AS NAME, cssi.qty AS Qty, cssi.stock_status AS STATUS
FROM cataloginventory_stock_status_idx cssi
JOIN catalog_product_entity_varchar cpev ON cssi.product_id = cpev.entity_id
JOIN catalog_product_entity cpe  ON  cssi.product_id = cpe.entity_id
WHERE cpev.attribute_id = 98 AND cpev.store_id = 4 limit 10 ";
  if($res = mysqli_query($dabas, $sql)){
if(mysqli_num_rows($res) > 0){
echo "<table>";
echo "<tr>";
echo "<th>Sku :</th>";
echo "<th>Name : </th>";
echo "<th>Qty : </th>";
echo "<th>Stock Status : </th>";
echo "</tr>";

while($row = mysqli_fetch_array($res)){
echo "<tr>";
echo "<td>".$row['Sku']."</td>";
echo "<td>".$row['NAME']."</td>";
echo "<td>".$row['Qty']."</td>";
echo "<td>".$row['STATUS']."</td>";
echo "</table>";

else {
echo "No Matching Record are Found";
else {
echo "Error : Could not be able to excute $sqlgta. " .mysqli_error($dabas);

PHP User Entry Form using POSTBACK

$name = $email = "";


$name = $_POST["name"];
$email = $_POST["email"];


<form action="pro.php" method="post">
<label> Name  : </label>
<input type= "text" name="name"/><br />
<label> Email : </label>
<input type="email" name="email"/><br />
<input type = "submit" name="submit" value ="Submit" />

echo "$name";
echo "$email";


Restrict Right Click and Dragging the Image

<div class="product-img-box" ondragstart="return false;" oncontextmenu="return false;">
        <?php echo $this->getChildHtml('media') ?>

Plan after magento store been hacked

The following are the step that you need to perform

1.Migrate your store
Transfer your current store to latest Magento version
2.Detection of infected files
You can login to server via ssh details and fire the following command to get a listing of infected files.

=> find * -type f -name *.’php.suspected’

=> find * -type f -name “[a-z]*[0-9]*” -print
You can create various combination of pattern matching to get any file which contains digits as we have not file name as

3. Change Username and Password of your Magento store.

4. if you are using WordPress with Magento then be sure that WordPress should be the latest version because WordPress is more vulnerable to hack.