<?php
	require("../__common__/__define_mobile.php");
	require("__define.php");
	$GLOBALS['URL_2_ATAG_SHORT_LEN'] = 20;
	$login_id = mobile_login_check();
	$con = mobile_mysql_connect(_DB_SCHEMA);
	$sql = 'select * from v_messages order by id_messages desc limit '.CHAT_VIEW_CNT_MAX;
	$rs = my_mysql_query($sql);
	$row = mysql_num_rows($rs);
	if ($row == 0) {
		exit;
	}
	$GLOBALS['URL_2_ATAG_SHORT_LEN'] = 36;
	echo '<table id="chat_view_table">';
	while ($rec=mysql_fetch_array($rs)) {
		echo '<tr>';
		echo '<td class="chat_view_image" rowspan=2>';
		if ($rec['c_profile_image'] <> '') {
			echo '<img src="'.PROFILE_ICON_IMAGE_FOLDER.($rec['c_profile_image']).'" style="width:'.PROFILE_ICON_IMAGE_SIZE.'px; height:'.PROFILE_ICON_IMAGE_SIZE.'px;" />';
		}
		echo '</td>';
		echo '<td class="chat_view_handle">'.my_htmlspecialchars($rec['c_handle']).'</td>';
		echo '<td class="chat_view_time">'.date_from_mysql("n/j H:i:s", $rec['c_registtime']).'</td>';
		echo '</tr>';
		echo '<tr>';
		echo '<td class="chat_view_message" colspan=2>'.ins_atag_br_short($rec['c_message']).'</td>';
		echo '</tr>';
	}
	echo '</table>';
	$con = mysql_close($con);
?>
