Un title page

การนำ User Online ไปใช้งาน
1. หลังจากที่เราเขียน Script User Online เสร็จแล้ว ให้เรา Include ไฟล์ User Online ไปไว้ที่ไฟล์ที่เราต้องการแสดง ดังโค้ดตัวอย่าง

<? include('user_online.php');?>
<html>
<head>
<title>Un title page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>

<body bgcolor="#FFFFFF">

</body>
</html>

2. หลังจากนั้นให้ใส่ Comment บรรทัดที่ผมกำหนดไว้

//echo "กำลังใช้งานอยู่ : $user_online คน"; //ทดสอบการแสดงผล ถ้านำไปใช้ให้ปิด หรือลบบรรทัดนี้ออกไป

3. หลังจากนั้นเราเขียนโค้ด php เพิ่มลงไป ณ ตำแหน่งที่เราต้องการแสดงผล ในที่นี้ผมจะยกตัวอย่างการแสดงใน Table ดังโค้ดตัวอย่าง

<? include('user_online.php');?>
<html>
<head>
<title>Un title page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>

<body bgcolor="#FFFFFF">
<table width="150" border="0" cellpadding="0" bgcolor="#000000">
<tr>
<td bgcolor="#FF9900" align="center">กำลังใช้งาน
<? echo $user_online;?>
ท่าน </td>
</tr>
</table>
</body>
</html>

4. ผลลัพธ์ที่ได้

5. ก็จบลงไปแล้วกับ User Online ลองนำไปใช้กันดู ขอให้สนุกกับการทำเว็บ