Esempio n. 1
0
<?php

require_once 'lib/dblibs.php';
require_once 'lib/lib.php';
output_html5_header('Edit Product', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js"));
if (array_key_exists('loggedin', $_SESSION)) {
    if (is_admin($_SESSION['loggedin'])) {
        if (count($_POST) == 11 && array_key_exists('item', $_POST) && array_key_exists('name', $_POST) && array_key_exists('brand', $_POST) && array_key_exists('price', $_POST) && array_key_exists('quantity', $_POST) && array_key_exists('colourway', $_POST) && array_key_exists('weight', $_POST) && array_key_exists('yards', $_POST) && array_key_exists('unitWeight', $_POST) && array_key_exists('fiber', $_POST) && array_key_exists('description', $_POST) && array_key_exists('image', $_FILES)) {
            $item = htmlspecialchars(trim($_POST['item']));
            $name = htmlspecialchars(trim($_POST['name']));
            $brand = htmlspecialchars(trim($_POST['brand']));
            $price = htmlspecialchars(trim($_POST['price']));
            $quantity = htmlspecialchars(trim($_POST['quantity']));
            $colourway = htmlspecialchars(trim($_POST['colourway']));
            $weight = htmlspecialchars(trim($_POST['weight']));
            $yards = htmlspecialchars(trim($_POST['yards']));
            $unitWeight = htmlspecialchars(trim($_POST['unitWeight']));
            $fiber = htmlspecialchars(trim($_POST['fiber']));
            $description = htmlspecialchars(trim($_POST['description']));
            $errorP = false;
            $errorQ = false;
            $errorY = false;
            $errorUW = false;
            if (!check_number($price)) {
                $errorP = true;
                $_SESSION['errorP'] = true;
            }
            if (!check_number($quantity)) {
                $errorQ = true;
                $_SESSION['errorQ'] = true;
            }
Esempio n. 2
0
<?php

require_once 'lib/lib.php';
require_once 'lib/dblibs.php';
output_html5_header('Delete User', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js", "js/carousel.js"));
if (array_key_exists('loggedin', $_SESSION)) {
    global $db_connection_handle;
    db_connect();
    has_carts($_GET['id']);
    $sql = "DELETE FROM Users WHERE `user#`='" . $_GET['id'] . "'";
    $getcart = $db_connection_handle->prepare($sql);
    $getcart->execute();
    header('Location:logout.php');
} else {
    message("bad", " You must be logged in to see this! <a href=\"login.php\">Log in</a>");
}
output_page_footer();
output_html5_footer();
Esempio n. 3
0
<?php

require_once 'lib/dblibs.php';
require_once 'lib/lib.php';
output_html5_header('Login', array("bootstrap/css/bootstrap.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js"));
output_page_menu();
if (count($_POST) == 2 && array_key_exists('login', $_POST) && array_key_exists('pass', $_POST)) {
    $login = htmlspecialchars(trim($_POST['login']));
    $pass = htmlspecialchars(trim($_POST['pass']));
    if (check_email($login)) {
        db_connect();
        if (db_check_user($login, $pass)) {
            $_SESSION['loggedin'] = $login;
            header('Location: my_page.php');
            exit(0);
        } else {
            unset($_SESSION['loggedin']);
            message("bad", " Email or password incorrect. Try again.<a href='login.php?email=" . $login . "'> Go back. </a>");
            exit(0);
        }
    } else {
        unset($_SESSION['loggedin']);
        message("bad", " Invalid email address. Try again.<a href='login.php?email=" . $login . "'> Go back. </a>");
        exit(0);
    }
} else {
    unset($_SESSION['loggedin']);
    header('Location: login.php');
    exit(0);
}
output_page_footer();
Esempio n. 4
0
<?php

require_once 'lib/lib.php';
require_once 'lib/dblibs.php';
require_once 'lib/install_lib.php';
output_html5_header('Install', array("css/style.css"));
db_connect();
create_tables();
populate_tables();
echo '<a href="index.php">Go to the Home Page</a>';
Esempio n. 5
0
<?php

require_once 'lib/lib.php';
output_html5_header('Register', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js"));
$errors = false;
output_page_menu();
if (array_key_exists('email', $_SESSION) && array_key_exists('fName', $_SESSION) && array_key_exists('lName', $_SESSION) && array_key_exists('problem', $_SESSION)) {
    $errors = true;
    $problem = $_SESSION['problem'];
    unset($_SESSION['problem']);
    $email = $_SESSION['email'];
    unset($_SESSION['email']);
    $fName = $_SESSION['fName'];
    unset($_SESSION['fName']);
    $lName = $_SESSION['lName'];
    unset($_SESSION['lName']);
}
?>

<h1>Register</h1>
<form class="form-horizontal" action="registration.php" method="POST">
  <fieldset>
    <div class="form-group">
    <label class="col-md-4 control-label" for="firstname">First Name</label>
    <div class="col-md-4"> <input id="firstname" name="firstName" type="text" placeholder="First Name" class="form-control input-md" required=""
				<?php 
if ($errors) {
    echo ' value="' . $fName . '"></div>';
    if ($problem == 2 || $problem == 3 || $problem == 6 || $problem == 7) {
        echo '<span class="error">! invalid name</span>';
    }
Esempio n. 6
0
<?php

function are_you_sure($type, $string, $id, $subject)
{
    $url = $type . '_' . $subject . '.php?id=' . $id;
    echo <<<ZZEOT
<h1>Attention</h1>
<p>Are you sure you want {$type} {$string}? </p>
<div class="col-sm-offset-4 col-sm-8">
<button onclick="history.go(-1);" class="btn btn-default">Cancel</button>
<button onclick="location.href='{$url}';" class="btn btn-success">Go ahead</button>
</div>
ZZEOT;
}
require_once 'lib/lib.php';
require_once 'lib/dblibs.php';
output_html5_header("Are you sure?", array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js"));
if (array_key_exists('loggedin', $_SESSION)) {
    output_page_menu();
    are_you_sure($_GET['type'], $_GET['string'], $_GET['id'], $_GET['subject']);
} else {
    message("bad", "You do not have permission to view this page. <a href=\"index.php\">Go Home</a>");
}
output_page_footer();
output_html5_footer();
Esempio n. 7
0
<?php

require_once 'lib/lib.php';
require_once 'lib/dblibs.php';
output_html5_header('Shopping Cart', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js", "js/carousel.js"));
if (array_key_exists('loggedin', $_SESSION)) {
    output_page_menu();
    db_connect();
    $user_id = db_get_user_id($_SESSION['loggedin']);
    $cart = get_cart($user_id);
    ?>

<?php 
    ?>
<h1>Shopping Cart</h1>
<div class="row">
<table class="table table-hover cart_table">
	<thead>
		<th>Product</th>
		<th></th>
		<th>Price</th>
		<th>Quantity</th>
	</thead>
	<tbody>
	<?php 
    $i = 0;
    $s = 's';
    $subtotal = 0;
    if ($cart != NULL) {
        $i = 0;
        $s = 's';
Esempio n. 8
0
<?php

require_once 'lib/dblibs.php';
require_once 'lib/lib.php';
output_html5_header('Process Transaction', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js"));
if (array_key_exists('loggedin', $_SESSION)) {
    if (count($_POST) == 8 && array_key_exists('name', $_POST) && array_key_exists('cardNum', $_POST) && array_key_exists('cvc', $_POST) && array_key_exists('expM', $_POST) && array_key_exists('expY', $_POST)) {
        $name = htmlspecialchars(trim($_POST['name']));
        $cardNum = htmlspecialchars(trim($_POST['cardNum']));
        $cvc = htmlspecialchars(trim($_POST['cvc']));
        $expM = htmlspecialchars(trim($_POST['expM']));
        $expY = htmlspecialchars(trim($_POST['expY']));
        $errorCVC = false;
        $errorMY = false;
        $errorDate = false;
        if (!check_number($cvc)) {
            $errorCVC = true;
            $_SESSION['errorCVC'] = true;
        }
        if (!check_number($expM) && !check_number($expY)) {
            $errorMY = true;
            $_SESSION['errorMY'] = true;
        } else {
            date_default_timezone_set('America/Toronto');
            $year = date('Y');
            $month = date('m');
            if ($expY <= $year) {
                if ($expM <= $month) {
                    $errorDate = true;
                    $_SESSION['errorDate'] = true;
                }
Esempio n. 9
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);
}
Esempio n. 10
0
<?php

require_once 'lib/lib.php';
require_once 'lib/dblibs.php';
output_html5_header('Contact Us', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js", "js/tinymce/tinymce.min.js", "js/ajax.js"));
?>
<script type="text/javascript">
tinymce.init({
    selector: "textarea"
 });
</script>
<?php 
output_page_menu();
?>

<h1>Contact Us</h1>
<form class="form-horizontal" action="contact_send.php" method="POST">
  <fieldset>
    <div class="form-group">
      <label class="col-md-4 control-label" for="name">Name</label>
      <div class="col-md-4">
        <input id="name" name="name" type="text" placeholder="Insert your full name" class="form-control input-md" required="">
      </div>
    </div>
    <div class="form-group">
      <label class="col-md-4 control-label" for="email">Email</label>
      <div class="col-md-4">
        <input id="email" name="email" type="email" placeholder="*****@*****.**" class="form-control input-md" required="">
      </div>
    </div>
    <div class="form-group">
Esempio n. 11
0
<?php

require_once 'lib/lib.php';
require_once 'lib/search.php';
require_once 'lib/carousel.php';
output_html5_header('Home', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js", "js/carousel.js", "js/reveal.js", "js/ajax.js"));
output_page_menu();
carousel();
?>

	
	<div class="container_prod">
<?php 
search('', '*', 10);
?>
	</div>
	<br/><br/>
<?php 
output_page_footer();
output_html5_footer();
?>

Esempio n. 12
0
<?php

require_once 'lib/lib.php';
//require_once(dirname(__FILE__).'/lib/lib.php');
output_html5_header('My First Page', array("css/common.php"));
output_page_header();
output_page_menu();
output_home_page_content();
output_page_footer();
output_html5_footer();