做一个登陆判断就可以了.
用session或者cookies都可以!

解决方案 »

  1.   

    <?php
    if($num)
    {
    //-----------------判断密码是否正确-------------//
    $strsql1="select * from com_user where c_name='$name' and  c_password='$pws' ";
    $result1=mysql_query($strsql1,$conn);
    $num1=mysql_num_rows($result1);
    if(!empty($name))
    {
    if($num1)
    {
    //  当验证通过后,启动 Session 
    session_start(); 
    //  注册登陆成功的 admin 变量,并赋值 true 
    $_SESSION["admin"] = true; 

    echo "企业会员成功登录!";
    //echo "<meta http-equiv=refresh content=1;url=qyhuiyuan.php>";
    }
    else
    {
    echo"您的密码不正确,请重新输入!";
    echo "<meta http-equiv=refresh content=1;url=index.php>";
    }
    }
    else
    {
    echo"用户名不能为空!";
    echo "<meta http-equiv=refresh content=1;url=index.php>";
    }
    }
    else
    {
    $err =mysql_error(); 
    if($err)

    echo "发生错误,请通知<a href=mailto:[email protected]>我</a>"; 
    echo "$err"; 

    else 
    { echo "企业用户名不存在,请注册!";
      echo "<meta http-equiv=refresh content=1;url=index.php>";

    mysql_close();
    }
    ?>
    这是我的代码,可是却有错误!请指教!