chavdave26

shops.php

Oct 17th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. include "globals.php";
  6. $_GET['shop'] = abs((int) $_GET['shop']);
  7. if(!$_GET['shop'])
  8. {
  9. print "
  10.  
  11. <div class='generalinfo_txt'>
  12. <div><img src='images/info_left.jpg' alt='' /></div>
  13. <div class='info_mid'><h2 style='padding-top:10px;'> Shops </h2></div>
  14. <div><img src='images/info_right.jpg' alt='' /></div> </div>
  15. <div class='generalinfo_simple'><br> <br><br>
  16.  
  17.  
  18. You begin looking through town and you see a few shops.<br />";
  19. $q=$db->query("SELECT * FROM shops WHERE shopLOCATION={$ir['location']}");
  20. print "<table width=85% cellspacing=1 border=1 class='table'><tr style='background: gray;'><th>Shop</th><th>Description</th></tr>";
  21. while($r=$db->fetch_row($q))
  22. {
  23. print "<tr><td><a href='shops.php?shop={$r['shopID']}'>{$r['shopNAME']}</a></td><td>{$r['shopDESCRIPTION']}</td></tr>";
  24. }
  25. print "</table></div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div>";
  26. }
  27. else
  28. {
  29. $sd=$db->query("SELECT * FROM shops WHERE shopID={$_GET['shop']}");
  30. if($db->num_rows($sd))
  31. {
  32. $shopdata=$db->fetch_row($sd);
  33. if($shopdata['shopLOCATION'] == $ir['location'])
  34. {
  35. print "
  36.  
  37. <div class='generalinfo_txt'>
  38. <div><img src='images/info_left.jpg' alt='' /></div>
  39. <div class='info_mid'><h2 style='padding-top:10px;'> {$shopdata['shopNAME']} </h2></div>
  40. <div><img src='images/info_right.jpg' alt='' /></div> </div>
  41. <div class='generalinfo_simple'><br> <br><br>
  42.  
  43. Browsing items at <b> {$shopdata['shopNAME']} ...</b><br />
  44. <table cellspacing=1 class='table'><tr style='background: gray;'><th>Item</th><th>Description</th><th>Price</th><th>Sell Price</th><th>Buy</th></tr>";
  45. $qtwo=$db->query("SELECT si.*,i.*,it.* FROM shopitems si LEFT JOIN items i ON si.sitemITEMID=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE si.sitemSHOP={$_GET['shop']} ORDER BY i.itmtype ASC, i.itmbuyprice ASC, i.itmname ASC");
  46. $lt="";
  47. while($r=$db->fetch_row($qtwo))
  48. {
  49. if($lt!=$r['itmtypename'])
  50. {
  51. $lt=$r['itmtypename'];
  52. print "\n<tr style='background: gray;'><th colspan=5>{$lt}</th></tr>";
  53. }
  54. print "\n<tr><td>{$r['itmname']}</td><td>{$r['itmdesc']}</td><td>\${$r['itmbuyprice']}</td><td>\${$r['itmsellprice']}</td><td><form action='itembuy.php?ID={$r['itmid']}' method='post'>Qty: <input type='text' STYLE='color: black; background-color: white;' name='qty' value='1' /><input type='submit' STYLE='color: black; background-color: white;' value='Buy' /></form></td></tr>";
  55. }
  56. print "</table></div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div>";
  57. }
  58. else
  59. {
  60. print "You are trying to access a shop in another city!";
  61. }
  62. }
  63. else
  64. {
  65. print "You are trying to access an invalid shop!";
  66. }
  67. }
  68. $h->endpage();
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment