Пример #1
0
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
    }
} else {
    // if $nameFilter variable is set, save it off session variable for future use
    $_SESSION['categoryNameFilter'] = $nameFilter;
}
// print out the the pulldown menu selection
echo "</br>";
echo "<p>" . $nameFilter . "</p>";
echo "</br>";
?>
        
        
        <?php 
// get the category id from the nameFilter and iduser
$t_iduser = $_SESSION['iduser'];
$result5 = persembleDB::getInstance()->get_category_id($t_iduser, $nameFilter);
$row5 = $result5->fetch(PDO::FETCH_ASSOC);
$id_category = $row5['idcategory'];
?>
        
 		   <form action="" method="get">
 		   	<br/>
		      <input type="hidden" name="id_category" id="id_category" value="<?php 
echo $id_category;
?>
"/> 
 		  		<label>Description: </label>
 		  		<input type="text" name="i_description" id="i_description">
 		  		<br/>
 		  		<br/>
 		  		<label>Brand: </label>
Пример #3
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
// Fetching Values from URL
$idensembles = $_POST['idensembles'];
$iditems = $_POST['iditems'];
// check idensembles to see if this page opened by the proper webpage, if not return to index.php
if ($idensembles == "") {
    header('Location: index.php');
}
if ($idensembles != "") {
    $iduser = $_SESSION['iduser'];
    $query = persembleDB::getInstance()->add_item_to_ensemble($idensembles, $iditems);
    // Set the session variable so that items.php can show add to ensembles
    $_SESSION['ensembleId'] = $idensembles;
} else {
    // reset the session variable
    $_SESSION['ensembleId'] = "";
}
// reload the items.php page
header('Location: items.php');
Пример #4
0
    echo '<script type="text/javascript">window.location = "index.php"; </script>';
}
//Fetching Values from URL
$lname = $_POST['lname1'];
$fname = $_POST['fname1'];
$email = $_POST['email1'];
$password = $_POST['password1'];
$encrypted_password = persembleDB::getInstance()->encrypt($password);
// and encrypt it and check database
// if email not set, return back to myAccount.php
if ($email == "") {
    header('Location: index.php');
}
// check if e-mail address syntax is valid or not
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
// sanitizing email(Remove unexpected symbol like <,>,?,#,!, etc.)
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    echo "Invalid Email....";
} else {
    // get the session iduser
    $iduser = $_SESSION['iduser'];
    // Insert query
    $query = persembleDB::getInstance()->update_user($iduser, $lname, $fname, $email, $encrypted_password);
    if ($query == 1) {
        // now update all the session variables except iduser
        $_SESSION['first_name'] = $fname;
        $_SESSION['last_name'] = $lname;
        $_SESSION['email'] = $email;
        $_SESSION['password'] = $encrypted_password;
    }
}
Пример #5
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
//Fetching Values from URL
$user_iduser = $_SESSION['iduser'];
// if user_iduser not set, return back to index.php
if ($user_iduser == "") {
    header('Location: index.php');
}
$query = persembleDB::getInstance()->delete_all_categories($user_iduser);
// reload the categories.php page
header('Location: categories.php');
<?php

require_once "database/database.php";
if (isset($_SESSION['iduser']) == false || $_SESSION['iduser'] == '') {
    // Redirect to secured index page if user not logged in
    echo '<script type="text/javascript">window.location = "index.php"; </script>';
}
//Fetching Values from URL
$idensembles = $_POST['idensembles'];
$iditems = $_POST['iditems'];
if ($idensembles != "" && $iditems != "") {
    $query = persembleDB::getInstance()->delete_item_from_ensemble($idensembles, $iditems);
    // set the session variable so that the viewEnsemble.php can reload properly
    $_SESSION['viewEnsembleId'] = $idensembles;
} else {
    header('Location: index.php');
}
// reload the ensemble.php page
header('Location: viewEnsemble.php');
Пример #7
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    echo '<script type="text/javascript">window.location = "index.php"; </script>';
}
//Fetching Values from URL
$idensembles = $_POST['idensembles'];
// if idensembles not set, return back to index.php
if ($idensembles == "") {
    header('Location: index.php');
}
$query = persembleDB::getInstance()->delete_ensemble($idensembles);
// reload the ensemble.php page
header('Location: ensemble.php');
Пример #8
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
//Fetching Values from URL
$e_name = $_POST['e_name1'];
if ($e_name != "") {
    $iduser = $_SESSION['iduser'];
    $query = persembleDB::getInstance()->add_ensemble($iduser, $e_name);
} else {
    header('Location: index.php');
}
Пример #9
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
//Fetching Values from URL
$tc_name = $_POST['tc_categoryname1'];
$tc_comments = $_POST['tc_comments1'];
$tc_subcategorytype = $_POST['tc_subcategorytype1'];
$tc_subcategoryname = $_POST['tc_subcategoryname1'];
if ($tc_name != "") {
    $iduser = $_SESSION['iduser'];
    $query = persembleDB::getInstance()->add_category($tc_name, $tc_comments, $tc_subcategorytype, $tc_subcategoryname, $iduser);
    echo $query;
} else {
    header('Location: index.php');
}
Пример #10
0
<!--Content Location for Page-->
<div class="box2">
	<img src="photos/ryanlerch-white-t-shirt.png" alt="Shirt Icon" style="width:75px;height:45px;padding-top: 20px; padding-bottom: 20px; padding-right: 20px"/>

	<fieldset>
  
        <table border="black">
        			 <th>id</th>
                <th>name</th>
                <th>comments</th>
                <th>subcategory type</th>
                <th>subcategory name</th>
                
            <?php 
