![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 6.04.2010 Ostrzeżenie: (0%) ![]() ![]() |
hej. mam problem. czy ktos moze powiedziec mi dlaczego data w aukcji wciacz ustawia mi sie na styczen (january) ![]() <?php session_start(); include("config.php"); include("functions.php"); $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($dbdatabase, $db); $validid = pf_validate_number($_GET['id'], "redirect", $config_basedir); if($_POST['submit']) { if(is_numeric($_POST['bid']) == FALSE) { header("Location: " . $config_basedir . "itemdetails.php?id=" . $validid . "&error=letter"); } $theitemsql = "SELECT * FROM items WHERE id = " . $validid . ";"; $theitemresult = mysql_query($theitemsql); $theitemrow = mysql_fetch_assoc($theitemresult); $checkbidsql = "SELECT item_id, max(amount) AS highestbid, count(id) AS number_of_bids FROM bids WHERE item_id=" . $validid . " GROUP BY item_id;"; $checkbidresult = mysql_query($checkbidsql); $checkbidnumrows = mysql_num_rows($checkbidresult); if($checkbidnumrows == 0) { if($theitemrow['startingprice'] > $_POST['bid']) { header("Location: " . $config_basedir . "itemdetails.php?id=" . $validid . "&error=lowprice#bidbox"); } } else { $checkbidrow = mysql_fetch_assoc($checkbidresult); 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'] . ");"; mysql_query($inssql); header("Location: " . $config_basedir . "itemdetails.php?id=" . $validid); } else { require("header.php"); $itemsql = "SELECT UNIX_TIMESTAMP(dateends) AS dateepoch, items.* FROM items WHERE id = " . $validid . ";"; $itemresult = mysql_query($itemsql); $itemrow = mysql_fetch_assoc($itemresult); $nowepoch = mktime(); $rowepoch = $itemrow['dateepoch']; if($rowepoch > $nowepoch) { $VALIDAUCTION = 1; } echo "<h1>" . $itemrow['name'] . "</h1>"; $imagesql = "SELECT * FROM images WHERE item_id = " . $validid . ";"; $imageresult = mysql_query($imagesql); $imagenumrows = mysql_num_rows($imageresult); $bidsql = "SELECT item_id, MAX(amount) AS highestbid, COUNT(id) AS number_of_bids FROM bids WHERE item_id=" . $validid . " GROUP BY item_id;"; $bidresult = mysql_query($bidsql); $bidnumrows = mysql_num_rows($bidresult); echo "<p>"; if($bidnumrows == 0) { echo "<strong>This item has had no bids</strong> - <strong>Starting Price</strong>: " . $config_currency . sprintf('%.2f', $itemrow['startingprice']); } else { $bidrow = mysql_fetch_assoc($bidresult); echo "<strong>Number Of Bids</strong>: " . $bidrow['number_of_bids'] . " - <strong>Current Price</strong>: " . $config_currency . sprintf('%.2f', $bidrow['highestbid']); } echo " - <strong>Auction ends</strong>: " . date("D jS F Y g.iA", $rowepoch); echo "</p>"; if($imagenumrows == 0) { echo "No images."; } else { while($imagerow = mysql_fetch_assoc($imageresult)) { echo "<img src='./images/" . $imagerow['name'] ."' width='200'>"; } } echo "<p>" . nl2br($itemrow['description']) . "</p>"; echo "<a name='bidbox'></a>"; echo "<h2>Bid for this item</h2>"; if(isset($_SESSION['USERNAME']) == FALSE) { echo "To bid, you need to log in. Login <a href='login.php?id=" . $validid . "&ref=addbid'>here</a>."; } else { if($VALIDAUCTION == 1) { echo "Enter the bid amount into the box below."; echo "<p>"; switch($_GET['error']) { case "lowprice": echo "The bid entered is too low. Please enter another price."; break; case "letter": echo "The value entered is not a number."; break; } ?> <form action="<?php echo pf_script_with_get($SCRIPT_NAME); ?>" method="post"> <table> <tr> <td><input type="text" name="bid"></td> <td><input type="submit" name="submit" value="Bid!"></td> </tr> </table> </form> <?php } else { echo "This auction has now ended."; } $historysql = "SELECT bids.amount, users.username FROM bids, users WHERE bids.user_id = users.id AND item_id = " . $validid . " ORDER BY amount DESC"; $historyresult = mysql_query($historysql); $historynumrows = mysql_num_rows($historyresult); if($historynumrows >= 1) { echo "<h2>Bid History</h2>"; echo "<ul>"; while($historyrow = mysql_fetch_assoc($historyresult)) { echo "<li>" . $historyrow['username'] . " - " . $config_currency . sprintf('%.2f', $historyrow['amount']) . "</li>"; } echo "</ul>"; } } } require("footer.php"); ?> |
|
|
![]()
Post
#2
|
|
![]() Grupa: Moderatorzy Postów: 15 467 Pomógł: 1451 Dołączył: 25.04.2005 Skąd: Szczebrzeszyn/Rzeszów ![]() |
Używaj bbcode...
-------------------- ![]() ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW! |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 6.04.2010 Ostrzeżenie: (0%) ![]() ![]() |
Wisz moze gdzie szukac bledu?? Sorki, jestem nowy, jak wlaczyc bbcode i ..co to takiego wlasciwie? |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 79 Pomógł: 3 Dołączył: 16.01.2009 Skąd: lubelskie Ostrzeżenie: (10%) ![]() ![]() |
jak piszesz post to masz u góry takie przyciski PHP, Manual, SQL itp...wstawiaj kod w te znaczniki odpowiednio do jego rodzaju
|
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 6.04.2010 Ostrzeżenie: (0%) ![]() ![]() |
Chociaz bledu z misiacem nalezy raczej szukac w tym kodzie, we wczesniejszym jest blad z zamieszczeniam "bid'u " (pierwszego)- pozwala na mniejsza od zadanej ceny, kolejny bid juz nie.. <?php session_start(); require("config.php"); require("functions.php"); $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($dbdatabase, $db); if(isset($_SESSION['USERNAME']) == FALSE) { header("Location: " . $config_basedir . "/login.php?ref=newitem"); } if($_POST['submit']) { $validdate = checkdate($_POST['month'], $_POST['day'], $_POST['year']); if($validdate == TRUE) { $concatdate = $_POST['year'] . "-" . sprintf("%02d", $_POST['day']) . "-" . sprintf("%02d", $_POST['month']) . " " . $_POST['hour'] . ":" . $_POST['minute'] . ":00"; $itemsql = "INSERT INTO items(user_id, cat_id, name, startingprice, description, dateends) VALUES(" . $_SESSION['USERID'] . ", " . $_POST['cat'] . ", '" . addslashes($_POST['name']) . "', " . addslashes($_POST['price']) . ", '" . addslashes($_POST['description']) . "', '" . $concatdate . "');"; mysql_query($itemsql); $itemid = mysql_insert_id(); header("Location: " . $config_basedir . "/addimages.php?id=" . $itemid); } else { header("Location: " . $config_basedir . "/newitem.php?error=date"); } } else { require("header.php"); ?> <h1>Add a new item</h1> <strong>Step 1</strong> - Add your item details. <p> <?php switch($_GET['error']) { case "date": echo "<strong>Invalid date - please choose another!</strong>"; break; } ?> </p> <form action="<?php echo pf_script_with_get($SCRIPT_NAME); ?>" method="post"> <table> <?php $catsql = "SELECT * FROM categories ORDER BY category;"; $catresult = mysql_query($catsql); ?> <tr> <td>Category</td> <td> <select name="cat"> <?php while($catrow = mysql_fetch_assoc($catresult)) { echo "<option value='" . $catrow['id'] . "'>" . $catrow['category'] . "</option>"; } ?> </select> </td> </tr> <tr> <td>Item name</td> <td><input type="text" name="name"></td> </tr> <tr> <td>Item description</td> <td><textarea name="description" rows="10" cols="50"></textarea></td> </tr> <tr> <td>Ending date</td> <td> <table> <tr> <td>Day</td> <td>Month</td> <td>Year</td> <td>Hour</td> <td>Minute</td> </tr> <tr> <td> <select name="day"> <?php for($i=1;$i<=31;$i++) { echo "<option>" . $i . "</option>"; } ?> </select> </td> <td> <select name="month"> <?php for($i=1;$i<=12;$i++) { echo "<option>" . $i . "</option>"; } ?> </select> </td> <td> <select name="year"> <?php for($i=2010;$i<=2012;$i++) { echo "<option>" . $i . "</option>"; } ?> </select> </td> <td> <select name="hour"> <?php for($i=0;$i<=23;$i++) { echo "<option>" . sprintf("%02d",$i) . "</option>"; } ?> </select> </td> <td> <select name="minute"> <?php for($i=0;$i<=60;$i++) { echo "<option>" . sprintf("%02d",$i) . "</option>"; } ?> </select> </td> </tr> </table> </td> </tr> <tr> <td>Price</td> <td><?php echo $config_currency; ?><input type="text" name="price"></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="Post!"></td> </tr> </table> </form> <?php } require("footer.php"); ?> |
|
|
![]()
Post
#6
|
|
![]() Newsman Grupa: Moderatorzy Postów: 4 005 Pomógł: 548 Dołączył: 7.04.2008 Skąd: Trzebinia/Kraków ![]() |
zostałeś poproszony o bbcode, nie zastosowałeś się. zamykam. obiekcje? zapraszam na PW do któregoś z opiekunów lub moderatorów z propozycją poprawnego bbcode.
ps. jako lekture dodatkową polecam: Temat: Jak poprawnie zada pytanie -------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.07.2025 - 09:33 |