get_meigen

//
// get_meigen by KMF (2015.Sep.02)
//
function get_meigen() {
  $srv = 'xxx.xxx.xxx';
  $id  = 'xxx';
  $pwd = 'xxx';
  $dbn = 'xxx';
  $link = mysqli_connect($srv, $id, $pwd, $dbn);
  mysqli_set_charset($link, 'utf8') or die('Charset failed');
  if (mysqli_connect_errno()) {
    die('Connect failed: ' . mysqli_connect_error());
  }
  $sql = 'SELECT `meigen`,`namae` FROM `meigen2` ORDER BY RAND() LIMIT 1';
  $rs = mysqli_query($link, $sql) or die('Query failed [' $sql . ']';
  $ret = mysqli_fetch_array($rs, MYSQLI_ASSOC);
  mysqli_free_result($rs);
  mysqli_close($db);
  return $ret_list;
}

GetList

//=============================================================================================
// 
//=============================================================================================
function GetList($grp = '') {
    $srv = 'xxx.xxx.xxx';
    $id  = 'xxx';
    $pwd = 'xxx';
    $dbn = 'xxx';
    $link = mysqli_connect($srv, $id, $pwd, $dbn);
    if (mysqli_connect_errno()) {
        die('Connect failed: ' . mysqli_connect_error());
    }
    if ($grp == '') {
        $sql = 'SELECT `id`,`name`,`exp` FROM `Links` ORDER BY `cnt` DESC';
    } else {
        $sql = 'SELECT `id`,`name`,`exp` FROM `Links` WHERE `grp` = "' . $grp . '" ORDER BY `cnt` DESC';
    }
    if ($rs = mysqli_query($link, $sql)) {
        $ret_list = array();
        while ($row = mysqli_fetch_array($rs, MYSQLI_ASSOC)) {
      	    $ret_list[] = array('id'=>$row['id'], 'name'=>$row['name'], 'exp'=>$row['exp']);
        }
     	mysqli_free_result($rs);
    }
    mysqli_close($db);
    return $ret_list;
}

NokoriDay

/*
 * EchoNokoriDay
 *
 * by kfj (2012.Jan.04 12:31)
 */
function NokoriDays($pDate2) {
    $pDate1 = gmdate('Y-m-d', time() + 60 * 60 * 9);
    // $pDate2 = '2028-05-25';

    $TimeStamp1 = strtotime($pDate1);
    $TimeStamp2 = strtotime($pDate2);

    $SecondDiff = $TimeStamp2 - $TimeStamp1;
    $DayDiff = $SecondDiff / (60 * 60 * 24);

    return $DayDiff;
}