W pierwszym postąpieniu, skrypt akceptuje nizsza cene niz w ofercie, nastepnie juz tylko wieksze. Dlaczego?
<?php include("config.php"); include("functions.php"); $validid = pf_validate_number($_GET['id'], "redirect", $config_basedir); if($_POST['submit']) { } $theitemsql = "SELECT * FROM items WHERE id = " . $validid . ";"; $checkbidsql = "SELECT item_id, max(amount) AS highestbid, count(id) AS number_of_bids FROM bids WHERE item_id=" . $validid . " GROUP BY item_id;"; if($checkbidnumrows == 0) { if($theitemrow['startingprice'] > $_POST['bid']) { header("Location: " . $config_basedir . "itemdetails.php?id=" . $validid . "&error=lowprice#bidbox"); } } else { if($checkbidrow['highestbid'] > $_POST['bid']) { header("Location: " . $config_basedir . "itemdetails.php?id=" . $validid . "&error=lowprice#bidbox"); } } $inssql = "INSERT INTO bids(item_id, amount, user_id) VALUES(" . $validid . ", " . $_POST['bid'] . ", " . $_SESSION['USERID'] . ");"; } else { require("header.php"); $itemsql = "SELECT UNIX_TIMESTAMP(dateends) AS dateepoch, items.* FROM items WHERE id = " . $validid . ";"; $rowepoch = $itemrow['dateepoch']; if($rowepoch > $nowepoch) { $VALIDAUCTION = 1; } $imagesql = "SELECT * FROM images WHERE item_id = " . $validid . ";"; $bidsql = "SELECT item_id, MAX(amount) AS highestbid, COUNT(id) AS number_of_bids FROM bids WHERE item_id=" . $validid . " GROUP BY item_id;"; if($bidnumrows == 0) { } else { } if($imagenumrows == 0) { } else { } } echo "To bid, you need to log in. Login <a href='login.php?id=" . $validid . "&ref=addbid'>here</a>."; } else { if($VALIDAUCTION == 1) { switch($_GET['error']) { case "lowprice": break; case "letter": break; } ?> <table> <tr> <td><input type="text" name="bid"></td> <td><input type="submit" name="submit" value="Bid!"></td> </tr> </table> </form> <?php } else { } $historysql = "SELECT bids.amount, users.username FROM bids, users WHERE bids.user_id = users.id AND item_id = " . $validid . " ORDER BY amount DESC"; if($historynumrows >= 1) { } } } } require("footer.php"); ?>