Kiểm tra là 1 xâu là chỉ gồm chữ hoặc số?function isAlphabetNumber($st){
if (ereg('^[a-z|A-Z|0-9]+$', $st)){
return 1;
}else{
return 0;
}
}
Kiểm tra 1 xâu có phải là dạng URL hay không?
function isUrl($url, $maxlen = 256){
if (strlen($url) > $maxlen) {
return 0;
}
if(ereg("(h{0,1}t{0,2}p{0,1}:{0,1}/{0,1}/{0,1})(w{0,3}\.{0,1})([aA-zZ]+)?\.{1}([aA-zZ]{2,3})(.*)", $url)){
return 1;
}
return 0;
}
Read the rest of this entry »


