| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* @package Content-management
|
|
|
5 |
* @author Lars Tiefland <tiefland@weban.de>
|
|
|
6 |
* @copyright 2009 Webagentur Niewerth
|
|
|
7 |
* @license propietary
|
|
|
8 |
* @version $Rev: 3931 $
|
|
|
9 |
* @filesource
|
|
|
10 |
*
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
*
|
|
|
15 |
* @package Content-management
|
|
|
16 |
* @author Lars Tiefland <tiefland@weban.de>
|
|
|
17 |
* @copyright 2009 Webagentur Niewerth
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
// SVN: $Id: change_lieferadresse.php 3931 2011-09-16 08:17:57Z tiefland $
|
|
|
21 |
|
|
|
22 |
require_once "../Online-Shop/connect2.php";
|
|
|
23 |
require_once "Weban_Smarty.class.php";
|
|
|
24 |
$GLOBALS["ui"] = new Weban_Smarty();
|
|
|
25 |
$GLOBALS["ui"]->compile_dir = $_SERVER["DOCUMENT_ROOT"] . "/templates_c/";
|
|
|
26 |
$GLOBALS["ui"]->compile_id = "Warenwirtschaft|bestellungen";
|
|
|
27 |
$GLOBALS["ui"]->use_sub_dirs = true;
|
|
|
28 |
|
|
|
29 |
$anreden = array( -1 => "--- Bitte wählen! --- ", 1 => "Herr", 2 =>
|
|
|
30 |
"Frau", 3 => "Firma" );
|
|
|
31 |
|
|
|
32 |
$Laender = array( "Deutschland", "Niederlande", "Österreich",
|
|
|
33 |
"Belgien", "Luxemburg", "Dänemark", "Schweiz", "Frankreich",
|
|
|
34 |
"Großbritannien", "Italien", "Spanien", "Portugal", "Schweden",
|
|
|
35 |
"Finnland", "Norwegen", "Irland", "Griechenland", "Estland",
|
|
|
36 |
"Lettland", "Malta", "Litauen", "Polen", "Slowenien",
|
|
|
37 |
"Tschechien/Slowakei", "Türkei", "Ungarn", "Zypern", "Kanada",
|
|
|
38 |
"USA", "Kroatien", "Bulgarien", "Rumänien" );
|
|
|
39 |
$countries["-1"] = "--- Bitte wählen! --- ";
|
|
|
40 |
foreach ( $Laender as $counter => $Land )
|
|
|
41 |
{
|
|
|
42 |
$code = 1 << $counter;
|
|
|
43 |
$countries[$code] = $Land;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
if ( $_POST )
|
|
|
47 |
{
|
|
|
48 |
foreach ( $_POST as $key => $val )
|
|
|
49 |
{
|
|
|
50 |
if ( preg_match( "/^liefer_/i", $key ) )
|
|
|
51 |
{
|
|
|
52 |
switch ( $key )
|
|
|
53 |
{
|
|
|
54 |
case "liefer_Anrede":
|
|
|
55 |
$val = $anreden[$val];
|
|
|
56 |
break;
|
|
|
57 |
case "liefer_Land":
|
|
|
58 |
$val = $countries[$val];
|
|
|
59 |
break;
|
|
|
60 |
}
|
|
|
61 |
$arr[] = $key . '="' . $val . '"';
|
|
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
$msg = "Lieferadresse von " . $_SERVER["PHP_AUTH_USER"] . " am " .
|
|
|
65 |
date( "d.m.Y" ) . " um " . date( "H:i" ) . " Uhr geändert\n";
|
|
|
66 |
$sql = "
|
|
|
67 |
UPDATE
|
|
|
68 |
Bestellung
|
|
|
69 |
SET
|
|
|
70 |
" . implode( ", ", $arr ) . ",
|
|
|
71 |
Bemerkung=CONCAT(Bemerkung,'" . mysql_real_escape_string( $msg ) .
|
|
|
72 |
"')
|
|
|
73 |
WHERE
|
|
|
74 |
ID=" . $_POST["b_id"] . "
|
|
|
75 |
";
|
|
|
76 |
$res = mysql_query( $sql );
|
|
|
77 |
?>
|
|
|
78 |
<script>
|
|
|
79 |
opener.location.reload();
|
|
|
80 |
self.close();
|
|
|
81 |
</script>
|
|
|
82 |
<?php
|
|
|
83 |
}
|
|
|
84 |
else
|
|
|
85 |
{
|
|
|
86 |
$sql = "
|
|
|
87 |
SELECT
|
|
|
88 |
*
|
|
|
89 |
FROM
|
|
|
90 |
Bestellung
|
|
|
91 |
WHERE
|
|
|
92 |
ID=" . $_GET["b_id"] . "
|
|
|
93 |
";
|
|
|
94 |
$res = mysql_query( $sql );
|
|
|
95 |
$row = mysql_fetch_assoc( $res );
|
|
|
96 |
$GLOBALS["ui"]->assign( "Liefer_Adresse", $row );
|
|
|
97 |
|
|
|
98 |
$GLOBALS["ui"]->assign( "land", array_search( $row["liefer_Land"], $countries ) );
|
|
|
99 |
$GLOBALS["ui"]->assign( "Laender", $countries );
|
|
|
100 |
$GLOBALS["ui"]->assign( "anreden", $anreden );
|
|
|
101 |
$GLOBALS["ui"]->assign( "anrede", array_search( $row["liefer_Anrede"], $anreden ) );
|
|
|
102 |
$GLOBALS["ui"]->assign( "b_id", $_GET["b_id"] );
|
|
|
103 |
$GLOBALS["ui"]->display( "change_lieferadresse.tpl" );
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
?>
|