就是像论坛上的注册跟登陆一样的,我要源文件,想自己学习一下

解决方案 »

  1.   

    你说的是弹出浮动窗口进行登录注册吗?
    那应该是脚本技术,像jquery中就有这样的插件,没怎么用过。
      

  2.   

    这种是浮动登陆框,如果不是这种楼主是不是说的ajax?? 
    <a href="javascript:popSignFlow(1);">登录</a> 
    <script language="javascript"> 
    function G(id){
        return document.getElementById(id);
    };
    function GC(t){
       return document.createElement(t);
    };
    function isIE(){
          return (document.all && window.ActiveXObject && !window.opera) ? true : false;

         var loginDivWidth = 300;
    var sign_in_flow = '<form action="" method="post"><div style="padding:10px;">账户:'
           + '<input type="text" name="username" maxlength="15" size="15" style="border:solid 1px #BFBFBF"/>'
           + '</div><div>密码:<input type="password" name="password" size="15" style="border:solid 1px #BFBFBF"/>'
           + '</div><div><input type="submit" name="sub_sign" value="登录" style="border:solid 1px #BFBFBF;background:#FF8800;color:#ffffff;margin:10px 0;cursor:pointer" />'
           + ' <input type="button" value="返回" onclick="cancelSign();" style="border:solid 1px #BFBFBF;background:#FF8800;color:#ffffff;cursor:pointer;margin-left:20px;"/></div></form>';
    function loadSignInFlow(){
       G("sign_div").innerHTML = sign_in_flow;
        G("sign_email").focus();
    };
    function cancelSign(){
        G("sign_div").style.display = 'none';
        G("cover_div").style.display = 'none';
       document.body.style.overflow = '';
    };
    function popCoverDiv(){
       if (G("cover_div")) {
        G("cover_div").style.display = '';
       } else {
        var coverDiv = GC('div');
        document.body.appendChild(coverDiv);
        coverDiv.id = 'cover_div';
        with(coverDiv.style) {
         position = 'absolute';
         background = '#CCCCCC';
         left = '0px';
         top = '0px';
         var bodySize = getBodySize();
         width = bodySize[0] + 'px'
         height = bodySize[1] + 'px';
         zIndex = 98;
         if (isIE()) {
          filter = "Alpha(Opacity=60)";
         } else {
          opacity = 0.6;
         }
        }
       }
    }
    function getBodySize(){
       var bodySize = [];
       with(document.documentElement) {
        bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
        bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
       }
       return bodySize;
    }
    function popSign(isLogin){
       if (G("sign_div")) {
        G("sign_div").style.display = '';
       } else {
        var signDiv = GC('div');
        document.body.appendChild(signDiv);
        signDiv.id = 'sign_div';
        signDiv.align = "center";
        signDiv.onkeypress = function(evt){
              var e = window.event?window.event:evt;
              if (e.keyCode==13 || e.which==13) {
               if (G("sign_button")) {
                G("sign_div").focus();
                G("sign_button").click();
               }
              }
             };
        with (signDiv.style) {
         position = 'absolute';
         left = (document.documentElement.clientWidth - loginDivWidth)/2 + 'px';
         top = (document.documentElement.clientHeight - 300)/2 + 'px';
         width = loginDivWidth + 'px';
         zIndex = 99;
         background = '#FFFFFF';
         border = '#BFBFBF solid 1px';
        }
       }
       if(isLogin) {
        G("sign_div").innerHTML = sign_in_flow;
       } else {
        G("sign_div").innerHTML = change_pwd_flow;
       }
      
    }
    function popSignFlow(isLogin) {
       popCoverDiv();  
       popSign(isLogin);  
       document.body.style.overflow = "hidden";
         
          if(isLogin) {
           G("sign_email").focus();
          } else {
           G("old_pwd").focus();
          }
    }
    </script> 
      

  3.   

    参考一下:php教程入门教程-用户注册实例程序完整版
    // 创建数据库教程连接
    mysql 教程_connect('localhost','111cn.net','www.111cn.net');
    mysql_select_db('www.111cn.net');//数据库选择
    mysql_query('set names "gbk"');//进度查询操作
    ?>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <script language="javascript教程">
    check111cnNet()
    {if( myfm.uid.value =='' )
    {
    alert('www.111cn.net提示你:用户名错误');
    return false;
    }
    if( ! myfm.pwd.value!='' && myfm.pwd.value == myfm.pwd1.value )
    {alert('www.111cn.net提示你:二次密码不正确');
    return false;
    }}
    </script>
    </head><body>
    <form id="myfm" name="myfm" method="post" action="">
    <label>
    用户名
    <input type="text" name="uid" />
    <br>
    密码
    <input type="text" name="pwd" />
    <br>
    密码2
    <input type="text" name="pwd2" />
    <br>
    </label>
    <label>
    <input type="submit" name="Submit" value="注册" onClick="return check111cnNet();" />
    </label>
    </form>
    </body>
    </html>
    <?php
    if($_POST)
    {
    $uid = $_POST['uid'];
    $pwd = $_POST['pwd'];
    $pwd1 = $_POST['pwd1'];
    if( empty( $uid ) ){exit();} 
    $sql = "Select * from user where uid ='$uid' limit 0,10";
    $query = mysql_query($sql ) or die("www.111cn.net提示你:查询出错了");if( mysql_num_rows( $query ) )
    {
    echo '用户己被注册';
    }
    else 
    {
    if(mysql_query("insert into user(uid,pwd) values('$uid','md5($pwd)')"))
    {
    echo 'www.111cn.net提示你:注册成功';
    }
    else
    {
    echo '注册失败';
    }
    }
    }/*
    数据表结构
    CREATE TABLE `111cnNet`.`user` (
    `id` INT( 8 ) NOT NULL AUTO_INCREMENT ,
    `uid` CHAR( 150 ) NULL ,
    `pwd` char(32) NULL ,
    PRIMARY KEY ( `id` )
    ) ENGINE
    本教程只供学习用没进行安全处理,如用于商业用途出现任何问题与本站www.111cn.net无关
    */?>
      

  4.   

    直接用jquery插件吧 validate