Example #1
0
                    $_SESSION['price'] = $price;
                    $_SESSION['quantity'] = $quantity;
                    $_SESSION['colourway'] = $colourway;
                    $_SESSION['weight'] = $weight;
                    $_SESSION['yards'] = $yards;
                    $_SESSION['unitWeight'] = $unitWeight;
                    $_SESSION['fiber'] = $fiber;
                    $_SESSION['description'] = $description;
                    message("bad", " Error uploading file: image name already exists. Product has not been updated. <a href=\"edit_product.php?id=" . $item . "\">Go back.</a>");
                    exit(0);
                }
                $item_array = array(':name' => $name, ':brand' => $brand, ':price' => $price, ':quantity' => $quantity, ':colourway' => $colourway, ':weight' => $weight, ':yards' => $yards, ':unitWeight' => $unitWeight, ':fiber' => $fiber, ':description' => $description, ':image' => $image, ':item' => $item);
                $sql = 'UPDATE Inventory SET name=:name, brand=:brand, price=:price, quantity=:quantity, colourway=:colourway, weight=:weight, yards=:yards, unitWeight=:unitWeight, fiber=:fiber, description=:description, image=:image WHERE `item#`=:item';
                db_edit_entry($item_array, $sql);
            } else {
                $item_array = array(':name' => $name, ':brand' => $brand, ':price' => $price, ':quantity' => $quantity, ':colourway' => $colourway, ':weight' => $weight, ':yards' => $yards, ':unitWeight' => $unitWeight, ':fiber' => $fiber, ':description' => $description, ':item' => $item);
                $sql = 'UPDATE Inventory SET name=:name, brand=:brand, price=:price, quantity=:quantity, colourway=:colourway, weight=:weight, yards=:yards, unitWeight=:unitWeight, fiber=:fiber, description=:description WHERE `item#`=:item';
                db_edit_entry($item_array, $sql);
            }
            message("good", " Successfully updated! <a href=\"product.php?id=" . $item . "\">Continue</a>");
        } else {
            die('Error editing product');
        }
    } else {
        message("bad", "You do not have permission to view this page. <a href=\"index.php\">Go Home</a>");
    }
} else {
    message("bad", " You must be a logged in administrator to do this! <a href=\"login.php\">Log in</a>");
}
output_page_footer();
output_html5_footer();
Example #2
0
function send_user_to_login_page($html_msg)
{
    $url = 'login.php';
    header('Location: ' . $url);
    $_SESSION['login.php-errormsg'] = $html_msg;
    output_html5_header('Login Unsuccessful', array("css/common.php"));
    output_page_header();
    echo <<<ZZEOF
  <div id="content-message-only">
    <p>Click <a href="{$url}">here</a> to continue.</p>
  </div>
ZZEOF;
    output_page_footer();
    output_html5_footer();
    exit(0);
}