[]
    wb_
        1.SNbNTOPy[Wֈړ
        2. A\
            2.1 OCĂ΁u悤v\
                OAEgy[Wւ̃N\
            2.2 OCĂȂ΁uKonozamaVbsOTCgւ悤v\
                OCy[Wւ̃N\
           
        3. J[gACRNbNŃJ[ge\y[Wֈړ
        4. ACRNbNŔ\y[Wֈړ

    TCho[
        JeS[Xg\

    JeS[Xg
        JeS[̃Xg\
        JeS[NbNŃJeS[iꗗy[Wֈړ
        JeS[w肵Ƃ(JeS[iꗗy[WȂ)͎wJeS[nCCg\

    J[gf[^
        f[^ɂB
        ߂ăJ[gf[^ɃANZXɐB


        
[TOPy[W]
    ߏiȂǂ\

[JeS[iꗗy[W]
    JeS[ɑ鏤ĩXg\
    \鏤ie
    	i
    	i
    	Tv
		ỉ摜
		
    J[gɓ{^NbN [J[gǉ]ăJ[g̓e\ֈړ

[J[gǉ]
    ݎgp̃J[gf[^擾
        ܂J[gf[^΍B
    IiID珤iB
    J[gɖׂǉBׂ̓e͈ȉ
        i      Iȉi
        P        Ii̒P
                ʓ͂
        z        Ii̒P * ʓ͂
        
    
    



[J[g̓e\y[W]
    ݂̃J[ge\

    Z{^NbN Zy[WɈړ
    
[Zy[W]
    ݂̃J[ge\
    ZɕKvȍڂ͂B
    Z{^NbN ZsĐZIbZ[W\


[J[ge\]    
    J[gׂSĕ\
        i
        P
        
        z
        
    J[gׂ̋zvčvsɕ\


[Z]
    J[ge璍f[^쐬f[^ۑB
    ۑe
        f[^:
            ID                  ۑςݒf[^ID̍ől+1 ŏ1"1"
            customer_id         OC[U[ID
            order_date          ݂̓t
            payment_method      ͒l
            delivery_place      ͒l
        f[^
            id                  ۑςݒf[^ׂID̍ől+1 ŏ1"1"
            order_id            f[^ID
            product_id          J[g̏iID
            unit_price          J[g̒P
            quantity            J[g̐
            price               J[g̋z
        
    

[f[^`]
    create table categories(
        id  int not null,
        name varchar(100),
        left_side int,
        right_side int,
        description varchar(500),
        constraint pk_categories primary key ( id )
    )
    go

    create table products(
        id  int not null,
        name varchar(100),
        unit_price decimal(10,0),
        description varchar(500),
        category_id int,
        constraint pk_products primary key ( id )
    )
    go

    create table orders(
        id int not null,
        customer_id int not null,
        order_date datetime not null,
        payment_method int, -- 1: J[h 2:  ,etc...
        delivery_place varchar(255),
        constraint pk_orders primary key ( id )
    )
    go

    create table order_items(
        id int not null,
        order_id int,
        product_id int,
        unit_price decimal(10,0),
        quantity  decimal(10,0),
        price decimal(10,0),
        constraint pk_order_items primary key ( id )
    )
    go



authData
    authKey
    loginid
    userdata{}
    expireDate

login
    hkey = create key
    savesession(user,hkey)
    savecookie(hkey)

getauth
    hkey = getgookie()
    user = getsession(hkey)
    if(user == null)
        user = getuser(hkey)
        
    ;
    return user;


if (authenticate($username, $password) && !empty($_POST['auto_login'])) {
    setup_auto_login();

}
if (empty($_POST['auto_login'])) {
    // OCp̃NbL[폜
    delete_cookie('auto_login');
    // ÂOCkey폜
    $sql = "delete from auto_login where key = '". sql_escape($_COOKIE['auto_login']). "';";
    sql_qeury($sql);
} 


function setup_auto_login() {

    // F؂AOCݒ
    $auto_login_key = sha1(uniqid().mt_rand(1,999999999)); // key𐶐


    $sql = "insert into auto_login (user_id, key, expire) values (" .

    "'". sql_escape($_SESSION['user_id']). "', '". esq_escape($auto_login_key)."', '". date('Y-m-d H:i:s', time()+3600*24*7) ."';";
    sql_query($sql);

    send_cookie('auto_login', $key, 3600*24*7); //L7̎OCNbL[𑗐M

}        
    
    

