sprintf("%d",$p['weight_int']) || 10 < sprintf("%d",$p['weight_flow']) ){ require_once('template/error.html'); exit; } $p['weight'] = sprintf("%d.%d",$p['weight_int'],$p['weight_flow']); //- 日付チェック if(empty($p['date'])){ require_once('template/error.html'); exit; } //- 身長チェック if(250 < sprintf("%d",$p['height_int']) || 50 > sprintf("%d",$p['height_int']) || 10 < sprintf("%d",$p['height_flow'])){ require_once('template/error.html'); exit; } $p['height'] = sprintf("%d.%d",$p['height_int'],$p['height_flow']); //- 年齢チェック if(is_null($p['age'])){ require_once('template/error.html'); exit; } //- 性別チェック if(is_null($p['sex'])){ require_once('template/error.html'); exit; } //- 運動量チェック if(empty($p['exercise'])){ require_once('template/error.html'); exit; } if(!$p['bmi'] = get_Bmi($p)){ print "身長・体重が未登録"; require_once('template/error.html'); exit; } if(NOTEBOOK_DEBUG_MODE){ print "
BMI => ".$p['bmi']; } if(!$necessary_calorie = get_NecessaryCalorie($p)){ print "体重が未登録"; require_once('template/error.html'); exit; } if(NOTEBOOK_DEBUG_MODE){ print "
NecessaryCal => ".$necessary_calorie; } $db = cs4_open(); $in_data = array( 'user_id' => $p['uid'], 'height' => $p['height'], 'weight' => $p['weight'], 'measure_ymd' => $p['date'], 'age_code' => $p['age'], 'exercise_code' => $p['exercise'], 'sex_code' => $p['sex'], 'bmi' => $p['bmi'], 'necessary_calorie' => $necessary_calorie, 'dlt_flg' => '0' ); //- 既存確認 // if($profile = get_UserProf($p , date("Ymd"))){ $profile = get_UserProf($p , $p['date']); if(NOTEBOOK_DEBUG_MODE){ print __FILE__; print "
in_data -> "; var_dump($in_data); print "
target profile -> "; var_dump($profile); } if($p['date'] == $profile[0]['measure_ymd']){ $uniq_id = cs4_update($db,"kty_notebook_user",$in_data,$profile[0]['uniq_id']); }else{ if(NOTEBOOK_DEBUG_MODE){ print "
count -> ".count($profile); } $uniq_id = cs4_insert($db,"kty_notebook_user",$in_data); } cs4_close($db); if($uniq_id){ switch($p['carrier']){ case "i": $add_param = "?uid=NULLGWDOCOMO"; break; case "v": $add_param = "?uid=1&sid=".V_SID; break; case "e": default: break; } //- 初回有料トップフォーム用制御 add by Aida 06/02/22 switch($p['ref']){ case "1": $url = sprintf("%s/notebook/nb_top.php%s",KTY_BASE_URL,$add_param); break; default: $url = sprintf("%s/notebook/nb_profile.php%s",KTY_BASE_URL,$add_param); break; } header("Location: ".$url); exit; }else{ require_once('template/error.html'); exit; } ?>