Beispiel #1
0
                $Sday = $days - $this->_SMDay[1];
            } else {
                $Smonth = 1;
                $Sday = $days;
            }
        } else {
            $Syear = $year;
            for ($i = 1; $i <= 12; $i++) {
                if ($days > $this->GetSMon($Syear, $i)) {
                    $days -= $this->GetSMon($Syear, $i);
                } else {
                    $Smonth = $i;
                    $Sday = $days;
                    break;
                }
            }
        }
        return mktime(0, 0, 0, $Smonth, $Sday, $Syear);
        //$Sdate = $Syear."-".$Smonth."-".$Sday;
        //return $Sdate;
    }
}
$today = date("Y-m-d");
$lunar = new Lunar();
//公历转农历
$nl = date("Y-m-d", $lunar->S2L($today));
//农历转公历
$gl = date("Y-m-d", $lunar->L2S($nl));
echo "今天公历是:{$today}<br/>";
echo "转为农历是:{$nl}<br/>";
echo "转回公历是:{$gl}<br/>";
Beispiel #2
0
    $sql = 'UPDATE ' . $GLOBALS['ecs']->table('users') . " SET eff_id={$effId} WHERE user_id={$userId}";
    if ($GLOBALS['db']->query($sql)) {
        $sql = 'SELECT eff_name FROM ' . $GLOBALS['ecs']->table('effects') . " WHERE eff_id={$effId}";
        echo $json->encode(array('code' => 1, 'msg' => $GLOBALS['db']->getOne($sql), 'ele' => $userId));
        exit;
    } else {
        echo $json->encode(array('code' => 0, 'msg' => '出错啦,请稍后再试'));
        exit;
    }
} elseif ($_REQUEST['act'] == 'calendar') {
    require '..\\includes\\cls_json.php';
    require 'includes\\lunar.php';
    $json = new JSON();
    $lunar = new Lunar();
    if ($_REQUEST['type'] == 2) {
        $nl = date("Y-m-d", $lunar->S2L($_REQUEST['birthday']));
        echo $temp = $json->encode(array('type' => '农历:', 'date' => $nl));
    } else {
        //$date = $lunar->convertLunarToSolar($date[0], $date[1], $date[2]);
        $gl = date("Y-m-d", $lunar->L2S($_REQUEST['birthday']));
        die($json->encode(array('type' => '公历:', 'date' => $gl)));
    }
} elseif ($_REQUEST['act'] == 'find_referrer') {
    $keyword = intval($_REQUEST['keywords']);
    $sql = 'SELECT user_id,user_name FROM ' . $GLOBALS['ecs']->table('users') . " WHERE home_phone LIKE '%{$keyword}%' OR mobile_phone='{$keyword}'";
    if ($_SESSION['role_id'] > 0) {
        $sql .= " AND role_id={$_SESSION['role_id']} ";
    }
    $res = $GLOBALS['db']->getAll($sql);
    if (!$res) {
        $sql = 'SELECT u.user_id,user_name FROM ' . $GLOBALS['ecs']->table('users') . ' u LEFT JOIN ' . $GLOBALS['ecs']->table('user_contact') . ' c ON u.user_id=c.user_id ' . " WHERE contact_value LIKE '%{$keyword}%'";
Beispiel #3
0
 if ($c_log) {
     $s_dbg = sprintf('select id from %s where tid=%s and readed=1', $dbprefix . 'message', $_SESSION[$config['u_hash']]);
     $q_dbg = mysql_query($s_dbg) or die('');
     $c_dbg = mysql_num_rows($q_dbg);
     mysql_free_result($q_dbg);
     $content .= ',' . $pn . ' <a href="?m=logout">退出</a><ol><li><a href="?m=message">短消息</a>' . ($c_dbg > 0 ? '(<span class="message_n">' . $c_dbg . '</span>)' : '') . '</li><li><a href="?m=profile">个人资料</a></li>' . ($pa == 9 ? '<li><a href="?m=setting">班级设置</a></li>' : '') . '</ol>';
 } else {
     $content .= '<ol><li><a href="?m=login">登录留言</a></li></ol>';
 }
 $content .= '</li>';
 require_once 'lib/lunar.php';
 $lunar = new Lunar();
 for ($i = 0; $i < 5; $i++) {
     $ct = getftime(time() + 86400 * $i);
     $bdb[] = '(bir_m=' . date('n', $ct) . ' and bir_d=' . date('j', $ct) . ' and isnl=0)';
     $nl = $lunar->S2L($ct);
     $bdb[] = '(bir_m=' . $nl[0] . ' and bir_d=' . $nl[1] . ' and isnl=1)';
 }
 $nl_t = $lunar->S2L(getftime());
 $s_dbu = sprintf('select id, name, isnl, bir_m, bir_d from %s where %s', $dbprefix . 'member', join(' or ', $bdb));
 $q_dbu = mysql_query($s_dbu) or die('');
 $r_dbu = mysql_fetch_assoc($q_dbu);
 if (mysql_num_rows($q_dbu) > 0) {
     $content .= '<li>生日榜<ol>';
     do {
         $sr_c = $r_dbu['isnl'] > 0 ? $lunar->LMonName($r_dbu['bir_m']) . '月' . $lunar->LDayName($r_dbu['bir_d']) . '日' : '' . $r_dbu['bir_m'] . '月' . $r_dbu['bir_d'] . '日';
         $content .= '<li>' . ($r_dbu['isnl'] == 1 && $r_dbu['bir_m'] == $nl_t[0] && $r_dbu['bir_d'] == $nl_t[1] || $r_dbu['isnl'] == 0 && $r_dbu['bir_m'] == date('n', getftime()) && $r_dbu['bir_d'] == date('j', getftime()) ? '<img src="images/cake.gif" alt="" title="生日快乐!" /> ' : '') . '<a href="?m=user&amp;id=' . $r_dbu['id'] . '">' . $r_dbu['name'] . '</a> (<span title="生日:' . ($r_dbu['isnl'] > 0 ? '农历' : '') . $sr_c . '">' . $sr_c . '</span>)</li>';
     } while ($r_dbu = mysql_fetch_assoc($q_dbu));
     $content .= '</ol></li>';
 }
 mysql_free_result($q_dbu);
Beispiel #4
0
		    });
		}
		</script>
	</div>
	<!-- 循环展示提示语 -->
	<div class="row qiandao">
		<div id="scrollDiv">
			<ul>
				<?php 
