没有通用的
这是个过程
……
控制注册信息的话
试试用验证码

解决方案 »

  1.   

    变态点:中文验证码
    更变态:短信验证
      

  2.   

    写入数据库的数据过滤掉非法的字符
      

  3.   

    加了随机注册码还会吗?试试别的随机码,复杂点的
      

  4.   

    login.php
    ......
    <tr>
        <td align=center>验证码:<input type="text" name="code" size="5" maxlength=5 onmouseover="form1.code.select()" onkeydown="onlyNum()">&nbsp;<img src="img.php" align=absmiddle></td>
      </tr>
    .....img.php
    <?
    session_start();$im = ImageCreateTrueColor(60, 25);
    $black = ImageColorAllocate ($im, 0, 0, 0);
    $backcolor = ImageColorAllocate ($im, 150, 255, 255);
    $num=rand(10000,99999);$_SESSION['code']=$num;// draw on image
    ImageFill($im, 0, 0, $backcolor);
    ImageString($im,5,8,5,''.$num.'',$black);
    // output image
    Header ('Content-type: image/png');
    ImagePng ($im);
      
    // clean up 
      ImageDestroy($im);
     
    ?>check_login.php......
    if($code!=$_SESSION['code']){
    echo "<center><font color=red>验证码输入不正确<br>" ;
    echo "本次登录失败,请重新登录!</font></center>";
        include("login.php");
    exit();
    }
    .........