[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: database.php 1969 2005-09-13 06:57:21Z drbyte $ 21 // 22 23 24 function zen_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { 25 global $db; 26 reset($data); 27 if ($action == 'insert') { 28 $query = 'insert into ' . $table . ' ('; 29 while (list($columns, ) = each($data)) { 30 $query .= $columns . ', '; 31 } 32 $query = substr($query, 0, -2) . ') values ('; 33 reset($data); 34 while (list(, $value) = each($data)) { 35 switch ((string)$value) { 36 case 'now()': 37 $query .= 'now(), '; 38 break; 39 case 'null': 40 $query .= 'null, '; 41 break; 42 default: 43 $query .= '\'' . zen_db_input($value) . '\', '; 44 break; 45 } 46 } 47 $query = substr($query, 0, -2) . ')'; 48 } elseif ($action == 'update') { 49 $query = 'update ' . $table . ' set '; 50 while (list($columns, $value) = each($data)) { 51 switch ((string)$value) { 52 case 'now()': 53 $query .= $columns . ' = now(), '; 54 break; 55 case 'null': 56 $query .= $columns .= ' = null, '; 57 break; 58 default: 59 $query .= $columns . ' = \'' . zen_db_input($value) . '\', '; 60 break; 61 } 62 } 63 $query = substr($query, 0, -2) . ' where ' . $parameters; 64 } 65 66 return $db->Execute($query); 67 } 68 69 function zen_db_insert_id() { 70 return mysql_insert_id(); 71 } 72 73 function zen_db_output($string) { 74 return htmlspecialchars($string); 75 } 76 77 function zen_db_input($string) { 78 return addslashes($string); 79 } 80 81 function zen_db_prepare_input($string) { 82 if (is_string($string)) { 83 return trim(stripslashes($string)); 84 } elseif (is_array($string)) { 85 reset($string); 86 while (list($key, $value) = each($string)) { 87 $string[$key] = zen_db_prepare_input($value); 88 } 89 return $string; 90 } else { 91 return $string; 92 } 93 } 94 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |