prepare($sql); if ($sth_1) { $rsl_1 = $sth_1->execute($prm); if(!PEAR::isError($rsl_1)){ return $rsl_1; } } return false; } /* public static function ActionController($member_uid){ // DL経験有 $evis_official = new bl_official_member(); $official_member = $evis_official->getMemberidByUid($member_uid); if(!empty($official_member)){ //正式メンバー unset($evis_official); header("Location: ".URL_TOP."repeater.php?guid=on"); exit(); }else{ // 非正式メンバー if($self->ChkDonwloadHistory($member_uid)){ // β版ユーザ unset($evis_official); header("Location: ".URL_TOP."mm_regist.php?guid=on"); exit(); }else{ } } } */ /** * 年齢 * * @retval array 値 => 表示文言 */ public static function get_age_options(){ return array( 1 => '0才〜3才', 2 => '4才〜10才', 3 => '11才〜20才', 4 => '21才〜30才', 5 => '31才〜40才', 6 => '41才〜50才', 7 => '51才〜60才', 8 => '61才〜70才', 9 => '71才〜'); } /** * 性別 * * @retval array 値 => 表示文言 */ public static function get_sex_options(){ return array( 1 => 'どちらとも言えない', 2 => '男性', 3 => '女性' ); } /** * 地域 * * @retval array 値 => 表示文言 */ public static function get_city_options(){ return array(1 => '国際宇宙ステーション', '北海道', '青森県', '岩手県', '宮城県', '秋田県', '山形県', '福島県', '茨城県', '栃木県', '群馬県', '埼玉県', '千葉県', '東京都', '神奈川県','新潟県', '富山県', '石川県', '福井県', '山梨県', '長野県', '岐阜県', '静岡県', '愛知県', '三重県', '滋賀県', '京都府', '大阪府', '兵庫県', '奈良県', '和歌山県', '鳥取県', '島根県', '岡山県', '広島県', '山口県', '徳島県', '香川県', '愛媛県', '高知県', '福岡県', '佐賀県', '長崎県', '熊本県', '大分県', '宮崎県', '鹿児島県','沖縄県'); } /** * 年齢が正しいかチェックします * 同時に、 trim をかけて正規化します。 * * チェック内容 * 1. 入力されているか * 2. 正当な値か * * @param $value 入力された性別 * @param $display エラー表示文言 '年齢'(デフォルト) * @retval string エラー文言 */ public static function validate_age(&$value, $display = '年齢'){ // 正規化 $value = trim($value); // 1. 入力されているか // 2. 正当な値か $age_options = self::get_age_options(); if(!isset($age_options[$value])){ return "※{$display}を選択して下さい
"; } return ''; } /** * 性別が正しいかチェックします * 同時に、 trim をかけて正規化します。 * * チェック内容 * 1. 入力されているか * 2. 正当な値か * * @param $value 入力された性別 * @param $display エラー表示文言 '性別'(デフォルト) * @retval string エラー文言 */ public static function validate_sex(&$value, $display = '性別'){ // 正規化 $value = trim($value); // 1. 入力されているか // 2. 正当な値か $sex_options = self::get_sex_options(); if(!isset($sex_options[$value])){ return "※{$display}を選択して下さい
"; } return ''; } /** * 地域が正しいかチェックします * 同時に、 trim をかけて正規化します。 * * チェック内容 * 1. 入力されているか * 2. 正当な値か * * @param $value 入力された性別 * @param $display エラー表示文言 '地域'(デフォルト) * @retval string エラー文言 */ public static function validate_city(&$value, $display = '地域'){ // 正規化 $value = trim($value); // 1. 入力されているか // 2. 正当な値か $age_options = self::get_city_options(); if(!isset($age_options[$value])){ return "※{$display}を選択して下さい
"; } return ''; } /** * ご意見・ご要望が正しいかチェックします * 同時に、 trim をかけて正規化します。 * * チェック内容 * 1. 入力されているか * 2. 正当な値か * * @param $value 入力された性別 * @param $display エラー表示文言 'ご意見'(デフォルト) * @retval string エラー文言 */ public static function validate_opinion(&$value, $display = 'ご意見'){ $value = trim($value); if(strlen($value) == 0) $errors .= "※入力が空です
"; if(strlen($value) > 1000) $errors .= "※全角500文字以内でお願いします
"; if(is_emoji($value)) $errors .= "※絵文字は使用できません
"; if(count($errors) > 0){ return $errors; } return false; } function checkDownloadCount(){ $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) AS cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " del_flag = 0 AND"; $sql_1 .= " dl_count > 0"; if(!$rsl_1 = $this->prepareExecute($sql_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute(); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($row); $releasedate = mktime(06, 0, 0, 11, 11, 2008); $now = time(); // if($releasedate <= $now){ $download_cnt = 8500; // }else{ // $download_cnt = 1000; // } // $remainder_cnt = 2000 - (int)$rows; $remainder_cnt = $download_cnt - (int)$rows; return $remainder_cnt; } function ChkDelUserRecord($member_uid){ // count $rows = ""; $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) as cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " del_flag = 1"; $prm_1[] = $member_uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); if($rows <= 0){ return false; } return true; } /** * アンケートを登録 */ function set_member($member_uid, $data){ // if($this->update_member($member_uid, $data)){ // return true; // } $member_id = ''; $this->beginTransaction(); // count $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " LPAD(COUNT(*)+1, 9, '0') as lpad"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; if(!$rsl_1 = $this->prepareExecute($sql_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute(); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $member_id = $array_tmp['lpad']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($row); $dl_count = 0; if($this->ChkDelUserRecord($member_uid)){ //退会履歴有 $dl_count = 1; } // insert $prm_1 = array(); $sql_1 = ""; $sql_1 .= " INSERT INTO t_member("; $sql_1 .= " member_id"; $sql_1 .= " ,member_uid"; $sql_1 .= " ,age"; $sql_1 .= " ,sex"; $sql_1 .= " ,city"; $sql_1 .= " ,dl_count"; $sql_1 .= " ,ins_date"; $sql_1 .= " ,upd_date"; $sql_1 .= " ,del_date"; $sql_1 .= " ,del_flag"; $sql_1 .= " ,last_acc_date"; $sql_1 .= " ,qvga_flag"; $sql_1 .= " )VALUES("; $sql_1 .= " '".$member_id."'"; $sql_1 .= " ,?"; $sql_1 .= " ,?"; $sql_1 .= " ,?"; $sql_1 .= " ,?"; $sql_1 .= " ,?"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NULL"; $sql_1 .= " ,0"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,?"; $sql_1 .= " )"; $prm_1[] = $member_uid; $prm_1[] = $data['age_options']; $prm_1[] = $data['sex_options']; $prm_1[] = $data['city_options']; $prm_1[] = $dl_count; $prm_1[] = $data['qvga_flag']; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } function update_member($member_uid, $data){ $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) AS cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " del_flag = 0"; $prm_1[] = $member_uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($row); unset($prm_1); if($rows <= 0){ return false; } $this->beginTransaction(); $sql_2 = ""; $sql_2 .= " UPDATE t_member SET"; $sql_2 .= " member_uid = ?"; $sql_2 .= " ,age = ?"; $sql_2 .= " ,sex = ?"; $sql_2 .= " ,city = ?"; $sql_2 .= " ,upd_date = NOW()"; $sql_2 .= " ,last_acc_date = NOW()"; $sql_2 .= " WHERE"; $sql_2 .= " member_uid = ? AND"; $sql_2 .= " del_flag = 0"; $prm_2[] = $member_uid; $prm_2[] = $data['age_options']; $prm_2[] = $data['sex_options']; $prm_2[] = $data['city_options']; $sth_2 = $this->prepare($sql_2); $rsl_2 = $sth_2->execute($prm_2); if (PEAR::isError($rsl_2)) { $this->rollback(); unset($rsl_2); unset($sth_2); unset($prm_1); unset($sql_2); return false; } $this->commit(); return true; } function UpdateDownloadCount($member_uid, $qvga_flg){ $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " dl_count"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " del_flag = 0"; $prm_1[] = $member_uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['dl_count']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($row); unset($prm_1); $cnt = $rows+1; $this->beginTransaction(); $sql_2 = ""; $sql_2 .= " UPDATE t_member SET"; $sql_2 .= " dl_count = $cnt"; $sql_2 .= " ,upd_date = SYSDATE()"; $sql_2 .= " ,qvga_flag = ?"; $sql_2 .= " WHERE"; $sql_2 .= " member_uid = ? AND"; $sql_2 .= " del_flag != 1"; $prm_2[] = $qvga_flg; $prm_2[] = $member_uid; $sth_2 = $this->prepare($sql_2); $rsl_2 = $sth_2->execute($prm_2); if (PEAR::isError($rsl_2)) { $this->rollback(); unset($rsl_2); unset($sth_2); unset($prm_2); unset($sql_2); return false; } $this->commit(); return true; } function ChkQuestionnaireRecord($member_uid){ // count $rows = ""; $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) as cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " del_flag = 0"; $prm_1[] = $member_uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); if($rows <= 0){ return false; } return true; } function ChkDonwloadHistory($member_uid){ // count $rows = ""; $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) as cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " del_flag = 0 AND"; $sql_1 .= " dl_count > 0"; $prm_1[] = $member_uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); if($rows <= 0){ return false; } return true; } /** * ご意見・ご要望を登録 */ function set_opinion($member_uid, $opinion){ $opinion_id = ''; $this->beginTransaction(); // count $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " LPAD(COUNT(*)+1, 9, '0') as lpad"; $sql_1 .= " FROM"; $sql_1 .= " t_opinion"; if(!$rsl_1 = $this->prepareExecute($sql_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute(); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $opinion_id = $array_tmp['lpad']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($row); // insert $prm_1 = array(); $sql_1 = ""; $sql_1 .= " INSERT INTO t_opinion("; $sql_1 .= " opinion_id"; $sql_1 .= " ,member_uid"; $sql_1 .= " ,opinion"; $sql_1 .= " ,ins_date"; $sql_1 .= " ,upd_date"; $sql_1 .= " ,del_date"; $sql_1 .= " ,del_flag"; $sql_1 .= " )VALUES("; $sql_1 .= " '".$opinion_id."'"; $sql_1 .= " ,?"; $sql_1 .= " ,?"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,0"; $sql_1 .= " )"; $prm_1[] = $member_uid; $prm_1[] = $opinion; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } function OverDownloadCount(){ $dl_cnt = $this->checkDownloadCount(); if($dl_cnt <= 0){ header("Location: ".URL_TOP."close.php?guid=on"); exit(); } } function set_pageview($member_uid, $page){ $pv_id = ''; $this->beginTransaction(); // count $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " LPAD(COUNT(*)+1, 9, '0') as lpad"; $sql_1 .= " FROM"; $sql_1 .= " t_pageview"; if(!$rsl_1 = $this->prepareExecute($sql_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute(); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $pv_id = $array_tmp['lpad']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($row); // insert $prm_1 = array(); $sql_1 = ""; $sql_1 .= " INSERT INTO t_pageview("; $sql_1 .= " pv_id"; $sql_1 .= " ,member_uid"; $sql_1 .= " ,page"; $sql_1 .= " ,ins_date"; $sql_1 .= " ,upd_date"; $sql_1 .= " ,del_date"; $sql_1 .= " ,del_flag"; $sql_1 .= " )VALUES("; $sql_1 .= " '".$pv_id."'"; $sql_1 .= " ,?"; $sql_1 .= " ,?"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,0"; $sql_1 .= " )"; $prm_1[] = $member_uid; $prm_1[] = $page; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } } ?> prepare($sql); if ($sth_1) { $rsl_1 = $sth_1->execute($prm); if(!PEAR::isError($rsl_1)){ return $rsl_1; } } return false; } function getMemberidByUid($uid){ $array_return = array(); $prm_1 = array(); $sql_1 = ''; $sql_1 .= " SELECT"; $sql_1 .= " member_id"; $sql_1 .= " FROM"; $sql_1 .= " t_official_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " status_flag = 1"; $prm_1[] = $uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $array_return = $array_tmp['member_id']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return $array_return; } function getMemberEmailByMemberId($member_id){ $array_return = array(); $prm_1 = array(); $sql_1 = ''; $sql_1 .= " SELECT"; $sql_1 .= " member_email"; $sql_1 .= " FROM"; $sql_1 .= " t_official_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_id = ? AND"; $sql_1 .= " status_flag = 3"; $prm_1[] = $member_id; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $array_return = $array_tmp['member_email']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return $array_return; } function chkMemberByEmail($member_email){ $prm_1 = array(); $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " status_flag"; $sql_1 .= " FROM"; $sql_1 .= " t_official_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_email = ?"; $prm_1[] = $member_email; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $status_flag = $array_tmp['status_flag']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); return $status_flag; } function checkMemberId($member_id){ $sql_1 = ""; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) AS cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_official_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_id = ?"; $prm_1[] = $member_id; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); if($rows <= 0){ return false; } return true; } function setMember($data){ $this->beginTransaction(); // update $prm_1 = array(); $sql_1 = ""; $sql_1 .= " UPDATE"; $sql_1 .= " t_official_member"; $sql_1 .= " SET"; $sql_1 .= " member_uid = ?"; $sql_1 .= " ,user_agent = ?"; $sql_1 .= " ,upd_date = NOW()"; $sql_1 .= " ,status_flag = 1"; $sql_1 .= " WHERE"; $sql_1 .= " member_id = ?"; $prm_1[] = $data['member_uid']; $prm_1[] = $data['ua']; $prm_1[] = $data['member_id']; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } function delMember($data){ $this->beginTransaction(); // update $prm_1 = array(); $sql_1 = ""; $sql_1 .= " UPDATE"; $sql_1 .= " t_official_member"; $sql_1 .= " SET"; $sql_1 .= " member_uid = ?"; $sql_1 .= " ,member_email = NULL"; $sql_1 .= " ,user_agent = ?"; // $sql_1 .= " ,upd_date = NOW()"; $sql_1 .= " ,del_date = NOW()"; $sql_1 .= " ,status_flag = 2"; $sql_1 .= " WHERE"; $sql_1 .= " member_id = ?"; $prm_1[] = $data['member_uid']; $prm_1[] = $data['ua']; $prm_1[] = $data['member_id']; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } function delOfficialMember($member_uid){ $this->beginTransaction(); $prm_1 = array(); $sql_1 = ""; $sql_1 .= " UPDATE"; $sql_1 .= " t_official_member"; $sql_1 .= " SET"; $sql_1 .= " member_email = NULL"; $sql_1 .= " ,del_date = NOW()"; $sql_1 .= " ,status_flag = 2"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " status_flag = 1"; $prm_1[] = $member_uid; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $prm_2 = array(); $sql_2 = ""; $sql_2 .= " UPDATE"; $sql_2 .= " t_member"; $sql_2 .= " SET"; $sql_2 .= " del_date = NOW()"; $sql_2 .= " ,del_flag = 1"; $sql_2 .= " WHERE"; $sql_2 .= " member_uid = ? AND"; $sql_2 .= " del_flag = 0"; $prm_2[] = $member_uid; $sth_2 = $this->prepare($sql_2); $rsl_2 = $sth_2->execute($prm_2); if (PEAR::isError($rsl_2)) { $this->rollback(); unset($rsl_2); unset($sth_2); unset($prm_2); unset($sql_2); return false; } $this->commit(); return true; } function setTmpMember($data){ $this->beginTransaction(); $prm_1 = array(); $sql_1 = ""; $sql_1 .= " INSERT INTO t_official_member("; $sql_1 .= " member_id"; $sql_1 .= " ,member_email"; $sql_1 .= " ,ins_date"; $sql_1 .= " ,upd_date"; $sql_1 .= " ,status_flag"; $sql_1 .= " )VALUES("; $sql_1 .= " ?"; $sql_1 .= " ,?"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,NOW()"; $sql_1 .= " ,3"; $sql_1 .= " )"; $prm_1[] = $data['member_id']; $prm_1[] = $data['member_email']; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } function updateTmpMember($data){ $this->beginTransaction(); // update $prm_1 = array(); $sql_1 = ""; $sql_1 .= " UPDATE"; $sql_1 .= " t_official_member"; $sql_1 .= " SET"; $sql_1 .= " member_id = ?"; $sql_1 .= " ,upd_date = NOW()"; $sql_1 .= " ,status_flag = 3"; $sql_1 .= " ,del_date = DATE_FORMAT('0000-00-00 00:00:00', '%Y-%m-%d %H:%i:%s')"; $sql_1 .= " WHERE"; $sql_1 .= " member_email = ?"; $prm_1[] = $data['member_id']; $prm_1[] = $data['member_email']; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } function chkBetaMember($member_uid){ $array_return = array(); $prm_1 = array(); $sql_1 = ''; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) AS cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ? AND"; $sql_1 .= " ins_date < DATE_FORMAT('".OFFICIAL_RELEASE_DATE."', '%Y-%m-%d %H:%i') AND"; $sql_1 .= " del_flag = 0"; $sql_1 .= " ORDER BY upd_date DESC"; $prm_1[] = $member_uid; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $rows = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); if($rows <= 0){ return false; } return true; } function changeMemberByEmail($member_id, $member_email){ $sql_1 = ''; $sql_1 .= " SELECT"; $sql_1 .= " COUNT(member_id) AS cnt"; $sql_1 .= " FROM"; $sql_1 .= " t_official_member"; $sql_1 .= " WHERE"; $sql_1 .= " member_id = ? AND"; $sql_1 .= " status_flag = 1"; $prm_1[] = $member_id; if(!$rsl_1 = $this->prepareExecute($sql_1,$prm_1)){ return false; } /* $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); */ while ($row = $rsl_1->fetchRow(MDB2_FETCHMODE_ASSOC)) { $array_tmp = array(); foreach ($row as $index => $value) { $array_tmp[strtolower($index)] = $value; } $cnt = $array_tmp['cnt']; unset($array_tmp); } unset($rsl_1); unset($sth_1); unset($sql_1); unset($prm_1); unset($row); if($cnt <= 0){ return false; } $this->beginTransaction(); // update $prm_2 = array(); $sql_2 = ""; $sql_2 .= " UPDATE"; $sql_2 .= " t_official_member"; $sql_2 .= " SET"; $sql_2 .= " member_email = ?"; $sql_2 .= " ,upd_date = NOW()"; $sql_2 .= " WHERE"; $sql_2 .= " member_id = ? AND"; $sql_2 .= " status_flag = 1"; $prm_2[] = $member_email; $prm_2[] = $member_id; $sth_2 = $this->prepare($sql_2); $rsl_2 = $sth_2->execute($prm_2); if (PEAR::isError($rsl_2)) { $this->rollback(); unset($rsl_2); unset($sth_2); unset($prm_2); unset($sql_2); return false; } $this->commit(); return true; } function Cleaning($member_uid){ $this->beginTransaction(); // update $prm_1 = array(); $sql_1 = ""; $sql_1 .= " UPDATE"; $sql_1 .= " t_official_member"; $sql_1 .= " SET"; $sql_1 .= " status_flag = 3"; $sql_1 .= " ,upd_date = NOW()"; $sql_1 .= " WHERE"; $sql_1 .= " member_uid = ?"; $prm_1[] = $member_uid; $sth_1 = $this->prepare($sql_1); $rsl_1 = $sth_1->execute($prm_1); if (PEAR::isError($rsl_1)) { $this->rollback(); unset($rsl_1); unset($sth_1); unset($prm_1); unset($sql_1); return false; } $this->commit(); return true; } } class UniqueIdCreateLite{ /** php4 メンバ変数 */ // var $uid; /** php5 メンバ変数 */ private $uid; function UniqueIdCreateLite(){ $this->uid = ""; } // ae547f486ec9612c9b5aa1027f2a22ce 32桁 function getUniqueId( $figure = 0 ){ $this->uid = md5(uniqid(rand(),1)); if($figure > 0 && $figure < 33){ $this->uid = str_pad( $this->uid, $figure ); } return $this->uid; } } ?>