$t_iduser = $_SESSION['iduser'];
$result = persembleDB::getInstance()->get_all_categories_with_duplicates($t_iduser);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
    echo "<tr><td>" . htmlentities($row['idcategory']) . "</td>";
    echo "<td>" . htmlentities($row['category_name']) . "</td>";
    echo "<td>" . htmlentities($row['comments']) . "</td>";
    echo "<td>" . htmlentities($row['subcategory_type']) . "</td>";
    echo "<td>" . htmlentities($row['subcategory_name']) . "</td>";
    // set variable $id to the retrieved database id
    $idcategory = $row['idcategory'];
    ?>
                <td>
                    <form name="deleteCategory" action="deleteCategory.php" method="POST">
                        <input type="hidden" name="idcategory" value="<?php 
    echo $idcategory;
    ?>
"/>
Пример #11
0
echo "</br>";
?>
	  
    	  
        <table border="black">
        			 <th>id</th>
                <th>name</th>
                
            <?php 
if ($nameFilter == "All Ensembles" || $nameFilter == "") {
    // if $nameFilter is "All Ensembles" or not set, then
    // get all ensembles
    $result = persembleDB::getInstance()->get_all_ensembles_with_duplicates($t_iduser);
} else {
    // else get the filtered by name results
    $result = persembleDB::getInstance()->get_ensembles_by_name($t_iduser, $nameFilter);
}
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
    echo "<tr><td>" . htmlentities($row['idensembles']) . "</td>";
    echo "<td>" . htmlentities($row['name']) . "</td>";
    // set variable $id to the retrieved database id
    $idensembles = $row['idensembles'];
    ?>
                <td>
                    <form name="Add Item" action="items.php" method="POST">
                        <input type="hidden" name="idensembles" value="<?php 
    echo $idensembles;
    ?>
"/>
                        <input type="submit" name="addItem" value="Add Item" style="text-decoration: underline"/>
                    </form>
Пример #12
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    echo '<script type="text/javascript">window.location = "index.php"; </script>';
}
//Fetching Values from URL
$idcategory = $_POST['idcategory'];
// if idcategory not set, return back to categories.php
if ($idcategory == "") {
    header('Location: categories.php');
}
$query = persembleDB::getInstance()->delete_category($idcategory);
// reload the categories.php page
header('Location: categories.php');
Пример #13
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
//Fetching Values from URL
$user_iduser = $_SESSION['iduser'];
// if user_iduser not set, return back to index.php
if ($user_iduser == "") {
    header('Location: index.php');
}
$query = persembleDB::getInstance()->delete_all_ensembles($user_iduser);
// reload the ensemble.php page
header('Location: ensemble.php');
Пример #14
0
        <table border="black">
               <th>description</th>
					<th>brand</th>
					<th>color</th>
					<th>Quantity</th>
					<th>season</th>
					<th>material</th>
					<th>category</th>
					<th>comments</th>
					<th>subcat type</th>
					<th>subcat name</th>
                
            <?php 
