Phpstatus > Admin / Add Service.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Phpstatus

Download:
phpstatus.zip

Category:
Web Hosting Tools

Archive Content:

Phpstatus > Admin

Phpstatus

Phpstatus > Docs

Phpstatus > Includes

Phpstatus

Phpstatus > Install

Phpstatus > Language

Phpstatus

Phpstatus > Templates > Default > Admin

Phpstatus > Templates > Default

Phpstatus > Templates > Default > Images

Phpstatus > Templates > Default

Add Service.php:


<?php
/****************************************************************/
/*                         phpStatus                            */
/*                    add_service.php file                      */
/*                      (c)copyright 2003                       */
/*                       By hinton design                       */
/*                 http://www.hintondesign.org                  */
/*                  support <at> hintondesign <dot> org                    */
/*                                                              */
/* This program is free software. You can redistrabute it and/or*/
/* modify it under the terms of the GNU General Public Licence  */
/* as published by the Free Software Foundation; either version */
/* 2 of the license.                                            */
/*                                                              */
/****************************************************************/

define("PHPSTATUS_REAL_PATH", "./../");
include(
PHPSTATUS_REAL_PATH 'common.php');

if(
$HTTP_COOKIE_VARS['loged'] == 'yes') {
   if(
$HTTP_COOKIE_VARS['user_level'] == '1') {
      if((!
$HTTP_POST_VARS['port']) || (!$HTTP_POST_VARS['name'])) {
          
$display $lang['error_mess12'] . "<br>";
          if(!
$HTTP_POST_VARS['port']) {
             
$display .= $lang['port_number'] . "<br>";
          }
          if(!
$HTTP_POST_VARS['name']) {
             
$display .= $lang['port_name'] . "<br>";
          }
          include(
"header.php");
          
$template->getFile(array(
                             
'error' => 'admin/error.tpl')
          );
          
$template->add_vars(array(
                         
'L_ERROR' => $lang['error'],
                             
'DISPLAY' => $display)
          );
          
$template->parse("error");
          include(
"footer.php");
          exit();
      }

      
$sql "SELECT id FROM ".$prefix."_ports WHERE id='$HTTP_POST_VARS[id]'";
      
$result $db->query($sql);

      
$sql2 "SELECT name FROM ".$prefix."_ports WHERE name='$HTTP_POST_VARS[name]'";
      
$result2 $db->query($sql2);

      
$num $db->num($result);
      
$num2 $db->num($result2);

      if((
$num 0) || ($num2 0)) {
          
$display $lang['error_mess13'] . "<br>";
          if(
$num 0) {
             
$display .= $lang['error_mess14'] . "<br>";
             unset(
$HTTP_POST_VARS['port']);
          }
          if(
$num2 0) {
             
$display .= $lang['error_mess15'] . "<br>";
             unset(
$HTTP_POST_VARS['name']);
          }
          include(
"header.php");
          
$template->getFile(array(
                             
'error' => 'admin/error.tpl')
          );
          
$template->add_vars(array(
                         
'L_ERROR' => $lang['error'],
                             
'DISPLAY' => $display)
          );
          
$template->parse("error");
          include(
"footer.php");
          exit();
      }

      
$sql "INSERT INTO ".$prefix."_ports (id,  name) VALUES ('$HTTP_POST_VARS[port]',  '$HTTP_POST_VARS[name]')";
      
$result $db->query($sql);

      if(!
$result) {
         include(
"header.php");
         
$template->getFile(array(
                            
'error' => 'admin/error.tpl')
         );
         
$template->add_vars(array(
                        
'L_ERROR' => $lang['error'],
                            
'DISPLAY' => $lang['error_mess16'])
         );
         
$template->parse("error");
         include(
"footer.php");
         exit();
      } else {
         include(
"header.php");
         
$link "services.php";
         
$template->getFile(array(
                            
'success' => 'admin/success.tpl')
         );
         
$template->add_vars(array(
                        
'L_SUCCESS' => $lang['success'],
                            
'DISPLAY' => $lang['success_mess4'],
                            
'LINK' => $link)
         );
         
$template->parse("success");
         include(
"footer.php");
         exit();
      }
   } else {
      include(
"header.php");
      
$template->getFile(array(
                         
'error' => 'admin/error.tpl')
      );
      
$template->add_vars(array(
                         
'L_ERROR' => $lang['error'],
                         
'DISPLAY' => $lang['error_mess5'])
      );
      
$template->parse("error");
      include(
"footer.php");
      exit();
   }
} else {
   include(
"header.php");
   
$template->getFile(array(
                      
'error' => 'admin/error.tpl')
   );
   
$template->add_vars(array(
                      
'L_ERROR' => $lang['error'],
                      
'DISPLAY' => $lang['error_mess6'])
   );
   
$template->parse("error");
   include(
"footer.php");
   exit();
}
?>


Other Web Hosting Tools Scripts:

WebMaster Resources Home

©RingsWorld.com