home *** CD-ROM | disk | FTP | other *** search
/ PC Basics 53 / PC Basics Issue 53.iso / Software / Internet / Invboard.exe / PC Basics 53 / Invboard / upload / sources / Admin / ad_index.php < prev    next >
Encoding:
PHP Script  |  2002-06-12  |  6.3 KB  |  204 lines

  1. <?php
  2.  
  3. /*
  4. +--------------------------------------------------------------------------
  5. |   IBFORUMS v1
  6. |   ========================================
  7. |   by Matthew Mecham and David Baxter
  8. |   (c) 2001,2002 IBForums
  9. |   http://www.ibforums.com
  10. |   ========================================
  11. |   Web: http://www.ibforums.com
  12. |   Email: phpboards@ibforums.com
  13. |   Licence Info: phpib-licence@ibforums.com
  14. +---------------------------------------------------------------------------
  15. |
  16. |   > Admin "welcome" screen functions
  17. |   > Module written by Matt Mecham
  18. |   > Date started: 1st march 2002
  19. |
  20. |    > Module Version Number: 1.0.0
  21. +--------------------------------------------------------------------------
  22. */
  23.  
  24.  
  25.  
  26.  
  27. $idx = new index_page();
  28.  
  29.  
  30. class index_page {
  31.  
  32.  
  33.     function index_page() {
  34.         global $DB, $IN, $INFO, $ADMIN, $SKIN, $std;
  35.         
  36.         $DB->query("SELECT * FROM ibf_stats");
  37.         
  38.         $row = $DB->fetch_row();
  39.         
  40.         if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
  41.         if ($row['TOTAL_TOPICS']  < 0) $row['TOTAL_TOPICS']  = 0;
  42.         if ($row['MEM_COUNT']     < 0) $row['MEM_COUNT']     = 0;
  43.         
  44.         $DB->query("SELECT COUNT(*) as reg FROM ibf_members WHERE mgroup='".$INFO['auth_group']."' AND (new_pass='' or new_pass IS NULL)");
  45.         $reg = $DB->fetch_row();
  46.         
  47.         if ($reg['reg'] < 1 ) $reg['reg'] = 0;
  48.         
  49.         //-------------------------------------------------
  50.         // Make sure the uploads path is correct
  51.         //-------------------------------------------------
  52.         
  53.         $uploads_size = 0;
  54.         
  55.         if ($dh = opendir( $INFO['upload_dir'] ))
  56.         {
  57.             while ( $file = readdir( $dh ) )
  58.             {
  59.                 if ( !preg_match( "/^..?$|^index/i", $file ) )
  60.                 {
  61.                     $uploads_size += @filesize( $INFO['upload_dir'] . "/" . $file );
  62.                 }
  63.             }
  64.             closedir( $dh );
  65.         }
  66.         
  67.         // This piece of code from Jesse's (jesse@jess.on.ca) contribution
  68.         // to the PHP manual @ php.net
  69.         
  70.         if ($uploads_size >= 1048576)
  71.         {
  72.             $uploads_size = round($uploads_size / 1048576 * 100 ) / 100 . " mb";
  73.         }
  74.         else if ($uploads_size >= 1024)
  75.         {
  76.             $uploads_size = round($uploads_size / 1024 * 100 ) / 100 . " k";
  77.         }
  78.         else
  79.         {
  80.             $uploads_size = $uploads_size . " bytes";
  81.         }
  82.         
  83.         //+-----------------------------------------------------------
  84.         
  85.         $ADMIN->html .= $SKIN->start_table( "Administrators using the CP" );
  86.         
  87.         $t_time = time() - 60*10;
  88.         
  89.         $DB->query("SELECT DISTINCT(MEMBER_NAME) FROM ibf_admin_sessions WHERE RUNNING_TIME > $t_time");
  90.         
  91.         $mem_array = array();
  92.         
  93.         while ( $r = $DB->fetch_row() )
  94.         {
  95.             $mem_array[] = $r['MEMBER_NAME'];
  96.         }
  97.         
  98.         $ADMIN->html .= $SKIN->add_td_basic( implode(", ", $mem_array ) );
  99.         
  100.         $ADMIN->html .= $SKIN->end_table();
  101.         
  102.         //+-----------------------------------------------------------
  103.         
  104.         $ADMIN->html .= $SKIN->add_td_spacer();
  105.         
  106.         //+-----------------------------------------------------------
  107.         
  108.         $SKIN->td_header[] = array( "Definition", "25%" );
  109.         $SKIN->td_header[] = array( "Value"     , "25%" );
  110.         $SKIN->td_header[] = array( "Definition", "25%" );
  111.         $SKIN->td_header[] = array( "Value"     , "25%" );
  112.         
  113.         $ADMIN->html .= $SKIN->start_table( "System Overview" );
  114.         
  115.         $ADMIN->html .= $SKIN->add_td_row( array( "Total Unique Topics" , $row['TOTAL_TOPICS'],
  116.                                                   "Total Replies to topics"         , $row['TOTAL_REPLIES']
  117.                                           )      );
  118.                                           
  119.         $ADMIN->html .= $SKIN->add_td_row( array( "Total Members" , $row['MEM_COUNT'], "Public Upload Folder Size", $uploads_size ) );
  120.         
  121.         $ADMIN->html .= $SKIN->add_td_row( array( "<a href='{$SKIN->base_url}&act=mem&code=mod'>Users awaiting validation</a>" , $reg['reg'],
  122.                                                   " ", " ",
  123.                                          )      );
  124.         
  125.         $ADMIN->html .= $SKIN->end_table();
  126.         
  127.         //+-----------------------------------------------------------
  128.         
  129.         $ADMIN->html .= $SKIN->add_td_spacer();
  130.         
  131.         //+-----------------------------------------------------------
  132.         
  133.         $ADMIN->html .= $SKIN->start_form();
  134.         
  135.         $SKIN->td_header[] = array( " "  , "40%" );
  136.         $SKIN->td_header[] = array( " "  , "30%" );
  137.         $SKIN->td_header[] = array( " "  , "30%" );
  138.         
  139.         $ADMIN->html .= $SKIN->start_table( "Quick Clicks" );
  140.         
  141.         $ADMIN->html .= "
  142.                 
  143.                     <script language='javascript'>
  144.                     <!--
  145.                       function edit_member() {
  146.                         
  147.                         if (document.forms[0].username.value == \"\") {
  148.                             alert(\"You must enter a username!\");
  149.                         } else {
  150.                             window.parent.body.location = '{$SKIN->base_url}' + '&act=mem&code=stepone&USER_NAME=' + escape(document.forms[0].username.value);
  151.                         }
  152.                       }
  153.                       
  154.                       function new_cat() {
  155.                         
  156.                         if (document.forms[0].cat_name.value == \"\") {
  157.                             alert(\"You must enter a category name!\");
  158.                         } else {
  159.                             window.parent.body.location = '{$SKIN->base_url}' + '&act=cat&code=new&name=' + escape(document.forms[0].cat_name.value);
  160.                         }
  161.                       }
  162.                       
  163.                       function new_forum() {
  164.                         
  165.                         if (document.forms[0].forum_name.value == \"\") {
  166.                             alert(\"You must enter a forum name!\");
  167.                         } else {
  168.                             window.parent.body.location = '{$SKIN->base_url}' + '&act=forum&code=new&name=' + escape(document.forms[0].forum_name.value);
  169.                         }
  170.                       }
  171.                     //-->
  172.                     
  173.                     </script>
  174.                     <form name='DOIT' action=''>
  175.                         
  176.         ";
  177.         
  178.         $ADMIN->html .= $SKIN->add_td_row( array( "Edit Member:",
  179.                                                   "<input type='text' style='width:100%' id='textinput' name='username' value='Enter name here' onfocus='this.value=\"\"'>",
  180.                                                   "<input type='button' value='Find Member' id='button' onClick='edit_member()'>"
  181.                                          )      );
  182.         
  183.         $ADMIN->html .= $SKIN->add_td_row( array( "Add New Category:",
  184.                                                   "<input type='text' style='width:100%' name='cat_name' id='textinput' value='Category title here' onfocus='this.value=\"\"'>",
  185.                                                   "<input type='button' value='Add Category' id='button' onClick='new_cat()'>"
  186.                                          )      );
  187.                                          
  188.         $ADMIN->html .= $SKIN->add_td_row( array( "Add New Forum:",
  189.                                                   "<input type='text' style='width:100%' name='forum_name' id='textinput' value='Forum title here' onfocus='this.value=\"\"'>",
  190.                                                   "<input type='button' value='Add Forum' id='button' onClick='new_forum()'>"
  191.                                          )      );
  192.         
  193.         $ADMIN->html .= "</form>";
  194.                                          
  195.         $ADMIN->html .= $SKIN->end_table();
  196.         
  197.         $ADMIN->output();
  198.         
  199.     }
  200.     
  201. }
  202.  
  203.  
  204. ?>