Check and cut the strings by length in PHP

Posted on February 6th, 2008

function striptext($message, $position)
{
if (strlen($message) > $position) // Check if string length is exceeded
{
$post = substr($message,$position,1);
if ($post !=” “) // If last character is not space
{
while($post !=” “) // Check next character one by one
{
$i=1;
$position=$position+$i;
$post = substr($message,$position,1);
}
}
$post = substr($message,0,$position);
$text = $post . ‘…’; // Add dots
} else {
$text = $message . ‘…’; // Or do nothing
}
return($text);
}

Usage: (Allow only 5 characters to display)
striptext(”Blah Blah Blah”, “5″)

วิธีแก้ปัญหาโดนบังคับอัพเกรด msn 7.5 เป็น 8.1

Posted on September 12th, 2007

ไมโครซอฟท์บังคับให้ผู้ใช้อัพเกรด msn messenger เนื่องจากปัญหาช่องโหว่ MS07-054 ทำให้หลังจากที่เรากดรับ Video Chat หรือ Webcam แล้ว แฮคเกอร์สามารถรันโปรแกรมบางอย่างบนเครื่องเราได้

สำหรับคนที่จะแก้ไขตามวิธีด้านล่าง จะต้องยอมรับความเสี่ยงตามที่บอกไว้

การแก้ไขให้สามารถใช้งาน msn 7.5 ทำตามขั้นตอนนี้

- ปิดโปรแกรม msn 7.5 ดูตรง taskbar ให้แน่ใจว่าไม่มีไอคอนอยู่
- ไปที่ไฟล์ C:\Program Files\MSN Messenger\msnmsgr.exe คลิกขวา เลือก properties
ไปที่แท็บ compatibility เลือก Run this program in compatibility mode for: แล้วเลือก windows 2000
- กด OK แล้วเปิด msn ตามปกติ

© Quando Omni Flunkus Moritati • Powered by Wordpress • Using the Swiss Cool theme.