/*
*********************************************************************************
* システム:katsuyo.net *
*===============================================================================*
* クラス:okazu_regist |モジュール:okazu_regist.php *
* 概要 :新・今日の晩ごはん 晩ごはんお好み設定確定画面 *
* パス :APP_HOME/okazu/ *
* 作成 :2006/07/14 J.Nikaido *
*-------------------------------------------------------------------------------*
* 更新 : *
*********************************************************************************
*/
require_once('../prepare.php');
require_once('lib/okazu_function.php');
//会員情報取得
$db = u4user_open();
if(!get_UserDetail_uid($db, $p['uid'], '0', '1') && MEMBER_CHECK){
//非会員の場合は登録画面へ移動
header("Location: " . MEMBER_REGIST_URL . "?p[contents]=" . substr(strrchr(dirname( __FILE__ ) , '/'), 1));
exit;
}
u4user_close($db);
function okazu_regist( $p ){
//設定項目取得
$terms_arr = get_Terms();
//ユーザ設定情報配列作成
foreach($terms_arr as $tmp_key => $tmp_val){
foreach($terms_arr[$tmp_key] as $key => $val){
if(1 == $p[$key]){
$up_data[$key] = '1';
}else{
$up_data[$key] = '0';
}
}
}
$user_data = get_MyRecipeUser($p);
$ct = count($user_data);
$db = cs4_open();
//ユーザ情報作成・更新
if($ct > 0){
$ret = cs4_update($db,"kty_okazu_users",$up_data,$user_data[0]['uniq_id']);
if(!$ret){print "update failed !!
";}
}else{
$up_data['user_id'] = $p['uid'];
$up_data['dlt_flg'] = '0';
$ret = cs4_insert($db,"kty_okazu_users",$up_data);
if(!$ret){
print "Insert failed !!
";
exit;
}
}
cs4_close($db);
// テンプレート読み込み
$template =& loadTemplate( $p );
$template->show();
}
okazu_regist( $p );
?>