我这里这样没有出错提示:
<?php
if ($add_folder=="") 
{
echo "<form method='post' action='$PHP_SELF'><table align=center><tr align=center><td><input class=input type='submit' name='add_folder' value='添加目录'>";
}?>
全部代码贴出来看看?

解决方案 »

  1.   

    全部代码如下:
    <?
    session_start();//在当前目录下添加的所有文件夹
    //需要输入的当前文件夹的编号Folder_ID;include("../includes/serverinfo.inc");
    $Current_User_ID=$user_identification[0]["Current_User_ID"];
    $Current_User_Password=$user_identification[0]["Password"];$Current_Function_ID=1;//文档管理模块
    $changecolorbymouse="onmouseout=\"this.style.backgroundColor='#ffffff'\" onmouseover=\"this.style.backgroundColor='#e7ebff'\"";//===========================================================================
    //                      函数定义开始
    //===========================================================================
    function createtime() //得到当前时间
    {
     $current_time=getdate(time());
     $year=date("Y");
     $month=date("m");
     $day=date("d");
     $hour=$current_time["hours"];
     $minute=$current_time["minutes"];
     $second=$current_time["seconds"];
     $current_total_time=$year."-".$month."-".$day."-".$hour."-".$minute."-".$second;
     return $current_total_time;
     }//给定目录查询结果,将显示该目录下的所有文件夹
     function search_currentfolder($layer,$result,$current_folderID)
      {
      $num_folder[$layer]=mysql_numrows($result);
      //将LAYER下所有的目录ID都加到数组中;
      for ($q=1;$q<=$num_folder[$layer];$q++)
         {
         $r=mysql_fetch_array($result);
         $folder[$layer][$q]=$r["Folder_ID"];   //得到目录的ID
         $folder_name[$layer][$q]=$r["Folder_Name"];
         }
      for ($i[$layer]=1;$i[$layer]<=$num_folder[$layer];$i[$layer]++)
          {
          $k=$i[$layer];
          $t=$folder[$layer][$k];
          $test="-->";
          for($m=1;$m<=$layer;$m++)
             {
             $test="----".$test;
             $classname="menu".$m;
             }
          $Select_FolderID=$folder[$layer][$k];
          if ($current_folderID==$Select_FolderID)
               echo "<option class=$classname value='$Select_FolderID' selected>"."|-".$test.$folder_name[$layer][$k]."</option>";
          else
               echo "<option class=$classname value='$Select_FolderID'>"."|-".$test.$folder_name[$layer][$k]."</option>";
          $query="select * from folder where Top_Folder='$t'";
          $result=mysql_query($query);      if (mysql_numrows($result))
             {
             //目录下还有子目录!
             $layer++;
             search_currentfolder($layer,$result,$current_folderID);
             $layer--;
             }
           else
             {
             //该目录下无子目录!
             }
          }
       $layer--;
      }//====================================================================
    function add_update_user_right($New_Folder_ID,$user_ID,$Right_ID)
       {
        global $Current_Function_ID;
    var $add_folder
        //查询用户权限表中用户ID为:$User_ID的记录
        $query_user_right="select * from user_right where (Function_ID='$Current_Function_ID' and Sub_ID='$New_Folder_ID' and User_ID='$user_ID')";
        $result_user_right=mysql_query($query_user_right);
        if (($r_user_right=mysql_fetch_array($result_user_right))!="")
           {
            //说明已存在该用户的授权
            //如果用户已有授权小于新的授权,则要更新?
            if ($r_user_right["Right_ID"]<=$Right_ID)
               {
                $query_update_user_right="update user_right set Right_ID='$ Right_ID' where(Function_ID='$Current_Function_ID' and Sub_ID='$New_Folder_ID' and User_ID='$user_ID')";
                $operation_update_user_right=mysql_query($query_update_user_right);
               }
           }
        else
           {
            $query_user_right="select * from user_right order by ID desc";
            $result_user_right=mysql_query($query_user_right);
            $r_user_right=mysql_fetch_array($result_user_right);
            $new_Right_ID=$r_user_right["ID"]+1;//新的用户权限ID,
            //下面开始向用户权限表中添加数据
            $query_insert_user_right="insert into user_right values('$new_Right_ID','$user_ID','$Current_Function_ID','$New_Folder_ID','$Right_ID')";
            $operation_insert_user_right=mysql_query($query_insert_user_right);
           }
       }
    //====================================================================
    //                  开始显示添加目录的表单及表单处理程序
    //====================================================================
    //读用户表,分析用户是管理员还是普通用户;
      $query_user_role="select User_Role from user where (User_ID='$Current_User_ID')";
      $result_user_role=mysql_query($query_user_role);
      $r_user_role=mysql_fetch_array($result_user_role);
      

  2.   

    if ($add_folder=="")     //显示添加文件夹的表单;
          {
             echo "<p align=center>添加目录模块";
             echo "<hr color=#003366 width=600></p>";
             echo "<form abc method='post' action='$PHP_SELF'>";
             echo "<table align=center border=0>";
             echo "<tr align=center class=text2><td>[<a href=show_document.php?Folder_ID='$New_Folder_ID'><font color=#31309c>返回</font></a>]</td></tr></table>";
             echo "<table align=center border=1 bordercolor=pink cellspacing=0>";
             echo "<tr class=text2 align=center><td>目录名</td>";
             echo "<td><input class=form $changecolorbymouse type=text name='name_folder' value=''></td></tr>";
             echo "<tr class=text2 align=center><td>关键字</td>";
             echo "<td><input class=form $changecolorbymouse type=text name='Keywords' value=''></td></tr>";
             echo "<tr class=text2 align=center><td>描述</td>";
             echo "<td><textarea class=form name='Description' cols=25 rows=4></textarea></td></tr>";
             echo "<tr class=text2 align=center><td>文件夹所处位置<br><font class=hot>(颜色标示目录层次)</font></td><td><select class=form name='location_folder' size=10>";         $want_search_folder=0; //要显示的目录ID,将输出所有在该目录下的目录ID;
             $query_search_foldername="select * from folder where Folder_ID='$want_search_folder'";
             $result_search_foldername=mysql_query($query_search_foldername);
             $r_search_foldername=mysql_fetch_array($result_search_foldername);
             echo "<option value='$want_search_folder' selected>"."|-".$test.$r_search_foldername["Folder_Name"]."</option>";
             if ($r_user_role["User_Role"]==1)
                  {  //普通用户
                  $query_folder_tree="select * from folder where (Top_Folder='$want_search_folder' and Folder_CreatorID='$Current_User_ID')";
                  }
             else
                  {//超级用户
                  $query_folder_tree="select * from folder where (Top_Folder='$want_search_folder')";
                  }
             $result_folder_tree=mysql_query($query_folder_tree);
             search_currentfolder(1,$result_folder_tree,$Folder_ID);
             echo "</select></td>";         //======================================
             //           输出授予用户权限的表单
             //======================================
             //echo "<tr class=text2 align=center><td>文件夹授权:<font class=hot>(权限向下兼容)</font></td>";         echo "<tr class=text2 align=center><td>管理权限</td>";
             echo "<td><select class=form name='manage_right[]' multiple>";
             //列表开始
             echo "<option value='' selected>>>不授权其它用户<<</option>";
             echo "<option value='1'>授权给所有用户</option>";
             echo "<option value=''>==用户组列表==</option>";
             //列出系统内所有用户组
             $query_Group_ID="select * from user_group";
             $result_Group_ID=mysql_query($query_Group_ID);
             $max1=1;$num_group=0;
             while ($r=mysql_fetch_array($result_Group_ID) )
                {
                 $Group_ID=$r["Group_ID"]+$max1;
                 $Group_Name=$r["Group_Name"];
                 echo "<option value=$Group_ID>$Group_Name</option>";
                 $num_group++;
                 }
             //列出系统内所有用户
             $query_User_ID="select * from user order by User_ID";
             $result_User_ID=mysql_query($query_User_ID);
             echo "<option value=''>==所有用户列表==</option>";
             $max2=$max1+$num_group;
             while ($r=mysql_fetch_array($result_User_ID) )
                {
                 $User_ID=$r["User_ID"]+$max2;
                 $User_Name=$r["User_Name"];
                 echo "<option value=$User_ID>$User_Name</option>";
                 }
             echo "</select></td></tr>";
             //列表完毕!         echo "<tr class=text2 align=center><td>读写权限</td>";
             echo "<td><select class=form name='readandadd_right[]' multiple>";
             //列表开始
             echo "<option value='' selected>>>不授权其它用户<<</option>";
             echo "<option value='1'>授权给所有用户</option>";
             echo "<option value=''>==用户组列表==</option>";
             //列出系统内所有用户组
             $query_Group_ID="select * from user_group";
             $result_Group_ID=mysql_query($query_Group_ID);
             $max1=1;$num_group=0;
             while ($r=mysql_fetch_array($result_Group_ID) )
               {
                $Group_ID=$r["Group_ID"]+$max1;
                $Group_Name=$r["Group_Name"];
                echo "<option value=$Group_ID>$Group_Name</option>";
                $num_group+=1;
                }
             //列出系统内所有用户
             $query_User_ID="select * from user order by User_ID";
             $result_User_ID=mysql_query($query_User_ID);
             echo "<option value=''>==所有用户列表==</option>";
             $max2=$max1+$num_group;
             while ($r=mysql_fetch_array($result_User_ID) )
               {
                $User_ID=$r["User_ID"]+$max2;
                $User_Name=$r["User_Name"];
                echo "<option value=$User_ID>$User_Name</option>";
                }
             echo "</select></td></tr>";
             //列表完毕!         echo "<tr class=text2 align=center><td>读权限</td>" ;
             echo "<td><select class=form name='read_right[]' multiple>";
             //列表开始
             echo "<option value='' selected>>>不授权其它用户<<</option>";
             echo "<option value='1'>授权给所有用户</option>";
             echo "<option value=''>==用户组列表==</option>";
             //列出系统内所有用户组
             $query_Group_ID="select * from user_group";
             $result_Group_ID=mysql_query($query_Group_ID);
             $max1=1;         $num_group=0;
             while ($r=mysql_fetch_array($result_Group_ID) )
                {
                $Group_ID=$r["Group_ID"]+$max1;
                $Group_Name=$r["Group_Name"];
                echo "<option value=$Group_ID>$Group_Name</option>";
                $num_group++;
                }
             //列出系统内所有用户
             $query_User_ID="select * from user order by User_ID";
             $result_User_ID=mysql_query($query_User_ID);
             echo "<option value=''>==所有用户列表==</option>";
             $max2=$max1+$num_group;
             while ($r=mysql_fetch_array($result_User_ID) )
               {
                $User_ID=$r["User_ID"]+$max2;
                $User_Name=$r["User_Name"];
                echo "<option value='$User_ID'>$User_Name</option>";
                }
             echo "</select></td></tr></table>";
             //列表完毕!         //============显示用户提交按钮================
             //传递几个隐含参数
             echo "<input type='hidden' name=max1 value='$max1'>";
             echo "<input type='hidden' name=max2 value='$max2'>";
             echo "<table align=center><tr align=center><td><input class=input type='submit' name='add_folder' value='添加目录'>";
     echo "&nbsp&nbsp<input class=input type='reset' name='cancel' value='重写'></td></tr></table>";
             echo "</form>";
          }
      

  3.   

    else
        {
          if ($name_folder!="")//判断用户是否输入了目录名称
           {
             //====================向目录表中添加记录==============
             //获取用户所选择的目录
             //echo "您选择的上层目录ID:".$location_folder."<br>";
             //判断用户是否有写的权限!
             if ($r_user_role["User_Role"]==1 and $location_folder!=0)
                  {  //普通用户要判断是否有该文件夹的管理权限
                     $query_FolderCreatorID="select * from Folder where (Folder_ID='$location_folder')";
                     $result_FolderCreatorID=mysql_query($query_FolderCreatorID);
                     $r_FolderCreatorID=mysql_fetch_array($result_FolderCreatorID);
                     if ($r_FolderCreatorID["Folder_CreatorID"]!=$Current_User_ID)
                        {
                         $query_user_right="select * from user_right where (Function_ID='$Current_Function_ID' and Sub_ID='$location_folder' and User_ID='$Current_User_ID')";
                         $result_user_right=mysql_query($query_user_right);
                         if (($r_user_right=mysql_fetch_array($result_user_right))<3)//当前用户对上层文件夹有管理权限
                          {
                            //echo "你没有该目录的写权限!";
                            exit();
                          }
                        }//当前用户时要添加文件夹所在上层文件夹的创建者
                  }
             $query_maxfolderID="select * from folder order by Folder_ID desc";
             $result_maxfolderID=mysql_query($query_maxfolderID);
             $r_maxfolderID=mysql_fetch_array($result_maxfolderID);
             $New_Folder_ID=$r_maxfolderID["Folder_ID"]+1;
             $create_time=createtime();
             $query="insert into folder(Folder_ID,Folder_Name,Keywords,Description,Top_Folder,Folder_CreatorID,Folder_CreateTime) values('$New_Folder_ID','$name_folder','$Keywords','$Description','$location_folder','$Current_User_ID','$create_time')";
             $operation=mysql_query($query);
             //echo "写文件夹表完成!"."<a href=add_document.php>返回添加目录</a><br>";         //===========================开始给用户分配权限=======================
             //=============读授权!
             //echo "<br><br>读授权数为:".count($read_right)."<br>";
             $num_read_right=count($read_right); //每个多选下拉表对应一个数组
             for ($i=0;$i<$num_read_right;$i++) //得到多选的每个值
                    {
                      if ($read_right[$i]=="")
                         {
                          //echo "不授权给其它用户<br>";
                         }
                      else
                         {
                          if ($read_right[$i]>$max1)
                               {
                                if ($read_right[$i]>$max2)
                                   {
                                     $user_ID=$read_right[$i]-$max2;//得到被授权用户的ID
                                     //echo "用户ID:".$user_ID."<br>";
                                     add_update_user_right($New_Folder_ID,$user_ID,'1');
                                   }
                                else
                                   {
                                     $group_ID=$read_right[$i]-$max1;
                                     //echo "组ID:".$group_ID."<br>"; //得到用户授权ID
                                     $query_group_member="select * from user where Group_ID='$group_ID'";
                                     $result_group_member=mysql_query($query_group_member);
                                     while ($r_group_member=mysql_fetch_array($result_group_member))
                                        {
                                         add_update_user_right($New_Folder_ID,$r_group_member["User_ID"],'1');
                                        }
                                   }
                                }
                         else
                                {
                                  //echo "所有人都有权限!<br>";
                                  $query_member="select * from user";
                                  $result_member=mysql_query($query_member);
                                  while ($r_member=mysql_fetch_array($result_member))
                                      {
                                       add_update_user_right($New_Folder_ID,$r_member["User_ID"],'1');
                                      }
                                }
                         }
                    }         //===============读+写授权!
             //echo "<br><br>读写授权:".count($readandadd_right)."<br>";
             $num_readandadd_right=count($readandadd_right); //每个多选下拉表对应一个数组
      

  4.   

    没有全看完,估计是php设置的问题。
      

  5.   

    for ($i=0;$i<$num_readandadd_right;$i++) //得到多选的每个值
                    {
                      if ($readandadd_right[$i]=="")
                         {
                          //echo "不授权给其它用户<br>";
                         }
                      else
                         {
                          if ($readandadd_right[$i]>$max1)
                               {
                                if ($readandadd_right[$i]>$max2)
                                   {
                                     $user_ID=$readandadd_right[$i]-$max2;//得到被授权用户的ID
                                     //echo "用户ID:".$user_ID."<br>";
                                     add_update_user_right($New_Folder_ID,$user_ID,'2');
                                   }
                                else
                                   {
                                     $group_ID=$readandadd_right[$i]-$max1;
                                     //echo "组ID:".$group_ID."<br>"; //得到用户授权ID
                                     $query_group_member="select * from user where Group_ID='$group_ID'";
                                     $result_group_member=mysql_query($query_group_member);
                                     while ($r_group_member=mysql_fetch_array($result_group_member))
                                        {
                                         add_update_user_right($New_Folder_ID,$r_group_member["User_ID"],'2');
                                        }
                                   }
                                }
                         else
                                {
                                  //echo "所有人都有权限!<br>";
                                  $query_member="select * from user";
                                  $result_member=mysql_query($query_member);
                                  while ($r_member=mysql_fetch_array($result_member))
                                      {
                                       add_update_user_right($New_Folder_ID,$r_member["User_ID"],'2');
                                      }
                                }
                         }
                    }
             //===================管理授权!
             //echo "<br><br>管理授权:".count($manage_right)."<br>";
             $num_manage_right=count($manage_right); //每个多选下拉表对应一个数组
             for ($i=0;$i<$num_manage_right;$i++) //得到多选的每个值
                    {
                      if ($manage_right[$i]=="")
                         {
                          //echo "不授权给其它用户<br>";//不对用户权限表进行操作
                         }
                      else
                         {
                          if ($manage_right[$i]>$max1)
                               {
                                if ($manage_right[$i]>$max2)
                                   {
                                     $user_ID=$manage_right[$i]-$max2;//得到被授权用户的ID
                                     //echo "用户ID:".$user_ID."<br>";
                                     add_update_user_right($New_Folder_ID,$user_ID,'3');
                                   }
                                else
                                   {
                                     $group_ID=$manage_right[$i]-$max1;
                                     //echo "组ID:".$group_ID."<br>"; //得到用户授权ID
                                     $query_group_member="select * from user where Group_ID='$group_ID'";
                                     $result_group_member=mysql_query($query_group_member);
                                     while ($r_group_member=mysql_fetch_array($result_group_member))
                                        {
                                         add_update_user_right($New_Folder_ID,$r_group_member["User_ID"],'3');
                                        }
                                   }
                                }
                         else
                                {
                                  //echo "所有人都有权限!<br>";
                                  $query_member="select * from user";
                                  $result_member=mysql_query($query_member);
                                  while ($r_member=mysql_fetch_array($result_member))
                                      {
                                       add_update_user_right($New_Folder_ID,$r_member["User_ID"],'3');
                                      }
                               }
                         }
                    }
              header("Location:$webserver/document/show_document.php?Folder_ID=$location_folder");
            }
          else
            {
              echo "文件夹名空!<a href=show_document.php?Folder_ID=0>返回目录浏览</a>";
            }
      }
     ?>
     <LINK href="../includes/menu.css" rel=stylesheet type=text/css>
    <LINK href="../includes/text.css" rel=stylesheet type=text/css>
      

  6.   

    不是少了什么东西, 总是给我这个提示
    Notice: Undefined variable: add_folder in C:\oa\document\add_document.php on line 111
    让我感到不可思议,
      

  7.   

    全部代码 都拷贝,这种提交方式:
      echo "<form abc method='post' action='$PHP_SELF'>";
    有没有错误?
      

  8.   

    我这边全部代码拷贝后运行只有以下错误,
    Warning: main(): Unable to access ../includes/serverinfo.inc in F:\Apache2\htdocs\php\test.php on line 7Warning: main(../includes/serverinfo.inc): failed to open stream: No such file or directory in F:\Apache2\htdocs\php\test.php on line 7Warning: main(): Failed opening '../includes/serverinfo.inc' for inclusion (include_path='.;c:\php4\pear') in F:\Apache2\htdocs\php\test.php on line 7Warning: mysql_query(): Can't connect to MySQL server on 'localhost' (10061) in F:\Apache2\htdocs\php\test.php on line 108Warning: mysql_query(): A link to the server could not be established in F:\Apache2\htdocs\php\test.php on line 108Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\Apache2\htdocs\php\test.php on line 109php.ini 中设置 error_reporting  =  E_ALL & ~E_NOTICE 重启web服务器看看有没有报错了?
      

  9.   

    谢谢,上边 feel8(准备早起的鸟)。 我给你分
      

  10.   

    是不是登录页,注册session变量那段代码 在验证session代码后面
      

  11.   

    嗯。是不是注册session变量那段代码 在验证session代码后面
      

  12.   

    session_start();
    session_register("user_identification");
    //验证密码
    if
    ……………………
    这个地方是不是将
    session_register("user_identification");
    移到最后?
      

  13.   

    //从数据库读取密码跟用户提交的比对
    //通过验证 注册 session.  $_SESSION['变量名'] = 变量值;//检查是否登录?
      

  14.   

    <?
    session_start();
    session_register("user_identification"); //&AElig;&ocirc;&para;&macr;session&pound;&not;×&cent;&sup2;á±&auml;&Aacute;&iquest;user_identification;include("includes/serverinfo.inc");
    include("includes/password.inc");$passwdClass = new Passwd;//&iquest;&ordf;&Ecirc;&frac14;&Ntilde;é&Ouml;¤&Oacute;&Atilde;&raquo;§&ETH;&Aring;&Iuml;&cent;
    //echo "&Auml;ú&Ecirc;&auml;&Egrave;&euml;&micro;&Auml;&Oacute;&Atilde;&raquo;§&Atilde;&ucirc;".$User_Name;$query="select * from user where (User_Name='$User_Name')";
    $result=mysql_query($query);
    if ($r=mysql_fetch_array($result))
       {
        if ($passwdClass->checkPasswd($Password, $r["User_Password"]))
         {      //echo "&Atilde;&Uuml;&Acirc;&euml;&Ntilde;é&Ouml;¤&sup3;&Eacute;&sup1;&brvbar;&pound;&iexcl;";
          $user_identification[]=array('Current_User_ID'=>$r["User_ID"], 'Password'=>$Password);
          //echo "<a href=index.html>&micro;&atilde;&raquo;÷&Otilde;&acirc;&Agrave;&iuml;&frac12;&oslash;&Egrave;&euml;</a>";      header("Location:index.html");
          }
        else
         {
          echo "&Atilde;&Uuml;&Acirc;&euml;&acute;í&Icirc;ó&pound;&not;&Ccedil;&euml;&Ouml;&Oslash;&ETH;&Acirc;&Ecirc;&auml;&Egrave;&euml;&pound;&iexcl;<a href=index.htm> ·&micro;&raquo;&Oslash;</a>" ;
          }
       }
    else
       {
       echo "&cedil;&Atilde;&Oacute;&Atilde;&raquo;§&sup2;&raquo;&acute;&aelig;&Ocirc;&Uacute;&pound;&not;&micro;&atilde;&raquo;÷<a href=$webserver/user/register.php>&Otilde;&acirc;&Agrave;&iuml;×&cent;&sup2;á</a>";
       }
      
    ?>
      

  15.   

    这样试试?<?
    session_start();
    //&AElig;&ocirc;&para;&macr;session&pound;&not;×&cent;&sup2;á±&auml;&Aacute;&iquest;user_identification;include("includes/serverinfo.inc");
    include("includes/password.inc");$passwdClass = new Passwd;//&iquest;&ordf;&Ecirc;&frac14;&Ntilde;é&Ouml;¤&Oacute;&Atilde;&raquo;§&ETH;&Aring;&Iuml;&cent;
    //echo "&Auml;ú&Ecirc;&auml;&Egrave;&euml;&micro;&Auml;&Oacute;&Atilde;&raquo;§&Atilde;&ucirc;".$User_Name;$query="select * from user where (User_Name='$User_Name')";
    $result=mysql_query($query);
    if ($r=mysql_fetch_array($result))
       {
        if ($passwdClass->checkPasswd($Password, $r["User_Password"]))
         {      //echo "&Atilde;&Uuml;&Acirc;&euml;&Ntilde;é&Ouml;¤&sup3;&Eacute;&sup1;&brvbar;&pound;&iexcl;";
          $user_identification[]=array('Current_User_ID'=>$r["User_ID"], 'Password'=>$Password);
          //echo "<a href=index.html>&micro;&atilde;&raquo;÷&Otilde;&acirc;&Agrave;&iuml;&frac12;&oslash;&Egrave;&euml;</a>";      header("Location:index.html");
          }
        else
         {
          echo "&Atilde;&Uuml;&Acirc;&euml;&acute;í&Icirc;ó&pound;&not;&Ccedil;&euml;&Ouml;&Oslash;&ETH;&Acirc;&Ecirc;&auml;&Egrave;&euml;&pound;&iexcl;<a href=index.htm> ·&micro;&raquo;&Oslash;</a>" ;
          }
       }
    else
       {
       echo "&cedil;&Atilde;&Oacute;&Atilde;&raquo;§&sup2;&raquo;&acute;&aelig;&Ocirc;&Uacute;&pound;&not;&micro;&atilde;&raquo;÷<a href=$webserver/user/register.php>&Otilde;&acirc;&Agrave;&iuml;×&cent;&sup2;á</a>";
       }
      
      $_SESSION['user_identification'] = $user_identification;
    ?>
      

  16.   

    不清楚怎么回事 :(
    怎么会第一次登录出错,第二次登录就正常,是哪里提示出错?检查不到登录成功后注册的session变量还是哪里提示出错?
      

  17.   

    和原来的这样的结果是相同的。
    <?
    session_start();
    session_register("user_identification"); 
    include("includes/serverinfo.inc");
    include("includes/password.inc");$passwdClass = new Passwd;
    $query="select * from user where (User_Name='$User_Name')";
    $result=mysql_query($query);
    if ($r=mysql_fetch_array($result))
       {
        if ($passwdClass->checkPasswd($Password, $r["User_Password"]))
         {         $user_identification[]=array('Current_User_ID'=>$r["User_ID"], 'Password'=>$Password);
             header("Location:index.html");
          }
        else
         {
          echo "&Atilde;&Uuml;&Acirc;&euml;&acute;í&Icirc;ó&pound;&not;&Ccedil;&euml;&Ouml;&Oslash;&ETH;&Acirc;&Ecirc;&auml;&Egrave;&euml;&pound;&iexcl;<a href=index.htm> ·&micro;&raquo;&Oslash;</a>" ;
          }
       }
    else
       {
       echo "&cedil;&Atilde;&Oacute;&Atilde;&raquo;§&sup2;&raquo;&acute;&aelig;&Ocirc;&Uacute;&pound;&not;&micro;&atilde;&raquo;÷<a href=$webserver/user/register.php>&Otilde;&acirc;&Agrave;&iuml;×&cent;&sup2;á</a>";
       }
      
    ?>
      

  18.   

    现象是这样的:
    打开一个新的IE后,进入这个网址。输入用户名和密码,进去,则会告诉你,登陆失败,重新登录。
    如果你后退到首页,重新输入和上次相同的用户名和密码,则登录成功。
    如果你重新启动一个IE则问题还是登录失败
      

  19.   

    ……
    <?
    session_start();
    $_SESSION['www'] = "abc";
    if($_SESSION['www'] == "abc"){
    echo "正常";
    }else{
    echo "错误";
    }?>正常的话就是你代码哪里的问题,仔细找找
      

  20.   

    嗯。这样注册session变量没问题,可能是你代码哪里有问题
      

  21.   

    if ($passwdClass->checkPasswd($Password, $r["User_Password"]))
         {         $user_identification[]=array('Current_User_ID'=>$r["User_ID"], 'Password'=>$Password);
             header("Location:index.html");
          }
    这个地方,是打开另一个窗体的地方。就出现了登录失败。可是其他窗体中没有再注册变量。
    当第二次登录就不这样。
      

  22.   

    if ($passwdClass->checkPasswd($Password, $r["User_Password"]))
         {
      $user_identification[]=array('Current_User_ID'=>$r["User_ID"], 'Password'=>$Password);
       $_SESSION['user_identification'] = $user_identification;
      header("Location:index.html");这个地方 如果  $_SESSION['user_identification'] = $user_identification; 没有的话,则永远都是登录失败,如果加上这个的话, 第二次才登录成功
      

  23.   

    就是说这里第一次的反回值是 真值?
    $passwdClass->checkPasswd($Password, $r["User_Password"])第二次就是假值了,不执行这个if内的跳转语句?
      

  24.   

    实际每次都是真值,都执行IF
    if ($passwdClass->checkPasswd($Password, $r["User_Password"]))
         {
      $user_identification[]=array('Current_User_ID'=>$r["User_ID"], 'Password'=>$Password);
       $_SESSION['user_identification'] = $user_identification;
      header("Location:index.html");
    }
    else
         {
          echo "abc" ;
          }
       }
    else
       {
       echo "abcd";
       }
    我做试验的时候,都没有执行else后的语句
    仅仅是登录的时候,是不是有个地方是逻辑错误?
      

  25.   

    好像有点问题,
    if(){
    }else{
    }else{
    }
    不行的吧?
      

  26.   

    sorry, 下面的else 是令一个if 的
    在if前边的一句话还是一个IF 所以下面有两个else