Ejemplo n.º 1
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("SUBCATEGORY", "c");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['cat'])) {
        $cat = $_POST['cat'];
        if (preg_match("/[a-zA-Z]{5,20}/", $cat)) {
            include "Opr.php";
            $opr = new Opr();
            $sub = $opr->get_pro_sub($cat);
            if ($sub === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[SUBCATEGORY] = $sub;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    28/08/2015
 * @edited     28/08/2015
 */
define("STATUS", "s");
define("FEATURES", "f");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['info_id']) && isset($_POST['column_index'])) {
        $info_id = $_POST['info_id'];
        $column_index = $_POST['column_index'];
        if (preg_match("/[0-9]+/", $info_id) && preg_match("/[0-9]+/", $column_index)) {
            include "Opr.php";
            $opr = new Opr();
            $features = $opr->get_item_column_features($info_id, $column_index);
            if ($features === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[FEATURES] = $features;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 3
0
 * web service
 * sign in
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
$response = array();
if (isset($_POST['email']) && isset($_POST['pass'])) {
    $email = $_POST['email'];
    $password = $_POST['pass'];
    if (filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match("/[a-zA-Z0-9]{5,20}/", $password)) {
        include "Opr.php";
        $opr = new Opr();
        $id = $opr->get_id($email, $password);
        if ($id === false) {
            $response[STATUS] = 3;
        } else {
            session_start();
            $_SESSION['id'] = $id;
            $response[STATUS] = 7;
        }
    } else {
        $response[STATUS] = 2;
    }
} else {
    $response[STATUS] = 1;
}
echo json_encode($response);
Ejemplo n.º 4
0
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['item_id']) && isset($_POST['info_id']) && isset($_POST['name'])) {
        $item_id = $_POST['item_id'];
        $info_id = $_POST['info_id'];
        $name = $_POST['name'];
        if (preg_match("/[0-9]+/", $item_id) && preg_match("/[0-9]+/", $info_id) && preg_match("/[0-9a-zA-Z]{4,25}/", $name)) {
            include "Opr.php";
            $opr = new Opr();
            $check = $opr->add_item_watch_list($_SESSION['id'], $item_id, $info_id, $name);
            if ($check === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
}
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("VENDORS", "v");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['item_id']) && isset($_POST['info_id'])) {
        $item_id = $_POST['item_id'];
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $item_id) && preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $vendors = $opr->get_item_related_vendors($item_id, $info_id);
            if ($vendors === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[VENDORS] = $vendors;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    28/08/2015
 * @edited     30/08/2015
 */
define("STATUS", "s");
define("ITEMS", "f");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['info_id'])) {
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $items = $opr->get_searchable_items($info_id);
            if ($items === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[ITEMS] = $items;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 7
0
<?php

/**
 * web service
 * check promotion watch list
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    28/08/2015
 * @edited     28/08/2015
 */
define("STATUS", "s");
define("CHECK", "c");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    include "Opr.php";
    $opr = new Opr();
    $check_list = $opr->check_item_watch_list($_SESSION['id']);
    if ($check_list === false) {
        $response[STATUS] = 3;
    } else {
        $response[STATUS] = 7;
        $response[CHECK] = $check_list;
    }
} else {
    $response[STATUS] = 0;
}
echo json_encode($response);
Ejemplo n.º 8
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    21/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("NAMES", "n");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['info_id'])) {
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $names = $opr->get_item_column_names($info_id);
            if ($names === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[NAMES] = $names;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 9
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("ITEMS", "i");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['info_id'])) {
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $items = $opr->get_items($info_id);
            if ($items === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[ITEMS] = $items;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 10
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    21/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("PROMOTION", "p");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['promotion_id'])) {
        $promotion_id = $_POST['promotion_id'];
        if (preg_match("/[0-9]+/", $promotion_id)) {
            include "Opr.php";
            $opr = new Opr();
            $promotion = $opr->get_promotion($promotion_id);
            if ($promotion === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[PROMOTION] = $promotion;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 11
0
<?php

/**
 * web service
 * get item categories
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("CATEGORY", "c");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    include "Opr.php";
    $opr = new Opr();
    $cat = $opr->get_item_categories();
    if ($cat === false) {
        $response[STATUS] = 3;
    } else {
        $response[STATUS] = 7;
        $response[CATEGORY] = $cat;
    }
} else {
    $response[STATUS] = 0;
}
echo json_encode($response);
Ejemplo n.º 12
0
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    28/08/2015
 * @edited     30/08/2015
 */
define("STATUS", "s");
define("ITEMS", "i");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['info_id']) && isset($_POST['features'])) {
        $info_id = $_POST['info_id'];
        $features = $_POST['features'];
        if (preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $items = $opr->custom_item_search($info_id, $features);
            if ($items === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[ITEMS] = $items;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
<?php

/**
 * web service
 * check promotion watch list
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    28/08/2015
 * @edited     28/08/2015
 */
define("STATUS", "s");
define("CHECK", "c");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    include "Opr.php";
    $opr = new Opr();
    $check_list = $opr->check_promotion_watch_list($_SESSION['id']);
    if ($check_list === false) {
        $response[STATUS] = 3;
    } else {
        $response[STATUS] = 7;
        $response[CHECK] = $check_list;
    }
} else {
    $response[STATUS] = 0;
}
echo json_encode($response);
Ejemplo n.º 14
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("SUBCATEGORY", "c");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['cat'])) {
        $cat = $_POST['cat'];
        if (preg_match("/[a-zA-Z]{5,20}/", $cat)) {
            include "Opr.php";
            $opr = new Opr();
            $sub = $opr->get_item_sub($cat);
            if ($sub === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[SUBCATEGORY] = $sub;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    21/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("PROMOTIONS", "p");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['store_id'])) {
        $store_id = $_POST['store_id'];
        if (preg_match("/[0-9]+/", $store_id)) {
            include "Opr.php";
            $opr = new Opr();
            $promotions = $opr->get_store_related_promotions($store_id);
            if ($promotions === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[PROMOTIONS] = $promotions;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("STORES", "t");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['item_id']) && isset($_POST['info_id'])) {
        $item_id = $_POST['item_id'];
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $item_id) && preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $stores = $opr->get_item_related_stores($item_id, $info_id);
            if ($stores === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[STORES] = $stores;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 17
0
<?php

/**
 * web service
 * get categories
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("CATEGORY", "c");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    include "Opr.php";
    $opr = new Opr();
    $categories = $opr->get_promotion_categories();
    if ($categories === false) {
        $response[STATUS] = 3;
    } else {
        $response[STATUS] = 7;
        $response[CATEGORY] = $categories;
    }
} else {
    $response[STATUS] = 0;
}
echo json_encode($response);
Ejemplo n.º 18
0
 function __construct()
 {
     include 'DB.php';
     self::$db = new DB();
 }
Ejemplo n.º 19
0
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("ITEM", "i");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['item_id']) && isset($_POST['info_id'])) {
        $item_id = $_POST['item_id'];
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $item_id) && preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $item = $opr->get_item($item_id, $info_id);
            if ($check === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[ITEM] = $item;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 20
0
 * web service
 * sign up
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
$response = array();
if (isset($_POST['email']) && isset($_POST['pass'])) {
    $email = $_POST['email'];
    $password = $_POST['pass'];
    if (filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match("/[a-zA-Z0-9]{5,20}/", $password)) {
        include "Opr.php";
        $opr = new Opr();
        $id = $opr->add_client($email, $password);
        if ($id === false) {
            $response[STATUS] = 3;
        } else {
            session_start();
            $_SESSION['id'] = $id;
            $response[STATUS] = 7;
        }
    } else {
        $response[STATUS] = 2;
    }
} else {
    $response[STATUS] = 1;
}
echo json_encode($response);
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("STORES", "t");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['promotion_id'])) {
        $promotion_id = $_POST['promotion_id'];
        if (preg_match("/[0-9]+/", $promotion_id)) {
            include "Opr.php";
            $opr = new Opr();
            $stores = $opr->get_promotion_related_stores($promotion_id);
            if ($stores === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[STORES] = $stores;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 22
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    21/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("PROMOTIONS", "p");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['info_id'])) {
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $promotions = $opr->get_promotions($info_id);
            if ($promotions === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[PROMOTIONS] = $promotions;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 23
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    21/08/2015
 * @edited     21/08/2015
 */
define("STATUS", "s");
define("VENDOR", "v");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['vendor_id'])) {
        $vendor_id = $_POST['vendor_id'];
        if (preg_match("/[0-9]+/", $vendor_id)) {
            include "Opr.php";
            $opr = new Opr();
            $vendor = $opr->get_vendor($vendor_id);
            if ($vendor === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[STORE] = $vendor;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     21/08/2015
 */
define("STATUS", "s");
define("ITEMS", "i");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['store_id'])) {
        $store_id = $_POST['store_id'];
        if (preg_match("/[0-9]+/", $store_id)) {
            include "Opr.php";
            $opr = new Opr();
            $items = $opr->get_store_related_items($store_id);
            if ($items === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[ITEMS] = $items;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 25
0
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['item_id']) && isset($_POST['info_id'])) {
        $item_id = $_POST['item_id'];
        $info_id = $_POST['info_id'];
        $name = $_POST['name'];
        if (preg_match("[0-9]+", $item_id) && preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $check = $opr->remove_item_watch_list($_SESSION['id'], $item_id, $info_id);
            if ($check === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
}
Ejemplo n.º 26
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("STORE", "r");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['store_id'])) {
        $store_id = $_POST['store_id'];
        if (preg_match("/[0-9]+/", $store_id)) {
            include "Opr.php";
            $opr = new Opr();
            $store = $opr->get_store($store_id);
            if ($store === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[STORE] = $store;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
Ejemplo n.º 27
0
<?php

/**
 * web service
 * get stores
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("STORES", "r");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    include "Opr.php";
    $opr = new Opr();
    $stores = $opr->get_stores();
    if ($stores === false) {
        $response[STATUS] = 3;
    } else {
        $response[STATUS] = 7;
        $response[STORES] = $stores;
    }
} else {
    $response[STATUS] = 0;
}
echo json_encode($response);
Ejemplo n.º 28
0
 *
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    28/08/2015
 * @edited     30/08/2015
 */
define("STATUS", "s");
define("RESULT", "r");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['input'])) {
        $input = $_POST['input'];
        if (preg_match("/[0-9a-zA-Z\\s]+/", $input)) {
            include "Opr.php";
            $opr = new Opr();
            $result = $opr->smart_search($input);
            if ($items === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[RESULT] = $result;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;
 * @copyright  Abanoub Milad Nassief
 * @license
 * @created    09/08/2015
 * @edited     23/08/2015
 */
define("STATUS", "s");
define("PROMOTION", "p");
$response = array();
session_start();
if (isset($_SESSION['id'])) {
    if (isset($_POST['item_id']) && isset($_POST['info_id'])) {
        $item_id = $_POST['item_id'];
        $info_id = $_POST['info_id'];
        if (preg_match("/[0-9]+/", $item_id) && preg_match("/[0-9]+/", $info_id)) {
            include "Opr.php";
            $opr = new Opr();
            $promotion = $opr->get_item_related_promotions($item_id, $info_id);
            if ($promotion === false) {
                $response[STATUS] = 3;
            } else {
                $response[STATUS] = 7;
                $response[PROMOTION] = $promotion;
            }
        } else {
            $response[STATUS] = 2;
        }
    } else {
        $response[STATUS] = 1;
    }
} else {
    $response[STATUS] = 0;