$show_birthday = "select * from users";
$show_birthday_query = mysqli_query($con, $show_birthday);
while ($show_birthday_array = mysqli_fetch_array($show_birthday_query)) {
    $date = date("Y-m-d");
    if ($show_birthday_array['isnongli'] == 1) {
        $lunar = new Lunar();
        $date = date("Y-m-d", $lunar->S2L($date));
    }
    if (date("m-d", strtotime($date)) == date("m-d", strtotime($show_birthday_array['birthday']))) {
        echo "<li>今天是" . $show_birthday_array['name'] . "的" . $rili[$show_birthday_array['isnongli']] . "生日</li>";
    }
}
?>
			    <li>当你的翅膀没了力量,激情衰退,实在是飞不动的时候,就飞了一半了</li>
			    <li>每天叫你起床的不是闹钟,是梦想</li>
			</ul>
		</div>
		<style type="text/css">
		ul,li{margin:0;padding:0}
			#scrollDiv{width:600px;height:25px;line-height:25px;overflow:hidden}
			#scrollDiv li{height:25px;padding-left:10px;}
		</style>
Beispiel #5
0
<?php

error_reporting(E_ERROR);
ini_set('date.timezone', 'Asia/Shanghai');
header("Content-Type: text/html;charset=utf-8");
include "conn.php";
include_once "nongli.php";
if (!empty($_POST['birthday'])) {
    $classid = $_POST['classid'];
    $birthday = $_POST['birthday'];
    $isnongli = $_POST['isnongli'];
    if ($isnongli == 1) {
        $lunar = new Lunar();
        $birthday = date("Y-m-d", $lunar->S2L($birthday));
    }
    $select_user_sql = "select * from users where classid='{$classid}'";
    $select_user_qurey = mysqli_query($con, $select_user_sql);
    $select_user_array = mysqli_fetch_array($select_user_qurey);
    if (!empty($select_user_array)) {
        $update_birthday = "update users set birthday='{$birthday}',isnongli='{$isnongli}' where classid='{$classid}';";
        mysqli_query($con, $update_birthday);
        $data['shengri'] = "success";
        echo json_encode($data);
    } else {
        $data['shengri'] = "nouser";
        echo json_encode($data);
    }
} else {
    echo "请用正确的方式访问";
}