</div> <?php if ($_reply['num_rows'] > 0) { $_floor = 1 + $limit_start; do { $_floor++; $_reply_author = sc_get_result("SELECT `username` FROM `member` WHERE `id` = '%d'", array($_reply['row']['author'])); ?> <div id="<?php echo $_floor; ?> " class="post"> <ul class="list-inline"> <li> <img src="<?php echo sc_avatar_url($_reply['row']['author']); ?> " class="avatar"> </li> <li style="font-size:130%;"><?php echo $_reply_author['row']['username']; ?> </li> <li>發表於 <?php echo $_reply['row']['mktime']; ?> </li> <li><?php echo $_floor; ?> 樓</li>
<?php } elseif (isset($_GET['no'])) { ?> <div class="alert alert-danger">修改頭貼失敗!</div> <?php } elseif (isset($_GET['ok'])) { ?> <div class="alert alert-success">修改頭貼成功!</div> <?php } if (!isset($_GET['step'])) { ?> <form action="avatar.php?step=2" method="post" enctype="multipart/form-data" name="form1"> <p>你目前的頭貼:</p> <img src="<?php echo sc_avatar_url($_member['row']['id']); ?> " class="avatar avatar-lg"> <br> <div class="controls"> <p><input name="upload" type="file" id="upload" /></p> <input type="submit" name="button" class="btn btn-info" value="上傳" /> </div> <br> <p>上傳頭貼僅允許 jpg.gif.png 格式圖片,且檔案大小不得超過 <?php echo $center['avatar']['max_size']; ?> KB,建議尺寸 100x100 ~ 200x200(px)。</p> </form> <?php }
$_data = array(); if ($_unread_count != $_last) { $_data['count'] = $_unread_count; break; } $i++; sleep(1); } header("Content-type: application/json"); echo json_encode($_data); } elseif (isset($_POST['last'])) { $_last = intval($_POST['last']); $_all_rows = $SQL->query("SELECT * FROM `notice` WHERE `send_to`='%d'", array($_SESSION_scratch['Center_Id']))->num_rows; if ($_all_rows > 30) { $SQL->query("DELETE FROM `notice` WHERE `send_to`='%d' ORDER BY `mktime` ASC LIMIT 1", array($_SESSION_scratch['Center_Id'])); } $_result = sc_get_result("SELECT * FROM `notice` WHERE `send_to`='%d' AND `mktime` > '%s' ORDER BY `mktime` ASC", array($_SESSION_scratch['Center_Id'], date('Y-m-d H:i:s', $_last))); $_data = array(); $_data['last'] = time(); if ($_result['num_rows'] > 0) { do { $_send_from = sc_get_result("SELECT `username` FROM `member` WHERE `id` = '%d'", array($_result['row']['send_from'])); $_send_to = sc_get_result("SELECT `username` FROM `member` WHERE `id` = '%d'", array($_result['row']['send_to'])); $_data['data'][] = array('id' => $_result['row']['id'], 'url' => $_result['row']['url'], 'content' => $_result['row']['content'], 'status' => $_result['row']['status'], 'send_from' => $_send_from['row']['username'], 'send_from_avatar' => sc_avatar_url($_result['row']['send_from'], true), 'send_to' => $_send_to['row']['username'], 'mktime' => $_result['row']['mktime']); } while ($_result['row'] = $_result['query']->fetch_assoc()); } $SQL->query("UPDATE `notice` SET `status` = '1' WHERE `send_to`='%d' AND `status`='0' ORDER BY `mktime` DESC LIMIT 5", array($_SESSION_scratch['Center_Id'])); header("Content-type: application/json"); echo json_encode($_data); } die;