Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Totally new in php helpppp!!!!

    well i downloaded login php site and tried to modify it. i know there is lot better solution for this.
    My goal is if user is logged in show table logged user name = 0 in it. and there is only 5 or 6 users who can see this table. Please see below code and u'll see that i'm talking about.

    btw sorry for my englih

    PHP Code:
    <?php

    include("../include/classes/session.php");

    /**
     * displayUsers - Displays the users database table in
     * a nicely formatted html table.
     */
    function displayUsers(){
       global 
    $database$session;
       
    $a=$session->username;
       
    $q "SELECT username,userlevel,email,timestamp, parent_directory "
           
    ."FROM ".TBL_USERS." where parent_directory = '$a' ORDER BY userlevel DESC,username";
       
    $result $database->query($q);
       
    /* Error occurred, return given name by default */
       
    $num_rows mysql_numrows($result);
       if(!
    $result || ($num_rows 0)){
          echo 
    "Error displaying info";
          return;
       }
       if(
    $num_rows == 0){
          echo 
    "Database table empty";
          return;
       }
       
    /* Display table contents */
       
    echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo 
    "<tr><td><b>Username</b></td><td><b>Level</b></td><td><b>Email</b></td><td><b>Last Active</b></td><td><b>Group</b></td></tr>\n";
       for(
    $i=0$i<$num_rows$i++){
          
    $uname  mysql_result($result,$i,"username");
          
    $ulevel mysql_result($result,$i,"userlevel");
          
    $email  mysql_result($result,$i,"email");
          
    $time   mysql_result($result,$i,"timestamp");
          
    $parentd   mysql_result($result,$i,"parent_directory");

          echo 
    "<tr><td>$uname</td><td>$ulevel</td><td>$email</td><td>$time</td><td>$parentd</td></tr>\n";
       }
       echo 
    "</table><br>\n";
    }

    /**
     * displayBannedUsers - Displays the banned users
     * database table in a nicely formatted html table.
     */
    function displayBannedUsers(){
       global 
    $database;
       
    $q "SELECT username,timestamp "
           
    ."FROM ".TBL_BANNED_USERS." ORDER BY username";
       
    $result $database->query($q);
       
    /* Error occurred, return given name by default */
       
    $num_rows mysql_numrows($result);
       if(!
    $result || ($num_rows 0)){
          echo 
    "Error displaying info";
          return;
       }
       if(
    $num_rows == 0){
          echo 
    "Database table empty";
          return;
       }
       
    /* Display table contents */
       
    echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo 
    "<tr><td><b>Username</b></td><td><b>Time Banned</b></td></tr>\n";
       for(
    $i=0$i<$num_rows$i++){
          
    $uname mysql_result($result,$i,"username");
          
    $time  mysql_result($result,$i,"timestamp");

          echo 
    "<tr><td>$uname</td><td>$time</td></tr>\n";
       }
       echo 
    "</table><br>\n";
    }
       
    /**
     * User not an administrator, redirect to main page
     * automatically.
     */
    if(!$session->isMaster()){
       
    header("Location: ../main.php");
    }
    else{
    /**
     * Administrator is viewing page, so display all
     * forms.
     */
    ?>
    <html>
    <title>
    </title>
    <meta charset="utf-8">
    <body>
    <h1>Зөвшөөрлийн хэсэг</h1>
    <font size="5" color="#ff0000">
    <b>::::::::::::::::::::::::::::::::::::::::::::</b></font>
    <font size="4"><b><?php echo $session->username?></b></font><br><br>
    [<a href="../main2edited.php">Үндсэн хуудас</a>]<br><br>
    <?php
    if($form->num_errors 0){
       echo 
    "<font size=\"4\" color=\"#ff0000\">"
           
    ."!*** Error with request, please fix</font><br><br>";
    }
    ?>
    <?php
    $con
    =mysqli_connect("localhost","root","","login");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo 
    "Failed to connect to MySQL: " mysqli_connect_error();
      }
      
    ////////////////////////////////user1
      
    if($session->username=='user1')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user1 == 0 ");
    //if($result =='0')
        //{
            //echo"Odoogoor shiidverleh asuudal alga";
        //}
    //else

    while($row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['nyarav'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nyarav'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['ez'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['ez'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['nybo'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nybo'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['yronhii'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['yronhii'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['darga'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['darga'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }

    /////////////////////////////user2
    elseif($session->username=='user2')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user2 == '0' and user1 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['nyarav'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nyarav'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['ez'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['ez'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['nybo'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nybo'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['yronhii'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['yronhii'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['darga'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['darga'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }}
    ////////////////////////////user3
    elseif($session->username=='user3')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user3 == '0' and user2 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['nyarav'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nyarav'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['ez'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['ez'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['nybo'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nybo'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['yronhii'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['yronhii'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['darga'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['darga'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }} 

    /////////////////////////////////user4
    elseif($session->username=='user4')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user4 == '0' and user3 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['nyarav'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nyarav'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['ez'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['ez'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['nybo'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nybo'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['yronhii'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['yronhii'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['darga'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['darga'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }} 

    ////////////////////////////////////////user5
    elseif ($session->username=='user5')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user5 == '0' and user4 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['nyarav'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nyarav'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['ez'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['ez'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['nybo'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['nybo'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['yronhii'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['yronhii'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      if (
    $row['darga'] == '1'){echo "<td> Zovshoorson </td>";} elseif ($row['darga'] == '2') {echo "<td> Zovshooroogui </td>";} else{echo "<td>Huleegdej bgaa</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }}
    ?>        
    </body>
    </html>
    <?php
    }
    ?>

  • #2
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please see this code!

    PHP Code:
    <?php

    include("../include/classes/session.php");

    /**
     * displayUsers - Displays the users database table in
     * a nicely formatted html table.
     */
    function displayUsers(){
       global 
    $database$session;
       
    $a=$session->username;
       
    $q "SELECT username,userlevel,email,timestamp, parent_directory "
           
    ."FROM ".TBL_USERS." where parent_directory = '$a' ORDER BY userlevel DESC,username";
       
    $result $database->query($q);
       
    /* Error occurred, return given name by default */
       
    $num_rows mysql_numrows($result);
       if(!
    $result || ($num_rows 0)){
          echo 
    "Error displaying info";
          return;
       }
       if(
    $num_rows == 0){
          echo 
    "Database table empty";
          return;
       }
       
    /* Display table contents */
       
    echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo 
    "<tr><td><b>Username</b></td><td><b>Level</b></td><td><b>Email</b></td><td><b>Last Active</b></td><td><b>Group</b></td></tr>\n";
       for(
    $i=0$i<$num_rows$i++){
          
    $uname  mysql_result($result,$i,"username");
          
    $ulevel mysql_result($result,$i,"userlevel");
          
    $email  mysql_result($result,$i,"email");
          
    $time   mysql_result($result,$i,"timestamp");
          
    $parentd   mysql_result($result,$i,"parent_directory");

          echo 
    "<tr><td>$uname</td><td>$ulevel</td><td>$email</td><td>$time</td><td>$parentd</td></tr>\n";
       }
       echo 
    "</table><br>\n";
    }

    /**
     * displayBannedUsers - Displays the banned users
     * database table in a nicely formatted html table.
     */
    function displayBannedUsers(){
       global 
    $database;
       
    $q "SELECT username,timestamp "
           
    ."FROM ".TBL_BANNED_USERS." ORDER BY username";
       
    $result $database->query($q);
       
    /* Error occurred, return given name by default */
       
    $num_rows mysql_numrows($result);
       if(!
    $result || ($num_rows 0)){
          echo 
    "Error displaying info";
          return;
       }
       if(
    $num_rows == 0){
          echo 
    "Database table empty";
          return;
       }
       
    /* Display table contents */
       
    echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
       echo 
    "<tr><td><b>Username</b></td><td><b>Time Banned</b></td></tr>\n";
       for(
    $i=0$i<$num_rows$i++){
          
    $uname mysql_result($result,$i,"username");
          
    $time  mysql_result($result,$i,"timestamp");

          echo 
    "<tr><td>$uname</td><td>$time</td></tr>\n";
       }
       echo 
    "</table><br>\n";
    }
       
    /**
     * User not an administrator, redirect to main page
     * automatically.
     */
    if(!$session->isMaster()){
       
    header("Location: ../main.php");
    }
    else{
    /**
     * Administrator is viewing page, so display all
     * forms.
     */
    ?>
    <html>
    <title>
    </title>
    <meta charset="utf-8">
    <body>
    <h1>Зөвшөөрлийн хэсэг</h1>
    <font size="5" color="#ff0000">
    <b>::::::::::::::::::::::::::::::::::::::::::::</b></font>
    <font size="4"><b><?php echo $session->username?></b></font><br><br>
    [<a href="../main2edited.php">Үндсэн хуудас</a>]<br><br>
    <?php
    if($form->num_errors 0){
       echo 
    "<font size=\"4\" color=\"#ff0000\">"
           
    ."!*** Error with request, please fix</font><br><br>";
    }
    ?>
    <?php
    $con
    =mysqli_connect("localhost","root","","login");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo 
    "Failed to connect to MySQL: " mysqli_connect_error();
      }
      
    ////////////////////////////////user1
      
    if($session->username=='user1')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user1 == 0 ");
    //if($result =='0')
        //{
            //echo"Nothing to show";
        //}
    //else

    while($row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['user1'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user1'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user2'] == '1'){echo "<td>confirmed </td>";} elseif ($row['user2'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user3'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user3'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user4'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user4'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
     if (
    $row['user5'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user5'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }

    /////////////////////////////user2
    elseif($session->username=='user2')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user2 == '0' and user1 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "nothing to show";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['user1'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user1'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user2'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user2'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user3'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user3'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user4'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user4'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user5'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user5'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }}
    ////////////////////////////user3
    elseif($session->username=='user3')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user3 == '0' and user2 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
      if (
    $row['user1'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user1'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user2'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user2'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user3'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user3'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user4'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user4'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user5'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user5'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }} 

    /////////////////////////////////user4
    elseif($session->username=='user4')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user4 == '0' and user3 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
       if (
    $row['user1'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user1'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user2'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user2'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user3'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user3'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user4'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user4'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user5'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user5'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }} 

    ////////////////////////////////////////user5
    elseif ($session->username=='user5')
    {
    echo 
    "<table border='1'>
    <tr>
    <th><b>bid</b></th>
    <th><b>zahialagch</b></th>
    <th><b>material</b></th>
    <th><b>zoriulalt</b></th>
    <th><b>negj</b></th>
    <th><b>too</b></th>
    <th><b>negj une</b></th>
    <th><b>niit une</b></th>
    <th><b>nyarav</b></th>
    <th><b>ez</b></th>
    <th><b>nyabo</b></th>
    <th><b>yronhii</b></th>
    <th><b>darga</b></th>
    <th><b>date</b></th>
    </tr>"
    ;

    $result mysqli_query($con,"SELECT * FROM zahialga WHERE user5 == '0' and user4 <> 1");
    if(
    $result =='NULL')
        {
            echo
    "Odoogoor shiidverleh asuudal alga";
        }
    else
    {
    while(
    $row mysqli_fetch_array($result))
      {
      echo 
    "<tr>";
      echo 
    "<td>" $row['bid'] . "</td>";
      echo 
    "<td>" $row['zahialagch'] . "</td>";
      echo 
    "<td>" $row['material'] . "</td>";
      echo 
    "<td>" $row['zoriulalt'] . "</td>";
      echo 
    "<td>" $row['negj'] . "</td>";
      echo 
    "<td>" $row['too'] . "</td>";
      echo 
    "<td>" $row['negj_une'] . "</td>";
      echo 
    "<td>" $row['niit_une'] . "</td>";
       if (
    $row['user1'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user1'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user2'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user2'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      if (
    $row['user3'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user3'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user4'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user4'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
       if (
    $row['user5'] == '1'){echo "<td> confirmed </td>";} elseif ($row['user5'] == '2') {echo "<td> not confirmed </td>";} else{echo "<td>waiting</td>";}
      echo 
    "<td>" $row['zahailsan_date'] . "</td>";
      echo 
    "</tr>";
      }
    echo 
    "</table>";
    }}
    ?>        
    </body>
    </html>
    <?php
    }
    ?>
    btw where is the edit button?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •