当其他用户登录时出现回声问题 [英] Echo problem when a different user logs in

查看:76
本文介绍了当其他用户登录时出现回声问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当有其他用户登录时,我一直在尝试更改系统列表或表页面的输出。

i have been trying to change the output of my systems list or table page whenever a different user logins in.

我有2个主要用户(管理员和超级管理员)和次要用户(公司注册帐户)。我的管理员用途是上传其他公司发送的文件。然后,上传的文件将传递到另一个帐户超级管理员。超级管理员用于批准或拒绝由管理员提交的上传文件。此文件最初来自另一家公司。该表已按员工姓名,状态和职务排序。并且我已经插入了一个条件,它应该回显一次名称和ID。

i have 2 major users (admin and super admin) and minor users (company registered accounts). my admin use is to upload files sent by other company. the uploaded file is then passed to the other account "super admin". the super admin is used to approve or disapprove uploaded files submitted by the admin.this files originally came from the other company. the table is already ordered by employee name,status and title. and i already inserted the condition that it should echo the name and id once.

这是之前的条件

当管理员登录时,主目录中的表将输出所有上传的文件,无论其状态如何。这也适用于超级管理员。而在另一家公司中,只能看到或输出该公司员工上载的文件。
所有这些代码均能正常工作。

when the admin logs in, the table in the home will output all the uploaded files whatever its status may be.this also applies to super admin. while in the other company, only the files uploaded by the employee in that company may be seen or is outputted. all of this code is working properly.

这是我现在期望的条件

当管理员登录时,家中的表将输出所有上传的文件,无论其状态如何。当超级管理员登录时,主页表将仅输出状态为已批准和未批准的文件。状态为待定的已上传文件必须在我现在正在做的标题为新上传的另一页中回显。而当其他用户登录时,他们只会看到状态为批准或未批准的文件。

when the admin logs in, the table in the home will output all the uploaded files whatever its status may be. when the super admin logs in, the homepage table will output only files with the status approved and not approved. uploaded file with a pending status must echo in the other page that i entitled "New Uploads" that i'm working to do now. And when other users log in, they will only see the files with the approved or not approved status.

我希望我能以某种方式使它变得清晰。 :(我已经尝试解决此问题已有2天了,但是总是出现错误的输出,所以我想向您寻求帮助:(

i hope somehow i made it clear. :( i have been trying to solve this problem for 2 days now but wrong outputs always appear,so i would like to ask for you help :(

这是我的系统中输出表的样子

this is what the output table looks like in my system


if the admin page is login

*EmployeeID*     *EmployeeName*     *Title*     *FileDate*     *Status*     *Confirmation*

  20864125           Keisha          file2     Feb 01, 2000     Pending         Delete
  20080407           Mariel          file5     Aug 01, 2000     Pending         Delete
                                     file1     Jan 01, 2000     Pending         Delete
  16521253           Riorei          file13    Jan 01, 2000     Pending         Delete
                                     file10    Mar 20, 2003     Pending         Delete  

if the super admin login

*EmployeeID*     *EmployeeName*     *Title*     *FileDate*     *Status*           *Confirmation*

  20864125           Keisha          file2     Feb 01, 2000     Pending         Approve/Not Approve
  20080407           Mariel          file5     Aug 01, 2000     Pending         Approve/Not Approve
                                     file1     Jan 01, 2000     Pending         Approve/Not Approve
  16521253           Riorei          file13    Jan 01, 2000     Pending         Approve/Not Approve
                                     file10    Mar 20, 2003     Pending         Approve/Not Approve     

an if other user log in

*EmployeeID*     *EmployeeName*     *Title*     *FileDate*     *Status*           

  20864125           Keisha          file2     Feb 01, 2000     Pending         

现在您已经看到了区别,我想在该输出中应用新条件:(这是我使用的代码

now that you see the difference,i would like to apply the new condition in that output :( this is the code i used

while ($row = mysql_fetch_assoc($query))
                            {
                                $file_id = $row['file_id'];
                                $file_desc = $row['file_description'];
                                $file_date = $row['file_date'];
                                $file_name = $row['file_name'];
                                $file_accs = $row['folder_access'];
                                $file_employee  = $row['employee_id'];
                                $file_confir = $row['confirmation'];
                                $file_ename = ucwords($row['employee_name']);

                                $emp_id=$emp_id==$row['employee_id']?"":$row['employee_id'];
                                $emp_name=$emp_name==$row['employee_name']?"":$row['employee_name'];

                                $info = pathinfo($file_name);
                                $file_ext = $info['extension'];                                 



                                echo '<tr>
                                    <td>
                                        &nbsp; 
                                    </td>
                                    </tr>
                                    <tr class="subone">
                                    <td class="sub" width="100">
                                        '.$emp_id.'
                                        <br />
                                        &nbsp;
                                    </td>';
                                    if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                                    {

                                    ?><td class="sub" width="100">
                                        <a href="" onclick = javascript:newPopup('addfile.php?emp=<?php echo $file_employee ?>');><?php echo$emp_name?></a>
                                        <br />
                                        &nbsp;
                                    </td><?php
                                    }
                                    else
                                        {
                                            echo '<td class="sub" width="182">
                                            '.$emp_name.' 
                                            <br />
                                            &nbsp;
                                            </td>';
                                        }


                                    echo'<td  class="sub" width="218">
                                        <a href="'.$file_accs.$file_name.'" target="_blank" style="text-decoration: underline;">'.$file_desc.'</a>
                                        <br />
                                        &nbsp;
                                    </td>
                                    <td  class="sub" width="100">
                                        '.date('M d, Y',mktime(0,0,0,substr($file_date,5,2),substr($file_date,8,2),substr($file_date,0,4))).'
                                        <br />
                                        &nbsp;
                                    </td>
                                    <td  class="sub" width="100">   
                                                '.$file_confir.'                
                                    <br />
                                            &nbsp;
                                            </td>';
                                    if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                                    {
                                        if($file_confir == 'Pending' OR $file_confir == 'NotApproved')
                                        {                                               
                                            if(isset($_GET['id']))
                                            {
                                                $fgmembersite->Delete_Db($_GET['id']);
                                            }
                                                echo '<td  class="sub" width="100"> 
                                                <a href="index.php?id='.$file_id.'">Delete</a>
                                                <br />
                                                &nbsp;
                                                </td>';
                                        }
                                    }
                                    else if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'admin')
                                        {
                                            if($file_confir == 'Pending')
                                            {   
                                                    if(isset($_GET['yes']))
                                                    {
                                                        $fgmembersite->UpdateYesDB($_GET['yes']);
                                                        //echo "<script>location.reload();</script>";
                                                    }
                                                    else if(isset($_GET['no']))
                                                    {
                                                        $fgmembersite->UpdateNoDB($_GET['no']);
                                                        //echo "<script>location.reload();</script>";
                                                    }
                                                    if (!isset($_GET['offset'])) {
                                                        $prevoffset = 0;
                                                    } else {
                                                        $prevoffset = $_GET['offset'];
                                                    }                                                       
                                                    echo'<td  class="sub" width="100">  
                                                    <a href="index.php?offset='.$prevoffset.'&searchfile='.$search.'&namelist='.$listname.'&yes='.$file_id.'">Approve</a>                                           
                                                    <br /><br />

                                                    <a href="index.php?offset='.$prevoffset.'&searchfile='.$search.'&namelist='.$listname.'&no='.$file_id.'">NotApprove</a>                                     
                                                    &nbsp;
                                                    </td> ';
                                            }   
                                        }
                                    }?>






当新条件尚未出现时,此方法可以正常工作现在我的问题是如何在这里应用新条件?我尝试使用以下代码集:


this works properly when the new condition is not yet applied.now my problem is how could i apply the new condition here? i have tried using this set of code:

if($_SESSION[$fgmembersite->GetLoginSessionVar()] != 'sa' && $file_confir == '' OR $file_confir == 'NotApproved')

在echo语句之前。但是它产生了错误的输出,有人可以告诉我我在这里应该做什么? :(我知道我应该使用条件语句来执行此操作,但是我不知道哪一个适合。感谢那些会回答的人。

before the echo statement. but it produced the wrong output, can someone tell me what should i do here? :( i know i should use condition statements to do this,but i don't know which one will fit. thanks for those who would reply.

推荐答案

您的if / elseif语句已经检查了admin和superadmin,普通用户会不会只是在else中?

Your if/ elseif statement checks for admin and superadmin already, wouldn't the regular user just be in the else?

if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa'){
    // your code here
} elseif($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'admin') {
    // more code here
} else {
    // here goes the code of your regular user
    if($file_confir == '' OR $file_confir == 'NotApproved'){
        // display the file 
    }
}

作为旁注:如果不混合使用HTML和PHP,您可能会发现编写代码/调试要容易得多,代码格式/缩进也不一致,但这可能是由于复制/粘贴

As a side note: You might find it a lot easier to write code / debug if you wouldn't mix HTML and PHP. The code formatting /indents are also not consistent, but that may be due to copy/paste

这篇关于当其他用户登录时出现回声问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