T086ѧϰ�� | վ��ѧԺ | �����ĵ� | ���� | Ъ���� | IP��ַ��ѯ | �������� | ���ջ��� | �����ֵ� | ���ù��� | ������Ϣ��ѯ

phpͨ�ü��⺯����(��)

�� �������ߣ����� ����ʱ�䣺2005-11-16 | ���壺�� �� С��
[����]// ��������CheckTelephone($C_telephone) // �� �ã��ж��Ƿ�Ϊ�Ϸ��绰���� // �� ����$C_telephone���������ĵ绰���룩 // ����ֵ������ֵ // �� ע���� //---------------------------------------------------...

// ��������CheckTelephone($C_telephone)
// �� �ã��ж��Ƿ�Ϊ�Ϸ��绰����
// �� ����$C_telephone���������ĵ绰���룩
// ����ֵ������ֵ
// �� ע����
//-----------------------------------------------------------------------------------
-------
function CheckTelephone($C_telephone)
{
if (!ereg("^[+]?[0-9]+([xX-][0-9]+)*$", $C_telephone)) return false;
return true;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// ��������CheckValueBetween($N_var, $N_val1, $N_val2)
// �� �ã��ж��Ƿ���ijһ��Χ�ڵĺϷ�ֵ
// �� ����$N_var ��������ֵ
// $N_var1 ������ֵ������
// $N_var2 ������ֵ������
// ����ֵ������ֵ
// �� ע����
//-----------------------------------------------------------------------------------
-------
function CheckValueBetween($N_var, $N_val1, $N_val2)
{
if ($N_var < $N_var1 ���� $N_var > $N_var2)
{
return false;
}
return true;

}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// ��������CheckPost($C_post)
// �� �ã��ж��Ƿ�Ϊ�Ϸ��ʱࣨ�̶����ȣ�
// �� ����$C_post����check���������룩
// ����ֵ������ֵ
// �� ע����
//-----------------------------------------------------------------------------------
-------
function CheckPost($C_post)
{
$C_post=trim($C_post);
if (strlen($C_post) == 6)
{
if(!ereg("^[+]?[_0-9]*$",$C_post))
{
return true;;
}else
{
return false;
}
}else
{
return false;;
}
}
//-----------------------------------------------------------------------------------
-------
// ��������CheckExtendName($C_filename,$A_extend)
// �� �ã��ϴ��ļ�����չ���ж�
// �� ����$C_filename �ϴ����ļ���
// $A_extend Ҫ������չ��
// ����ֵ������ֵ
// �� ע����
//-----------------------------------------------------------------------------------
-------
function CheckExtendName($C_filename,$A_extend)
{
if(strlen(trim($C_filename)) < 5)
{
return 0; //����0��ʾû�ϴ�ͼƬ
}
$lastdot = strrpos($C_filename, "."); //ȡ��.�������ֵ�λ��
$extended = substr($C_filename, $lastdot+1); //ȡ����չ��

for($i=0;$i{
if (trim(strtolower($extended)) == trim(strtolower($A_extend[$i]))) //ת����
Сд������
{
$flag=1; //�ӳɹ���־
$i=count($A_extend); //���⵽�˱�ֹͣ����
}
}

if($flag<>1)
{
for($j=0;$j{
$alarm .= $A_extend[$j]." ";
}
AlertExit('ֻ���ϴ�'.$alarm.'�ļ��������ϴ�����'.$extended.'���͵��ļ�');
return -1; //����-1��ʾ�ϴ�ͼƬ�����Ͳ���
}

return 1; //����1��ʾͼƬ�����ͷ���Ҫ��
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// ��������CheckImageSize($ImageFileName,$LimitSize)
// �� �ã������ϴ�ͼƬ�Ĵ�С
// �� ����$ImageFileName �ϴ���ͼƬ��
// $LimitSize Ҫ���ijߴ�
// ����ֵ������ֵ
// �� ע����
//-----------------------------------------------------------------------------------
-------
function CheckImageSize($ImageFileName,$LimitSize)
{
$size=GetImageSize($ImageFileName);
if ($size[0]>$LimitSize[0] ���� $size[1]>$LimitSize[1])
{
AlertExit('ͼƬ�ߴ�����');
return false;
}
return true;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// ��������Alert($C_alert,$I_goback=0)
// �� �ã��Ƿ���������
// �� ����$C_alert����ʾ�Ĵ�����Ϣ��
// $I_goback�����ص���һҳ��
// ����ֵ���ַ���
// �� ע����
//-----------------------------------------------------------------------------------
-------
function Alert($C_alert,$I_goback=0)
{
if($I_goback<>0)
{
echo " ";
}
else
{
echo " ";
}
}
//-----------------------------------------------------------------------------------
-------
// ��������AlertExit($C_alert,$I_goback=0)
// �� �ã��Ƿ���������
// �� ����$C_alert����ʾ�Ĵ�����Ϣ��
// $I_goback�����ص���һҳ��
// ����ֵ���ַ���
// �� ע����
//-----------------------------------------------------------------------------------
-------
function AlertExit($C_alert,$I_goback=0)
{
if($I_goback<>0)
{
echo " ";
exit;
}
else
{
echo " ";
exit;
}
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// ��������ReplaceSpacialChar($C_char)
// �� �ã������ַ��滻����
// �� ����$C_char�����滻���ַ�����
// ����ֵ���ַ���
// �� ע����
//-----------------------------------------------------------------------------------
-------
function ReplaceSpecialChar($C_char)
{
$C_char=HTMLSpecialChars($C_char); //��������Ԫת�� HTML ��ʽ��
$C_char=nl2br($C_char); //���س��滻Ϊ

$C_char=str_replace(" "," ",$C_char); //�滻�ո��滻Ϊ
$C_char=str_replace("return $C_char;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
-------
// ��������ExchangeMoney($N_money)
// �� �ã��ʽ�ת������
// �� ����$N_money����ת���Ľ������֣�
// ����ֵ���ַ���
// �� ע��������ʾ����$char=ExchangeMoney(5645132.3155) ==>
$char='��5,645,132.31'
//-----------------------------------------------------------------------------------
-------
function ExchangeMoney($N_money)
{
$A_tmp=explode(".",$N_money ); //�����ְ�С�����ֳ������֣�����������$A_tmp
$I_len=strlen($A_tmp[0]); //����С����ǰ��λ���Ŀ���

if($I_len%3==0)
{
$I_step=$I_len/3; //��ǰ��λ���Ŀ���mod 3 = 0 ,�ɰ����ֳ�$I_step
����
}else
{
$step=($len-$len%3)/3+1; //��ǰ��λ���Ŀ���mod 3 != 0 ,�ɰ����ֳ�$I_step
����+1
}

$C_cur="";
//��С������ǰ�Ľ������ֽ���ת��
while($I_len<>0)
{
$I_step--;

if($I_step==0)
{
$C_cur .= substr($A_tmp[0],0,$I_len-($I_step)*3);
}else
{
$C_cur .= substr($A_tmp[0],0,$I_len-($I_step)*3).",";
}

$A_tmp[0]=substr($A_tmp[0],$I_len-($I_step)*3);
$I_len=strlen($A_tmp[0]);
}

//��С���������Ľ����Ľ���ת��
if($A_tmp[1]=="")
{
$C_cur .= ".00";
}else
{
$I_len=strlen($A_tmp[1]);
if($I_len<2)
{
$C_cur .= ".".$A_tmp[1]."0";
}else
{
$C_cur .= ".".substr($A_tmp[1],0,2);
}
}

//���������ҷ��Ų�����
$C_cur="��".$C_cur;
return $C_cur;
}
//-----------------------------------------------------------------------------------
-------


//-----------------------------------------------------------------------------------
------
// ��������WindowLocation($C_url,$C_get="",$C_getOther="")
// �� �ã�PHP�е�window.location����
// �� ����$C_url ת�򴰿ڵ�URL
// $C_get GET��������
// $C_getOther GET��������������
// ����ֵ: �ַ���
// �� ע����
//-----------------------------------------------------------------------------------
-----
function WindowLocation($C_url,$C_get="",$C_getOther="")
{
if($C_get == "" && $C_getOther == "")
if($C_get == "" && $C_getOther <> ""){$C_target=""window.location='$C_url?
$C_getOther='+this.value"";}
if($C_get <> "" && $C_getOther == ""){$C_target=""window.location='$C_url?
$C_get'"";}
if($C_get <> "" && $C_getOther <> ""){$C_target=""window.location='$C_url?
$C_get&$C_getOther='+this.value"";}
return $C_target;
}
//-----------------------------------------------------------------------------------
-----

?> 

  • ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
  • �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����
������ѯ Health Check Gulangyu
© 2017 T086ѧϰ�� - T086.com(ԭitlearner.com)
RunTime:6.71ms QueryTime:7