/*
*********************************************************************************
* システム:katsuyo.net *
*===============================================================================*
* クラス:diet_regist |モジュール:diet_regist.php *
* 概要 :ダイエット趣向レシピ ダイエットディナー登録用画面 *
* パス :APP_HOME/diet/ *
* 作成 :2006/07/07 J.Nikaido *
*-------------------------------------------------------------------------------*
* 更新 : *
*********************************************************************************
*/
require_once('../prepare.php');
//メンバーチェック
$db = u4user_open();
if(!get_UserDetail_uid($db, $p['uid'], '0', '1') ){
header("Location: ".MEMBER_REGIST_URL);
exit;
}
u4user_close($db);
//暫定的にuidをセット
//$p['uid']="01eGQiXHyPrO";
//print ($p['uid']);
/*
//会員登録確認
$db_member = u4user_open();
$user_prof = bsc_get_user_profile($db_member,$p['uid'],'0');
u4user_close($db_member);
if(!$user_prof){
$p['contents'] = "my";
$p['template'] = "user_regist.html";
header("Location: ".BSC_BASE_URL."signup/free_reg_top.php?uid=NULLGWDOCOMO&p[contents]=my");
exit;
}
*/
function diet_regist($p){
/*
print("set_id:" .$p['set_id']);
print("
");
print("set_name:" .$p['set_name']);
print("
");
print("day:" .$p['day']);
print("
");
print("flg:" .$p['flg']);
print("
");
*/
// テンプレート読み込み
$template =& loadTemplate($p);
$this->db = cs4_open();
// すでに登録がないかを確認
$where = "user_id=\"".$p['uid']."\" and set_id =\"".$p['set_id']."\"";
$num = cs4_num_rows($this->db,"kty_diet_set_users",$where);
//未登録の場合
if('0' == $num){
$data = array(
"user_id" => $p['uid'],
"set_id" => $p['set_id'],
);
//DBに格納
$ret_insert = cs4_insert($this->db,"kty_diet_set_users",$data);
//テンプレートの設定
if($ret_insert) {
$template->setCurrentBlock('__Regist__');
$template->setVariable('set_name',$p['set_name']);
$template->parseCurrentBlock();
}else{
$template->touchBlock('__ShowError2__');
$template->hideBlock('__Regist__');
}
}else{
$template->touchBlock('__ShowError__');
$template->hideBlock('__Regist__');
}
$template->setVariable('set_id',$p['set_id']);
$template->setVariable('day',$p['day']);
$template->setVariable('flg',$p['flg']);
$template->show();
cs4_close($this->db);
}
diet_regist($p);
?>