Пример #1
0
#!/usr/bin/php
<?php 
if (!isset($argc)) {
    exit;
}
include "product_table_handle.php";
$user['id'] = "admin";
$user['right'] = "admin";
$table_user['admin'] = $user;
if (!file_exists("private")) {
    mkdir('private', 0777);
}
serialize_put_content('private/user', $table_user);
$data[] = array('login' => "admin", 'passwd' => hash("whirlpool", "admin"));
serialize_put_content('private/passwd', $data);
category_add_entry("All Products");
category_add_entry("Red-Rabbit");
category_add_entry("Bedeux");
category_add_entry("Blackkross");
category_add_entry("Bustin");
category_add_entry("Kryptonics");
category_add_entry("Venture");
category_add_entry("Board");
category_add_entry("Weels");
category_add_entry("Truck");
product_add_entry("Bedeux deck 00", array("All Products", "Bedeux", "Board"), "img/deck/Bedeux_deck00.jpg", "149.99");
product_add_entry("Bedeux deck 01", array("All Products", "Bedeux", "Board"), "img/deck/Bedeux_deck01.jpg", "99.99");
product_add_entry("Bedeux deck 02", array("All Products", "Bedeux", "Board"), "img/deck/Bedeux_deck02.jpg", "129.99");
product_add_entry("Blackkross deck 00", array("All Products", "Blackkross", "Board"), "img/deck/Blackkross_deck00.jpg", "169.99");
product_add_entry("Blackkross deck 01", array("All Products", "Blackkross", "Board"), "img/deck/Blackkross_deck01.jpg", "129.99");
product_add_entry("Blackkross deck 02", array("All Products", "Blackkross", "Board"), "img/deck/Blackkross_deck02.jpg", "99.99");
Пример #2
0
}
include "product_table_handle.php";
$_SESSION['cre_error'] = 0;
if ($_POST['login'] === "" or $_POST['passwd'] === "" or $_POST['submit'] !== "OK") {
    header("Location: index.php");
    exit;
} else {
    if (!file_exists("private")) {
        mkdir("private", 0777);
    } else {
        if (file_exists("private/passwd")) {
            $data = unserialize(file_get_contents("private/passwd"));
        }
    }
    if ($data !== NULL and is_exists($_POST['login'], $data) === TRUE) {
        $_SESSION['cre_error'] = 1;
        header("Location: index.php");
        exit;
    }
    $data[] = array('login' => $_POST['login'], 'passwd' => hash("whirlpool", $_POST['passwd']));
    $serial = serialize($data);
    file_put_contents("private/passwd", $serial);
    if (file_exists("private/user")) {
        $table_user = unserialize_get_content("private/user");
    }
    $user['id'] = $_POST['login'];
    $user['right'] = "no-right";
    $table_user[$_POST['login']] = $user;
    serialize_put_content("private/user", $table_user);
    header("Location: index.php");
}
Пример #3
0
function category_id_modif($old_id, $new_id)
{
    if (!file_exists("resources/category") or !file_exists("resources/join")) {
        return FALSE;
    }
    $table_category = unserialize_get_content("resources/category");
    if ($table_category[$old_id]['exist'] !== 1 or $table_category[$new_id]['exist'] === 1) {
        return FALSE;
    }
    $table_category[$new_id] = $table_category[$old_id];
    $table_category[$new_id]['id'] = $new_id;
    unset($table_category[$old_id]);
    $table_join = unserialize_get_content("resources/join");
    $tmp = $table_join;
    foreach ($tmp as $key => $join) {
        if (preg_match("/^" . $old_id . "<:>(.*)\$/", $key, $match) === 1) {
            $table_join[$new_id . "<:>" . $match[1]] = $table_join[$key];
            unset($table_join[$key]);
        }
    }
    serialize_put_content("resources/category", $table_category);
    serialize_put_content("resources/join", $table_join);
}