<?php

include_once './_common.php';
//registration ID 를 저장한다.
if ($member['mb_id'] && $_GET['regID']) {
    $_GET['regID'] = mysql_real_escape_string($_GET['regID']);
    $sql = "select count(*) as cnt from registration_id where ri_id = '{$_GET['regID']}'";
    $cnt = sql_fetch($sql);

    if ($cnt['cnt'] > 0) {
        //update
        $sql = "update registration_id set ri_ip = '{$_SERVER['REMOTE_ADDR']}', ri_id = '{$_GET['regID']}' where ri_mb_id = '{$member['mb_id']}'";
        sql_query($sql);
    } elseif ($cnt['cnt'] == 0) {
        //insert
        $sql = "insert into registration_id set ri_ip = '{$_SERVER['REMOTE_ADDR']}', ri_mb_id = '{$member['mb_id']}', ri_id = '{$_GET['regID']}'";
        sql_query($sql);
    }    
}