} include './includes/header.html'; $prod_conn = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $prod_conn); $query_new = "SELECT * FROM stock ORDER BY art_no"; $res_new = mysql_query($query_new); $row_new = mysql_fetch_assoc($res_new); $cust_sql = "SELECT id,email FROM current WHERE id = 1"; $cust_result = mysql_query($cust_sql) or die(mysql_error()); $cust = mysql_fetch_object($cust_result); $_SESSION['custom_num'] = $cust->id; $_SESSION['email'] = $cust->email; mysql_free_result($cust_result); $myCart = new db_stock_cart($_SESSION['custom_num']); if (isset($_GET['add']) || isset($_GET['product'])) { if ($myCart->check_against_stock($_GET['stock'], 1)) { $myCart->handle_cart_row($_GET['art_no'], $_GET['product'], 1, $_GET['price']); } } $num_rows = $myCart->get_number_of_records(); if (isset($_GET['action']) && $_GET['action'] == "checkout") { if ($num_rows > 0) { header("Location: " . CHECKOUT); } else { $myCart->error = "Vasa kosarica je trenutno prazna!"; } } ?> <h2>Dodavanje Proizvoda u kosaricu</h2> <h4>Imate dvije opcije dodavanja u kosaricu<br><br> a. pomocu paypal sucelja <br>
$form_field .= $db_value; } else { $form_field .= ""; } $form_field .= "</textarea>\n"; return $form_field; } $cust_no = $_SESSION['custom_num']; $cust_email = $_SESSION['email']; // echo $cust_email; Za debugiranje - trazenje gresaka $myCheckout = new db_stock_cart($_SESSION['custom_num']); if (isset($_GET['action']) && $_GET['action'] == "cancel") { $myCheckout->cancel_order(); } if (isset($_GET['add']) && $_GET['add'] == "Update") { if ($myCheckout->check_against_stock($_GET['stock'], $_GET['quantity'])) { $myCheckout->update_row($_GET['row_id'], $_GET['quantity']); } } if (isset($_GET['submit'])) { $myCheckout->update_shipment($_GET['address'], $_GET['postal_code'], $_GET['place'], $_GET['country']); if ($_GET['submit'] == "Order now!") { $address = $_GET['address']; $postal_code = $_GET['postal_code']; $place = $_GET['place']; $country = $_GET['country']; //echo 'tekst'; Za debugiranje - trazenje gresaka $sql = sprintf("UPDATE users SET address = '{$address}', postal_code = '{$postal_code}', \r\n place = '{$place}', country = '{$country}' WHERE order_id = %s ", $_SESSION['order_id']); $q = mysql_query($sql); header("Location:delivery.php"); }