$t_iduser = $_SESSION['iduser'];
// get all ensembles
$result = persembleDB::getInstance()->get_all_items_in_an_ensemble($idensembles);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
    echo "<tr><td>" . htmlentities($row['description']) . "</td>";
    echo "<td>" . htmlentities($row['brand']) . "</td>";
    echo "<td>" . htmlentities($row['color']) . "</td>";
    echo "<td>" . htmlentities($row['quantity']) . "</td>";
    echo "<td>" . htmlentities($row['season']) . "</td>";
    echo "<td>" . htmlentities($row['material']) . "</td>";
    echo "<td>" . htmlentities($row['category_name']) . "</td>";
    echo "<td>" . htmlentities($row['comments']) . "</td>";
    echo "<td>" . htmlentities($row['subcategory_type']) . "</td>";
    echo "<td>" . htmlentities($row['subcategory_name']) . "</td>";
    // set variable $id to the retrieved database id
    $iditems = $row['iditems'];
    ?>
  
Пример #15
0
<?php

require_once "database/database.php";
//Fetching Values from URL
$lname = $_POST['lname1'];
$fname = $_POST['fname1'];
$email = $_POST['email1'];
$password = $_POST['password1'];
$encrypted_password = persembleDB::getInstance()->encrypt($password);
// and encrypt it and check database
// if $deleteAccountAttempt not set, return back to index.php
if ($email == "") {
    header('Location: index.php');
}
// check if e-mail address syntax is valid or not
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
// sanitizing email(Remove unexpected symbol like <,>,?,#,!, etc.)
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    echo "Invalid Email....";
} else {
    $iduser = $_SESSION['iduser'];
    persembleDB::getInstance()->delete_user($iduser);
    // now reset session variable values
    $_SESSION['iduser'] = "";
    $_SESSION['first_name'] = "";
    $_SESSION['last_name'] = "";
    $_SESSION['email'] = "";
    $_SESSION['password'] = "";
    echo "You have Successfully Deleted the Account....";
}
Пример #16
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
//Fetching Values from URL
$iidcategory = $_POST['iidcategory1'];
$iiditem = $_POST['iiditem1'];
$iidescription = $_POST['idescription1'];
$ibrand = $_POST['ibrand1'];
$icolor = $_POST['icolor1'];
$iquantity = $_POST['iquantity1'];
$iseason = $_POST['iseason1'];
$imaterial = $_POST['imaterial1'];
if ($iidcategory != "") {
    $iduser = $_SESSION['iduser'];
    $query = persembleDB::getInstance()->add_item($iduser, $iidcategory, $iidescription, $ibrand, $icolor, $iquantity, $iseason, $imaterial);
} else {
    header('Location: index.php');
}
Пример #17
0
    // Check the action `login`
    $email = htmlentities($_POST['emailusername']);
    // Get the emailusername
    $password = htmlentities($_POST['loginpassword']);
    // Get the loginpassword
    $encrypted_password = persembleDB::getInstance()->encrypt($password);
    // and encrypt it and check database
    $query = persembleDB::getInstance()->get_user_count($email, $encrypted_password);
    // Check the table with posted credentials
    // Get the number of rows, if user doesn't exist, then it returns 0, if they exist, then it returns a 1
    $num_rows = $query->fetchColumn();
    if ($num_rows == 0) {
        // If no users exist with posted credentials print 0 like below.
        echo 0;
    } else {
        // Get the user information
        $result = persembleDB::getInstance()->get_user($email, $encrypted_password);
        // Set the SESSION variables
        // NOTE : We have already started the session in the database.php
        $row = $result->fetch(PDO::FETCH_ASSOC);
        $_SESSION['iduser'] = $row['iduser'];
        $_SESSION['first_name'] = $row['first_name'];
        $_SESSION['last_name'] = $row['last_name'];
        $_SESSION['email'] = $row['email'];
        $_SESSION['password'] = $row['password'];
        $_SESSION['is_logged_on'] = 1;
        echo 1;
    }
} else {
    header('Location: index.php');
}
Пример #18
0
<?php

require_once "database/database.php";
// check to see if user is logged in, if not redirect to index.php
if (isset($_SESSION['is_logged_on']) != true || $_SESSION['is_logged_on'] != 1) {
    // Redirect to index.php if user not logged in
    header('Location: index.php');
}
//Fetching Values from URL
$iditem = $_POST['iditem'];
// if iditem not set, return back to index.php
if ($iditem == "") {
    header('Location: index.php');
}
$query = persembleDB::getInstance()->delete_item($iditem);
// reload the ensemble.php page
header('Location: items.php');