[ PHPXref.com ] [ Generated: Sun Jul 20 19:30:10 2008 ] [ Photo Organizer 2.30 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/src/ -> flash.add.2.php (source)

   1  <?php
   2  
   3  //  Copyright (C) 2002, 2003, 2004, 2005, 2006 Balint Kis (balint@k-i-s.net)
   4  
   5  //  This program is free software; you can redistribute it and/or modify
   6  //  it under the terms of the GNU General Public License as published by
   7  //  the Free Software Foundation; either version 2 of the License, or
   8  //  (at your option) any later version.
   9  
  10  //  This program is distributed in the hope that it will be useful,
  11  //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  //  GNU General Public License for more details.
  14  
  15  //  You should have received a copy of the GNU General Public License
  16  //  along with this program; if not, write to the Free Software
  17  //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  18  
  19  include_once  "include/vars.php";
  20  include_once  "include/config.php";
  21  include_once  "include/profile.php";
  22  include_once  "include/database.php";
  23  include_once "$theme/theme.php";
  24  
  25  $session_id = $_COOKIE[$po_cookie];
  26  if ($session_id == "") {
  27    header("location: login.php");
  28    exit();
  29  }
  30  
  31  include_once  "include/calendar.php";
  32  
  33  function add_flash($database, $user_id,
  34                    $flash_type_id, $flash_manufacturer_id, $flash_model, $flash_variation,
  35                    $flash_serial_number, $flash_purchase_timestamp,
  36                    $flash_purchased_new, $flash_access_rights) {
  37  
  38    $flash_date_of_purchase = check_date_validity($flash_purchase_timestamp);
  39  
  40    $flash_model = pg_escape_string($flash_model);
  41    $flash_variation = pg_escape_string($flash_variation);
  42    $flash_serial_number = pg_escape_string($flash_serial_number);
  43  
  44    if ($flash_type_id=='custom') {
  45      $new_flash_type_id = pg_fetch_row(pg_query($database, "select nextval('flash_type_id_sequence')"));
  46      $flash_type_id = $new_flash_type_id[0];
  47      $result = pg_query($database, "insert into flash_type (identifier, manufacturer, model, variation, last_modified_date, last_modifying_users)
  48                                     values ($flash_type_id, $flash_manufacturer_id, '$flash_model', '$flash_variation', now(), $user_id)");
  49      if (!$result) {
  50        print "Failed to create new flash type";
  51        return;
  52      }
  53    }
  54  
  55    $result = pg_query($database, "insert into flash (identifier, type, users, serial_number, date_of_purchase, purchased_new, access_rights)
  56                                   values (nextval('flash_id_sequence'), '$flash_type_id', '$user_id', '$flash_serial_number', $flash_date_of_purchase, '$flash_purchased_new', '$flash_access_rights')");
  57    if (!$result) {
  58      print "Failed to create new flash";
  59    }
  60  }
  61  
  62  $database   = po_dbconnect();
  63  $my_user_id = pg_fetch_row(pg_query($database, "select identifier from users where session_id='$session_id'"));
  64  if ($my_user_id[0] == "") {
  65    pg_close($database);
  66    header("location: login.php");
  67    exit();
  68  }
  69  
  70  add_flash($database, $my_user_id[0], $_REQUEST['flash_type_id'], $_REQUEST['flash_manufacturer_id'], $_REQUEST['flash_model'], $_REQUEST['flash_variation'],
  71            $_REQUEST['flash_serial_number'], $_REQUEST['flash_purchase_timestamp'], $_REQUEST['flash_purchased_new'], $_REQUEST['flash_access_rights']);
  72  pg_close($database);
  73  
  74  header("location: my.profile.php?selector=".$profile_data['flash']['idx']);
  75  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]