請問登陸csdn時﹐需要用戶輸入注冊碼功能是如何實現的﹖

解决方案 »

  1.   

    是验证码吧 就是随机生成字符串并保存到cookie上 然后 显示的时候故意弄得奇形怪状的,输入完就和cookie取出的值对比
      

  2.   


    <?php
    /*
     * Created on 2009-4-17
     *
     * To change the template for this generated file go to
     * Window - Preferences - PHPeclipse - PHP - Code Templates
     */
     /********
      * 验证码
      *******/
    session_start();
    header ( "Content-type: image/PNG" );
    $check =rand(1,2);
    switch ($check)
    {
    case 1:
    $rand = "";
    for($i = 0; $i < 4; $i ++) {
    $rand .= dechex ( rand ( 0, 9 ) );
    }
    $im = imagecreate ( 45, 20 );
    $black = ImageColorAllocate ( $im, 0, 0, 0 );
    $white = ImageColorAllocate ( $im, 200, 200, 200 );
    $gray = ImageColorAllocate ( $im, 0, 200, 200 ); imagefill ( $im, 0, 0, $white ); //改了这里的参数
    //将四位整数验证码绘入图片
    imagestring ( $im, 5, 5, 3, $rand, $black ); for($i = 0; $i < 200; $i ++) //加入干扰象素
    {
    imagesetpixel ( $im, rand () % 70, rand () % 30, $black );
    }
    $_SESSION['checkcode']=$rand;
    ImagePNG ( $im );
    ImageDestroy ( $im ); break;
    case 2:
    $code= array("+","*");
    $x = rand(1,9);
    $y = rand(1,9);
    $im = imagecreate ( 60, 20 );
    $bg = imagecolorallocate($im,255,255,255);
    $black = imagecolorallocate($im,0,0,0);
    $xcolor = imagecolorallocate($im,rand(1,200),rand(1,200),rand(1,200));
    $ycolor = imagecolorallocate($im,rand(1,200),rand(1,200),rand(1,200));
    $codecolor = imagecolorallocate($im,rand(1,200),rand(1,200),rand(1,200));
    $denhaocolor = imagecolorallocate($im,rand(1,200),rand(1,200),rand(1,200));
    $whcolor = imagecolorallocate($im,rand(1,200),rand(1,200),rand(1,200)); $fh = $code[rand(0,1)];
    imagestring ( $im, 5, 5, 3, $x, $xcolor );
    imagestring ( $im, 10, 15, 3, $fh, $codecolor );
    imagestring($im,20,25,3,$y,$ycolor);
    imagestring($im,30,35,3,"=",$denhaocolor);
    imagestring($im,40,45,3,"?",$whcolor);
    if($fh=="+")
    {
    $_SESSION['checkcode']=$x+$y;
    }
    else if($fh=="*")
    {
    $_SESSION['checkcode']=$x*$y;
    } ImagePNG ( $im );
    ImageDestroy ( $im ); break;
    }
    ?>
      

  3.   

    低价开发软件 (包括毕业设计等)大家好!
        上次,我曾经发送过“接近免费价格开发软件”,收到了不少网友的来信,在此表示感谢!!!
        由于,收到开发的软件过多,我一个人忙不过来,需要请别人帮忙;更重要的是,我发现有些朋友,因为我的免费就随便编写需求,让我开发。我不喜欢这样的事情发生。
        所以,我决定:有尝开发软件!!
        现在的软件工程师不少,可是能够低价开发软件的很少.为了扩大软件的使用范围,为了让那些收入不是很高的个人或者团队能够使用上软件,本人愿意以接近免费的价格开发软件.
        如果有软件需求,请填写清楚软件需求,并发送邮件到[email protected] 所有邮件将在两日内给出答复(能否开发,开发时间).试用软件一段时间后,如果您感觉软件有问题,请及时发送邮件给我!!一定尽快解决!
        
    备注:
        1.我是一名软件设计师(原高级程序员),软件架构师,本科学历,学士学位,英语四级,已经工作3年.能够 开发网络(WEB)软件和桌面(WINDOWS)软件.
        2.如果您认为我的软件能够使用,就按照您的意愿,给出一定报酬. 软件价格在是一般网络上面宣称的60%。
        3.如果有需要,我将发送证书给您查看
        4.特别地: 本人愿意接受毕业设计的开发业务。 使用语言:VB,VB.net,C#,ASP.net,Delphi,C++,VC
        5. 联系方式:QQ:1036373438;    邮件到[email protected]
    最后,祝福各位: 万事如意!
      

  4.   

    用session保存验证码也可以的
      

  5.   

    這段執行出來看不到圖片﹐是個紅 X ﹐請問是什么原因﹖謝謝﹗
    <?
           Header("Content-type: image/PNG");
       srand((double)microtime()*1000000);
       $im=@imagecreate(110, 20);
       $black=ImageColorAlloCate($im,0,0,0);
       $white=ImageColorAllocate($im,255,255,255);
           $gray=ImageColorAllocate($im,200,200,200);
       imagefill($im,68,30,$gray);
       imagestring($im,5,10,8,$_POST['authnum'],$black);
        for($i=0;$i<50;$i++)
            { 
       imagesetpixel($im,rand()%70,rand()%30,$black);
            } 
    ImagePNG($im);
    ImageDestroy($im);
    ?>