11、如何对SESSION进行检验(后台检查页面的制作)
<?php 
session_start();
if(!isset($_SESSION["admin"])){
header("location:login.php");
exit;
}
?>
12、验证用户名及密码是否填写(javascript)
<SCRIPT language=javascript>
<!--
function confirmlogin()
{
if (document.frmmain.username.value.length<4 || document.frmmain.username.value=="")
{
     document.frmmain.username.focus();
     document.frmmain.username.select;
     window.alert("请输入你的用户名!");
     return false;
}
if (document.frmmain.password.value.length<4)
{
     document.frmmain.password.focus();
     document.frmmain.password.select;
     window.alert("请输入你的密码!");
     return false; 
}
    return true;
}
//-->
</SCRIPT>
13、在PHP中调用编辑器的方法
1)将编辑器文件夹放置后台管理文件夹内。
2)利用以下语句进行引入操作。
<input name="content" type="hidden" value=''>
<IFRAME ID="eWebEditor1" src="eWebEditorPHP38/ewebeditor.htm?id=content&style=coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME>
注:eWebEditorPHP38编辑器文件夹的名称。
    id=content中content为上面隐藏域的名称
14、循环输出(能够实现分列)
   1)首先插入一行一列表格
<?php
$i=1;
?>   
<table>
   <tr>
    <?php
while($rs=mysql_fetch_array($conn)){ 
?>      
   <td>
    被循环的其它表格和输出
   </td>
   <?php 
      if ($i % 2==0) {
   echo "</tr><tr>";
   }
   $i++;
    }
   ?> 
   </tr>
</table>
15、给下拉列表框绑定数据(并且在修改时默认选中)
<select name="fenleiid">
<?php
$sql="select * from fenleibiao";
$conn=mysql_query($sql,$connec);
while($rs1=mysql_fetch_array($conn)){ 
?>
   
<option value="<?=$rs1["fenleiid"]?>" 
<? 
if ($rs["fenleiid"]==$rs1["fenleiid"]){ 
echo "selected" ;
}
?>>
<?=$rs1["flname"]?>
</option>
        <?php> 
}
?>
          </select>
16、获取字符长度函数
strlen($c)>12
17、定义一个字符截取函数
用法:<?=substrgb($rs["title"],10)?>
function substrgb($in,$num){
   $pos=0;
   $out="";
   while($c=substr($in,$pos,1)){
    if($c=="\n") break;
    if(ord($c)>128){
     $out.=$c;
     $pos++;
     $c=substr($in,$pos,1);
  
   $out.=$c;
    }else{
     $out.=$c;
    }
    $pos++;
    if($pos>=$num) break;
   }
   if($out!=$in) $out = $out . "...";
   return $out;
}
18、判断是否是数字
!is_numeric(qq)
19、PHP技术中获取当前日期
$ptime=date("y-m-d");
20、用户注册时所使用的PHP验证程序
if ($admin=="" or (strlen($admin)>16) or (strlen($admin)<2)) {
     echo "<SCRIPT language=JavaScript>alert('请输入用户名(不能大于16小于2)');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($password=="" or strlen($password)>16 or strlen($password)<6) {
     echo "<SCRIPT language=JavaScript>alert('密码长度为6-16个字符');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
if ($password=="") {
     echo "<SCRIPT language=JavaScript>alert('确认密码不能为空');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}else{
if ($password!=$password1) {
     echo "<SCRIPT language=JavaScript>alert('密码和确认密码不一致');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
}
if ($wt="") {
     echo "<SCRIPT language=JavaScript>alert('密码问题不能为空');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
if ($da="") {
     echo "<SCRIPT language=JavaScript>alert('问题答案不能为空');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
if ($qq!="") {
if (!is_numeric($qq)) { 
     echo "<SCRIPT language=JavaScript>alert('QQ号码必须是数字');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
}
if ($youbian=="" or strlen($youbian)!=6) {
     echo "<SCRIPT language=JavaScript>alert('请正确输入邮编');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
if ($youbian!="") {
if (!is_numeric($youbian)) { 
     echo "<SCRIPT language=JavaScript>alert('邮编必须是数字');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
}
if ($dizhi="") {
     echo "<SCRIPT language=JavaScript>alert('住址不能为空');";
     echo"this.location.href='vbscript:history.back()';</SCRIPT>";
     
}
if ($mail=="") {
echo "<SCRIPT language=JavaScript>alert('E-mail不能为空!');";
echo "this.location.href='vbscript:history.back()';</SCRIPT>";

if ($textarea=="") {
echo "<SCRIPT language=JavaScript>alert('个人说明不能为空!');";
echo "this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($textarea=="" or strlen(textarea)>150) {
   echo "<SCRIPT language=JavaScript>alert('个人说明为150个字符');";
   echo"this.location.href='vbscript:history.back()';</SCRIPT>";
   
}文章来源:http://www.phphubei.com/thread-100-1-1.html