TUTOS PHP Cross Reference Groupware Applications

Source: /php/database_ins.php - 100 lines - 2885 bytes - Summary - Text - Print

Description: Copyright 2001 - 2013 by Gero Kohnert This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

   1  <?php
   2  /**
   3   *  Copyright 2001 - 2013 by Gero Kohnert
   4   *
   5   *  This program is free software; you can redistribute it and/or modify it
   6   *  under the terms of the GNU General Public License as published by the
   7   *  Free Software Foundation; version 2 of the License.
   8   *
   9   */
  10  $tutos['files'][__FILE__] = '$Rev: 1201 $';
  11  
  12  require_once  'webelements.p3';
  13  require_once  'permission.p3';
  14  
  15  /* Check if user is allowed to use it */
  16  check_user();
  17  loadmodules('database','ins');
  18  
  19  $gotourl = 'database_new.php';
  20  $msg     = '';
  21  $info    = '';
  22  
  23  $obj = new database($dbconn);
  24  if ( isset($_POST['Xid']) ) {
  25      $obj = $obj->read($_POST['Xid'],$obj);
  26      $gotourl= addUrlParameter($gotourl,"id=". $obj->id,true);
  27  }
  28  
  29  if ( !isset($_POST['name']) || (trim($_POST['name']) == '') ) {
  30      $msg = addLine($msg,sprintf($lang['Err0009'],$lang['AdminDBName']));
  31  } else {
  32      $name = trim($_POST['name']);
  33      $gotourl = addUrlParameter($gotourl,"name=". UrlEncode($name),true);
  34      $obj->SetName($name);
  35  }
  36  
  37  if ( isset($_POST['type']) ) {
  38      $type = trim($_POST['type']);
  39      $gotourl = addUrlParameter($gotourl,"type=". UrlEncode($type),true);
  40      $obj->setType($type);
  41  }
  42  if ( isset($_POST['alias']) ) {
  43      $alias = trim($_POST['alias']);
  44      $gotourl = addUrlParameter($gotourl,"alias=". UrlEncode($alias),true);
  45      $obj->SetAlias($alias);
  46  }
  47  if ( isset($_POST['prefix']) ) {
  48      $prefix = trim($_POST['prefix']);
  49      $gotourl = addUrlParameter($gotourl,"prefix=". UrlEncode($prefix),true);
  50      $obj->SetPrefix($prefix);
  51  }
  52  if ( isset($_POST['host']) ) {
  53      $host = trim($_POST['host']);
  54      $gotourl = addUrlParameter($gotourl,"host=". UrlEncode($host),true);
  55      $obj->SetHost($host);
  56  }
  57  if ( isset($_POST['port']) ) {
  58      $port = trim($_POST['port']);
  59      $gotourl = addUrlParameter($gotourl,"port=". UrlEncode($port),true);
  60      $obj->SetPort($port);
  61  }
  62  if ( isset($_POST['user']) ) {
  63      $user = trim($_POST['user']);
  64      $gotourl = addUrlParameter($gotourl,"user=". UrlEncode($user),true);
  65      $obj->SetUser($user);
  66  }
  67  if ( isset($_POST['pass']) ) {
  68      $pass = trim($_POST['pass']);
  69      $gotourl = addUrlParameter($gotourl,"pass=". UrlEncode($pass),true);
  70      $obj->SetPass($pass);
  71  }
  72  if ( isset($_POST['home']) ) {
  73      $home = trim($_POST['home']);
  74      $gotourl = addUrlParameter($gotourl,"home=". UrlEncode($home),true);
  75      $obj->SetHome($home);
  76  }
  77  if ( isset($_POST['rep']) ) {
  78      $rep = trim($_POST['rep']);
  79      $gotourl = addUrlParameter($gotourl,"rep=". UrlEncode($rep),true);
  80      $obj->setRepository($rep);
  81  }
  82  //
  83  // other modules
  84  //
  85  $msg = addLine($msg,module_parseforms($current_user,$obj,$gotourl));
  86  
  87  if ( $msg == "" ) {
  88      $dbconn->Begin("WORK");
  89      $msg = addLine($msg,$obj->save());
  90      $dbconn->Commit("WORK");
  91  
  92      $gotourl = $obj->getURL();
  93  }
  94  
  95  leave_insert($dbconn,$gotourl,$msg,$info);
  96  /**
  97   *  SVN Info  $Id: database_ins.php 1201 2013-12-14 11:43:49Z gokohnert $
  98   *  $Author: gokohnert $
  99   */
 100  ?>

title

Description

title

Description

title

Description

title

title

Body