2 // $Id: confedit.php 2009/02/10 14:41:30 hli Exp $
3 if (!isset($_SERVER['PHP_AUTH_USER'])) {
4 Header("WWW-Authenticate: Basic realm=\"Configurations-Editor\"");
5 Header("HTTP/1.0 401 Unauthorized");
6 echo "Sie müssen sich autentifizieren\n";
9 $login=($_GET["login"])?$_GET["login"]:$_POST["login"];
10 if (file_exists ("conf$login.php")) {
11 require "conf$login.php";
15 if ($_SERVER['PHP_AUTH_USER']<>$ERPftpuser || $_SERVER['PHP_AUTH_PW']<>$ERPftppwd) {
16 Header("WWW-Authenticate: Basic realm=\"My Realm\"");
17 Header("HTTP/1.0 401 Unauthorized");
18 echo "Sie müssen sich autentifizieren\n";
21 require_once "DB.php";
24 $sql="select name from units order by sortkey";
25 $pgs=$dbP->getall($sql);
26 if ($sel=='') $sel=$pgs[0][0];
27 if ($pgs) foreach ($pgs as $row) {
28 echo "\t<option value=".$row[0];
29 if ($sel==$row[0]) echo " selected";
30 echo ">".$row[0]."\n";
35 $sql="select id,pricegroup from pricegroup";
36 $pgs=$dbP->getall($sql);
37 echo "\t<option value=0";
38 if ($sel==0) echo " selected";
39 echo ">Standard VK\n";
40 if ($pgs) foreach ($pgs as $row) {
41 echo "\t<option value=".$row[0];
42 if ($sel==$row[0]) echo " selected";
43 echo ">".$row[1]."\n";
46 if ($_POST["ok"]=="sichern") {
50 'username' => $_POST["ERPuser"],
51 'password' => $_POST["ERPpass"],
52 'hostspec' => $_POST["ERPhost"],
53 'database' => $_POST["ERPdbname"],
54 'port' => $_POST["ERPport"]
56 $dbP=@DB::connect($dsnP);
57 if (DB::isError($dbP)||!$dbP) {
59 echo "Keine Verbindung zur ERP<br>";
64 $sql="SELECT id,description,buchungsgruppen_id FROM parts where partnumber = '%s'";
65 $rs=$dbP->getall(sprintf($sql,$_POST["div16NR"]));
66 $_POST["div16ID"]=$rs[0][0];
67 $div16txt=addslashes($rs[0][1]);
68 $rs=$dbP->getall(sprintf($sql,$_POST["div07NR"]));
69 $_POST["div07ID"]=$rs[0][0];
70 $div07txt=addslashes($rs[0][1]);
71 $rs=$dbP->getall(sprintf($sql,$_POST["versandNR"]));
72 $_POST["versandID"]=$rs[0][0];
73 $versandtxt=addslashes($rs[0][1]);
74 $rs=$dbP->getall(sprintf($sql,$_POST["nachnNR"]));
75 $_POST["nachnID"]=$rs[0][0];
76 $nachntxt=addslashes($rs[0][1]);
77 $rs=$dbP->getall(sprintf($sql,$_POST["minderNR"]));
78 $_POST["minderID"]=$rs[0][0];
79 $mindertxt=addslashes($rs[0][1]);
80 $rs=$dbP->getall(sprintf($sql,$_POST["paypalNR"]));
81 $_POST["paypalID"]=$rs[0][0];
82 $paypaltxt=addslashes($rs[0][1]);
83 $rs=$dbP->getall(sprintf($sql,$_POST["treuhNR"]));
84 $_POST["treuhID"]=$rs[0][0];
85 $treuhtxt=addslashes($rs[0][1]);
86 $rs=$dbP->getall("select id from employee where login = '".$_POST["ERPusrN"]."'");
87 $_POST["ERPusrID"]=$rs[0][0];
91 'username' => $_POST["SHOPuser"],
92 'password' => $_POST["SHOPpass"],
93 'hostspec' => $_POST["SHOPhost"],
94 'database' => $_POST["SHOPdbname"],
95 'port' => $_POST["SHOPport"]
97 $dbM=@DB::connect($dsnM);
98 if (DB::isError($dbM)||!$dbM) {
100 echo "Keine Verbindung zum Shop<br>";
105 $f=fopen("conf$login.php","w");
107 $d=date("Y/m/d H:i:s");
108 fputs($f,"<?\n// Verbindung zur ERP-db\n");
109 fputs($f,"\$ERPuser=\"".$_POST["ERPuser"]."\";\n");
110 fputs($f,"\$ERPpass=\"".$_POST["ERPpass"]."\";\n");
111 fputs($f,"\$ERPhost=\"".$_POST["ERPhost"]."\";\n");
112 fputs($f,"\$ERPdbname=\"".$_POST["ERPdbname"]."\";\n");
113 fputs($f,"\$ERPdns=\"pgsql://\$ERPuser:\$ERPpass@\$ERPhost/\$ERPdbname\";\n");
114 fputs($f,"\$ERPusr[\"Name\"]=\"".$_POST["ERPusrN"]."\";\n");
115 fputs($f,"\$ERPusr[\"ID\"]=\"".$_POST["ERPusrID"]."\";\n");
116 fputs($f,"\$ERPdir=\"".$_POST["ERPdir"]."\";\n");
117 fputs($f,"\$ERPimgdir=\"".$_POST["ERPimgdir"]."\";\n");
118 fputs($f,"\$maxSize=\"".$_POST["maxSize"]."\";\n");
119 fputs($f,"\$ERPftphost=\"".$_POST["ERPftphost"]."\";\n");
120 fputs($f,"\$ERPftpuser=\"".$_POST["ERPftpuser"]."\";\n");
121 fputs($f,"\$ERPftppwd=\"".$_POST["ERPftppwd"]."\";\n");
122 fputs($f,"//Verbindung zur osCommerce-db\n");
123 fputs($f,"\$SHOPuser=\"".$_POST["SHOPuser"]."\";\n");
124 fputs($f,"\$SHOPpass=\"".$_POST["SHOPpass"]."\";\n");
125 fputs($f,"\$SHOPhost=\"".$_POST["SHOPhost"]."\";\n");
126 fputs($f,"\$SHOPdbname=\"".$_POST["SHOPdbname"]."\";\n");
127 fputs($f,"\$SHOPdns=\"mysql://\$SHOPuser:\$SHOPpass@\$SHOPhost/\$SHOPdbname\";\n");
128 fputs($f,"\$SHOPdir=\"".$_POST["SHOPdir"]."\";\n");
129 fputs($f,"\$SHOPimgdir=\"".$_POST["SHOPimgdir"]."\";\n");
130 fputs($f,"\$SHOPftphost=\"".$_POST["SHOPftphost"]."\";\n");
131 fputs($f,"\$SHOPftpuser=\"".$_POST["SHOPftpuser"]."\";\n");
132 fputs($f,"\$SHOPftppwd=\"".$_POST["SHOPftppwd"]."\";\n");
133 fputs($f,"\$div16[\"ID\"]=\"".$_POST["div16ID"]."\";\n");
134 fputs($f,"\$div07[\"ID\"]=\"".$_POST["div07ID"]."\";\n");
135 fputs($f,"\$versand[\"ID\"]=\"".$_POST["versandID"]."\";\n");
136 fputs($f,"\$nachn[\"ID\"]=\"".$_POST["nachnID"]."\";\n");
137 fputs($f,"\$minder[\"ID\"]=\"".$_POST["minderID"]."\";\n");
138 fputs($f,"\$treuh[\"ID\"]=\"".$_POST["treuhID"]."\";\n");
139 fputs($f,"\$paypal[\"ID\"]=\"".$_POST["paypalID"]."\";\n");
140 fputs($f,"\$div16[\"NR\"]=\"".$_POST["div16NR"]."\";\n");
141 fputs($f,"\$div07[\"NR\"]=\"".$_POST["div07NR"]."\";\n");
142 fputs($f,"\$versand[\"NR\"]=\"".$_POST["versandNR"]."\";\n");
143 fputs($f,"\$nachn[\"NR\"]=\"".$_POST["nachnNR"]."\";\n");
144 fputs($f,"\$minder[\"NR\"]=\"".$_POST["minderNR"]."\";\n");
145 fputs($f,"\$treuh[\"NR\"]=\"".$_POST["treuhNR"]."\";\n");
146 fputs($f,"\$paypal[\"NR\"]=\"".$_POST["paypalNR"]."\";\n");
147 fputs($f,"\$div16[\"TXT\"]=\"".$div16txt."\";\n");
148 fputs($f,"\$div07[\"TXT\"]=\"".$div07txt."\";\n");
149 fputs($f,"\$versand[\"TXT\"]=\"".$versandtxt."\";\n");
150 fputs($f,"\$nachn[\"TXT\"]=\"".$nachntxt."\";\n");
151 fputs($f,"\$minder[\"TXT\"]=\"".$mindertxt."\";\n");
152 fputs($f,"\$treuh[\"TXT\"]=\"".$treuhtxt."\";\n");
153 fputs($f,"\$paypal[\"TXT\"]=\"".$paypaltxt."\";\n");
154 fputs($f,"\$bgcol[1]=\"#ddddff\";\n");
155 fputs($f,"\$bgcol[2]=\"#ddffdd\";\n");
156 fputs($f,"\$preA=\"".$_POST["preA"]."\";\n");
157 fputs($f,"\$preK=\"".$_POST["preK"]."\";\n");
158 fputs($f,"\$auftrnr=\"".$_POST["auftrnr"]."\";\n");
159 fputs($f,"\$utftrans=\"".$_POST["utftrans"]."\";\n");
160 fputs($f,"\$kdnum=\"".$_POST["kdnum"]."\";\n");
161 fputs($f,"\$mwst=\"".$_POST["mwst"]."\";\n");
162 fputs($f,"\$pricegroup=\"".$_POST["pricegroup"]."\";\n");
163 fputs($f,"\$unit=\"".$_POST["unit"]."\";\n");
164 fputs($f,"\$showErr=\"true\";\n");
169 $ERPuser=$_POST["ERPuser"];
170 $ERPpass=$_POST["ERPpass"];
171 $ERPhost=$_POST["ERPhost"];
172 $ERPdbname=$_POST["ERPdbname"];
173 $ERPusrN=$_POST["ERPusrN"];
174 $ERPdir=$_POST["ERPdir"];
175 $ERPimgdir=$_POST["ERPimgdir"];
176 $maxSize=$_POST["maxSize"];
177 $ERPftphost=$_POST["ERPftphost"];
178 $ERPftpuser=$_POST["ERPftpuser"];
179 $ERPftppwd=$_POST["ERPftppwd"];
180 $SHOPuser=$_POST["SHOPuser"];
181 $SHOPpass=$_POST["SHOPpass"];
182 $SHOPhost=$_POST["SHOPhost"];
183 $SHOPdbname=$_POST["SHOPdbname"];
184 $SHOPdir=$_POST["SHOPdir"];
185 $SHOPimgdir=$_POST["SHOPimgdir"];
186 $SHOPftphost=$_POST["SHOPftphost"];
187 $SHOPftpuser=$_POST["SHOPftpuser"];
188 $SHOPftppwd=$_POST["SHOPftppwd"];
189 $div16NR=$_POST["div16NR"];
190 $div07NR=$_POST["div07NR"];
191 $versandNR=$_POST["versandNR"];
192 $nachnNR=$_POST["nachnNR"];
193 $treuhNR=$_POST["treuhNR"];
194 $minderNR=$_POST["minderNR"];
195 $paypalNR=$_POST["paypalNR"];
196 $preA=$_POST["preA"];
197 $preK=$_POST["preK"];
198 $mwst=empty($_POST["mwst"])?1:$_POST["mwst"];
199 $kdnum=$_POST["kdnum"];
200 $pricegroup=$_POST["pricegroup"];
201 $unit=$_POST["unit"];
202 $auftrnr=$_POST["auftrnr"];
203 $utftrans=$_POST["utftrans"];
206 if (file_exists ("conf$login.php")) {
207 require "conf$login.php";
212 'phptype' => 'pgsql',
213 'username' => $ERPuser,
214 'password' => $ERPpass,
215 'hostspec' => $ERPhost,
216 'database' => $ERPdbname,
219 $dbP=@DB::connect($dsnP);
220 if (DB::isError($dbP)||!$dbP) {
221 echo "Keine Verbindung zur ERP<br>";
223 //echo $dbP->userinfo;
230 <table style="background-color:#cccccc" border="0">
231 <form name="ConfEdit" method="post" action="confedit.php">
232 <input type="hidden" name="div16ID" value="<?= $div16["ID"] ?>">
233 <input type="hidden" name="div07ID" value="<?= $div07["ID"] ?>">
234 <input type="hidden" name="minderID" value="<?= $minder["ID"] ?>">
235 <input type="hidden" name="versandID" value="<?= $versand["ID"] ?>">
236 <input type="hidden" name="nachnID" value="<?= $nachn["ID"] ?>">
237 <input type="hidden" name="paypalID" value="<?= $paypal["ID"] ?>">
238 <input type="hidden" name="treuhID" value="<?= $treuh["ID"] ?>">
239 <input type="hidden" name="ERPusrID" value="<?= $ERPusr["ID"] ?>">
241 <tr><th>Daten</th><th>Lx-ERP</th><th></th><th>Shop</th></tr>
244 <td colspan="2"><input type="text" name="ERPhost" size="25" value="<?= $ERPhost ?>"></td>
245 <td><input type="text" name="SHOPhost" size="25" value="<?= $SHOPhost ?>"></td>
249 <td colspan="2"><input type="text" name="ERPdbname" size="20" value="<?= $ERPdbname ?>"></td>
250 <td><input type="text" name="SHOPdbname" size="20" value="<?= $SHOPdbname ?>"></td>
253 <td>db-User Name</td>
254 <td colspan="2"><input type="text" name="ERPuser" size="15" value="<?= $ERPuser ?>"></td>
255 <td><input type="text" name="SHOPuser" size="15" value="<?= $SHOPuser ?>"></td>
259 <td colspan="2"><input type="text" name="ERPpass" size="15" value="<?= $ERPpass ?>"></td>
260 <td><input type="text" name="SHOPpass" size="15" value="<?= $SHOPpass ?>"></td>
263 <td>UTF8-Transl.</td>
264 <td colspan="2"><input type="checkbox" name="utftrans" <?= (empty($utftrans)?"":"checked") ?>></td>
265 <td>Preise <input type="radio" name="mwst" value="1" <?= ($mwst==1)?"checked":"" ?>> incl.
266 <input type="radio" name="mwst" value="0" <?= ($mwst<>1)?"checked":"" ?>> excl. MwSt</td>
270 <td colspan="2"><input type="text" name="ERPusrN" size="10" value="<?= $ERPusr["Name"] ?>">
271 <input type="checkbox" name="a1" <?= (empty($ERPusr["ID"])?"":"checked") ?>></td>
276 <td colspan="2"><input type="text" name="ERPdir" size="30" value="<?= $ERPdir ?>"></td>
277 <td><input type="text" name="SHOPdir" size="30" value="<?= $SHOPdir ?>"></td>
281 <td colspan="2"><input type="text" name="ERPimgdir" size="30" value="<?= $ERPimgdir ?>"></td>
282 <td><input type="text" name="SHOPimgdir" size="30" value="<?= $SHOPimgdir ?>"></td>
286 <td colspan="2"><input type="text" name="ERPftphost" size="20" value="<?= $ERPftphost ?>"></td>
287 <td><input type="text" name="SHOPftphost" size="20" value="<?= $SHOPftphost ?>"></td>
291 <td colspan="2"><input type="text" name="ERPftpuser" size="15" value="<?= $ERPftpuser ?>"></td>
292 <td><input type="text" name="SHOPftpuser" size="15" value="<?= $SHOPftpuser ?>"></td>
295 <td>FTP-User PWD</td>
296 <td colspan="2"><input type="text" name="ERPftppwd" size="15" value="<?= $ERPftppwd ?>"></td>
297 <td><input type="text" name="SHOPftppwd" size="15" value="<?= $SHOPftppwd ?>"></td>
300 <td>ID Diverse 16%</td>
301 <td><input type="text" name="div16NR" size="10" value="<?= $div16["NR"] ?>">
302 <input type="checkbox" name="a1" <?= (empty($div16["ID"])?"":"checked") ?>></td>
303 <td>ID Diverse 7%</td>
304 <td><input type="text" name="div07NR" size="10" value="<?= $div07["NR"] ?>">
305 <input type="checkbox" name="a1" <?= (empty($div07["ID"])?"":"checked") ?>></td>
309 <td><input type="text" name="versandNR" size="10" value="<?= $versand["NR"] ?>">
310 <input type="checkbox" name="a1" <?= (empty($versand["ID"])?"":"checked") ?>></td>
312 <td><input type="text" name="nachnNR" size="10" value="<?= $nachn["NR"] ?>">
313 <input type="checkbox" name="a1" <?= (empty($nachn["ID"])?"":"checked") ?>></td>
317 <td><input type="text" name="paypalNR" size="10" value="<?= $paypal["NR"] ?>">
318 <input type="checkbox" name="a1" <?= (empty($paypal["ID"])?"":"checked") ?>></td>
320 <td><input type="text" name="treuhNR" size="10" value="<?= $treuh["NR"] ?>">
321 <input type="checkbox" name="a1" <?= (empty($treuh["ID"])?"":"checked") ?>></td>
324 <td>ID Mindermenge</td>
325 <td><input type="text" name="minderNR" size="10" value="<?= $minder["NR"] ?>">
326 <input type="checkbox" name="a1" <?= (empty($minder["ID"])?"":"checked") ?>></td>
331 <td><select name="unit">
335 <td><select name="pricegroup">
336 <? pg($pricegroup); ?>
339 <td colspan="2">Auftragsnummern durch</td>
340 <td><input type="radio" name="auftrnr" value="1" <?= ($auftrnr==1)?"checked":"" ?>> LxO</td>
341 <td><input type="radio" name="auftrnr" value="0" <?= ($auftrnr<>1)?"checked":"" ?>> Shop</td>
344 <td colspan="2">Kundennummern durch</td>
345 <td><input type="radio" name="kdnum" value="1" <?= ($kdnum==1)?"checked":"" ?>> LxO</td>
346 <td><input type="radio" name="kdnum" value="0" <?= ($kdnum<>1)?"checked":"" ?>> Shop</td>
349 <td colspan="2">Nummernerweiterung</td>
350 <td>Auftrag<input type="text" name="preA" size="5" value="<?= $preA ?>"></td>
351 <td>Kunde<input type="text" name="preK" size="5" value="<?= $preK ?>"></td>
354 <td>Bildergrösse (byte)</td>
355 <td><input type="text" name="maxSize" size="10" value="<?= $maxSize ?>"></td>
362 <tr><td colspan="4" align="center"><input type="submit" name="ok" value="sichern"></td></tr>