how I know it:
locking ur shop if user have nt enough plusses? can u help me pls?
locking ur shop if user have nt enough plusses? can u help me pls?
if($action=="buy")
{
addonline(getuid_sid($sid),"Your Site Name Shop","");
$pstyle = gettheme($sid);
echo xhtmlhead("Your Site Name shop",$pstyle);
echo "<p align=\"center\">";
$nick = getnick_sid($sid);
$who = getuid_nick($nick);
$credits = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
$items = mysql_fetch_array(mysql_query("SELECT itemname, itmeprice, itemshopid, avail FROM ibwf_shop WHERE itemid='".$itemid."'"));
echo "<b><u>$items[0]</u></b><br/>";
echo "</p>";
echo "<p>";
if($items[3]>0){
if($items[1]>$credits[0]){
echo "You don't have enough credits to buy this itme.<br/>";
}else{
$reg = mysql_query("INSERT INTO ibwf_shop_Inventory SET uid='".$who."', itemid='".$itemid."', time='".time()."'");
$ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
$ugpl = $ugpl[0] - $items[1];
mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$who."'");
$totitems = mysql_fetch_array(mysql_query("SELECT avail FROM ibwf_shop WHERE itemid='".$itemid."'"));
$totitems = $totitems[0] - 1;
mysql_query("UPDATE ibwf_shop SET avail='".$totitems."' WHERE itemid='".$itemid."'");
echo "Congrats, you have just bought the $items[0]<br/>";
}
}else{
echo "Out Of Stock, We Restock every Month";
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"mshop.php?action=main&sid=$sid\">Back to Shop</a><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo xhtmlfoot();
}
if($action=="buy")
{
addonline(getuid_sid($sid),"Your Site Name Shop","");
echo "<card id=\"main\" title=\"Your Site Name Shop\">";
echo "<p align=\"center\">";
$nick = getnick_sid($sid);
$who = getuid_nick($nick);
$credits = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
$items = mysql_fetch_array(mysql_query("SELECT itemname, itmeprice, itemshopid, avail FROM ibwf_shop WHERE itemid='".$itemid."'"));
echo "<b><u>$items[0]</u></b><br/>";
echo "</p>";
echo "<p>";
if($items[3]>0){
if($items[1]>$credits[0]){
echo "You don't have enough credits to buy this itme.<br/>";
}else{
$reg = mysql_query("INSERT INTO ibwf_shop_Inventory SET uid='".$who."', itemid='".$itemid."', time='".time()."'");
$ugpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
$ugpl = $ugpl[0] - $items[1];
mysql_query("UPDATE ibwf_users SET plusses='".$ugpl."' WHERE id='".$who."'");
$totitems = mysql_fetch_array(mysql_query("SELECT avail FROM ibwf_shop WHERE itemid='".$itemid."'"));
$totitems = $totitems[0] - 1;
mysql_query("UPDATE ibwf_shop SET avail='".$totitems."' WHERE itemid='".$itemid."'");
echo "Congrats, you have just bought the $items[0]<br/>";
}
}else{
echo "Out Of Stock, We Restock every Month";
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"mshop.php?action=main&sid=$sid\">Back to Shop</a><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p><card>";
}
Comment