Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $dbservertype='mysql';
- $servername='localhost';
- // username and password to log onto db server
- $dbusername='root';
- $dbpassword='';
- // name of database
- $dbname='itemdb';
- ////////////////////////////////////////
- ////// DONOT EDIT BELOW /////////
- ///////////////////////////////////////
- connecttodb($servername,$dbname,$dbusername,$dbpassword);
- function connecttodb($servername,$dbname,$dbuser,$dbpassword)
- {
- global $link;
- $link=mysql_connect ("$servername","$dbuser","$dbpassword");
- if(!$link){die("Could not connect to MySQL");}
- mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
- }
- //////// End of connecting to database ////////
- $quantitynew=$_GET['quantitynew'];
- $id=$_GET['id'];
- $realmselect=$_GET['realm'];
- $itemtype=$_GET['itemtype'];
- $quantity=$_GET['quantity'];
- $pass=$_GET['password'];
- $itemname=$_GET['itemname'];
- $account=$_GET['account'];
- $mule=$_GET['mule'];
- echo $itemname;
- //We now need to get the SKU of the product we are adding from itemdb before we add it! VERSION 2 Which Updates The Store DB if Sku == 0 we need to skip this step
- $result=mysql_query("SELECT * FROM items_east_ladder WHERE item_name='$itemname'");
- while($row = mysql_fetch_array($result))
- {
- $skupostfix=$row['storesku'];
- }
- //Next we need to find all instances of this entry and add them up!
- // End of getting the sku
- if ($realmselect=="East Softcore Ladder")
- {
- $realmselect2="items_east_ladder";
- echo $realmselect2;
- $skufull= "ESCL" . $skupostfix;
- }
- if ($realmselect=="East Hardcore Ladder")
- {
- $realmselect2="items_easthc_ladder";
- echo $realmselect2;
- }
- if ($realmselect=="West Softcore Ladder")
- {
- $realmselect2="items_west_ladder";
- echo $realmselect2;
- }
- if ($realmselect=="West Hardcore Ladder")
- {
- $realmselect2="items_westhc_ladder";
- echo $realmselect2;
- }
- if ($realmselect=="Europe Softcore Ladder")
- {
- $realmselect2="items_euro_ladder";
- echo $realmselect2;
- }
- if ($realmselect=="Europe Hardcore Ladder")
- {
- $realmselect2="items_eurohc_ladder";
- echo $realmselect2;
- }
- //We now change the database over to magento
- //Connect to magento and fetch the products id #
- if(!$link)
- {
- die("Could not connect to MySQL");
- }
- mysql_select_db("d2loot",$link) or die ("could not open db".mysql_error());
- $result=mysql_query("SELECT * FROM catalog_product_entity WHERE sku='$skufull'");
- while($row = mysql_fetch_array($result))
- {
- $magsku=$row['entity_id'];
- }
- //End of connect to magento and fetch products id #
- //Connect to magento and update items stock using id#
- mysql_query("UPDATE cataloginventory_stock_item SET qty = '$quantitynew'
- WHERE product_id = '$magsku'");
- echo $magsku;
- echo "<br>LINE BREAK<br>";
- echo $skufull;
- echo $skupostfix;
- //End of Connect to magento and update items stock using id#
- //Connect to itemdb again
- if(!$link)
- {
- die("Could not connect to MySQL");
- }
- mysql_select_db("itemdb",$link) or die ("could not open db".mysql_error());
- if ($quantitynew >="0")
- {
- echo "Quantity Updated to " . $quantitynew . "<a href=\"item_list.php?realm=$realmselect&itemtype=$itemtype\" target=\"view_items\">refresh</a> that page.";
- mysql_query("UPDATE $realmselect2 SET quantity = '$quantitynew'
- WHERE id = '$id'");
- mysql_query("UPDATE $realmselect2 SET pass = '$pass'
- WHERE id = '$id'");
- mysql_query("UPDATE $realmselect2 SET mule = '$mule'
- WHERE id = '$id'");
- mysql_query("UPDATE $realmselect2 SET account = '$account'
- WHERE id = '$id'");
- //Add To Log
- //mysql_query("INSERT INTO log (id,user, item_name,mule,acc-ount,pass,quantity)
- //VALUES ('', '$itemtype', '$itemname', '$mule','$account','$pass','$quantity')");
- //echo '<script type="text/javascript">window.close()</script>';
- }
- echo "<form name=\"ksdb\" method=\"GET\" action=\"edititem.php\">";
- //echo "Item: <input type=\"text\" value=\"$itemname\" name=\"itemname\">";
- echo "Mule #:<input type=\"text\" value=\"$mule\" name=\"mule\"><br />";
- echo "Account: <input type=\"text\" value=\"$account\" name=\"account\"><br />";
- echo "Pass: <input type=\"text\" value=\"$pass\" name=\"password\"><br />";
- echo "Quantity: <input type=\"text\" value=\"$quantity\" name=\"quantitynew\"><br />";
- echo "<input type=\"hidden\" value=\"$id\" name=\"id\">";
- echo "<input type=\"hidden\" value=\"$realmselect\" name=\"realm\">";
- echo "<input type=\"hidden\" value=\"$itemtype\" name=\"itemtype\">";
- echo "<input type=\"hidden\" value=\"$itemname\" name=\"itemname\">";
- echo "<input type=\"submit\" value=\"Update\">";
- echo "</form>"
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement