Revision 56c3baae
Von Holger Lindemann vor fast 16 Jahren hinzugefügt
pepper/confedit.php | ||
---|---|---|
1 | 1 |
<? |
2 |
// $Id: confedit.php,v 0.10 2006/02/06 11:34:30 hli Exp $
|
|
2 |
// $Id: confedit.php 2009/02/10 14:41:30 hli Exp $
|
|
3 | 3 |
if (!isset($_SERVER['PHP_AUTH_USER'])) { |
4 | 4 |
Header("WWW-Authenticate: Basic realm=\"Configurations-Editor\""); |
5 | 5 |
Header("HTTP/1.0 401 Unauthorized"); |
6 | 6 |
echo "Sie müssen sich autentifizieren\n"; |
7 | 7 |
exit; |
8 | 8 |
} else { |
9 |
include "conf.php"; |
|
9 |
$login=($_GET["login"])?$_GET["login"]:$_POST["login"]; |
|
10 |
if (file_exists ("conf$login.php")) { |
|
11 |
require "conf$login.php"; |
|
12 |
} else { |
|
13 |
require "conf.php"; |
|
14 |
} |
|
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"; |
|
19 |
exit; |
|
20 |
} |
|
10 | 21 |
require_once "DB.php"; |
11 |
$db=@DB::connect($ERPdns); |
|
12 |
if (!DB::isError($db)) { |
|
13 |
$sql="select id,pricegroup from pricegroup"; |
|
14 |
$pgs=$db->getall($sql); |
|
22 |
function unit($sel) { |
|
23 |
global $dbP; |
|
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"; |
|
31 |
} |
|
15 | 32 |
} |
16 | 33 |
function pg($sel) { |
17 |
global $pgs; |
|
34 |
global $dbP; |
|
35 |
$sql="select id,pricegroup from pricegroup"; |
|
36 |
$pgs=$dbP->getall($sql); |
|
18 | 37 |
echo "\t<option value=0"; |
19 | 38 |
if ($sel==0) echo " selected"; |
20 | 39 |
echo ">Standard VK\n"; |
... | ... | |
24 | 43 |
echo ">".$row[1]."\n"; |
25 | 44 |
} |
26 | 45 |
} |
27 |
if ($_SERVER['PHP_AUTH_USER']<>$ERPftpuser || $_SERVER['PHP_AUTH_PW']<>$ERPftppwd) { |
|
28 |
Header("WWW-Authenticate: Basic realm=\"My Realm\""); |
|
29 |
Header("HTTP/1.0 401 Unauthorized"); |
|
30 |
echo "Sie müssen sich autentifizieren\n"; |
|
31 |
exit; |
|
32 |
} |
|
33 | 46 |
if ($_POST["ok"]=="sichern") { |
34 | 47 |
$ok=true; |
35 |
$dsnP="pgsql://".$_POST["ERPuser"].":".$_POST["ERPpass"]."@".$_POST["ERPhost"]."/".$_POST["ERPdbname"]; |
|
36 |
$dbP=DB::connect($dsnP); |
|
48 |
$dsnP = array( |
|
49 |
'phptype' => 'pgsql', |
|
50 |
'username' => $_POST["ERPuser"], |
|
51 |
'password' => $_POST["ERPpass"], |
|
52 |
'hostspec' => $_POST["ERPhost"], |
|
53 |
'database' => $_POST["ERPdbname"], |
|
54 |
'port' => $_POST["ERPport"] |
|
55 |
); |
|
56 |
$dbP=@DB::connect($dsnP); |
|
37 | 57 |
if (DB::isError($dbP)||!$dbP) { |
38 |
$ok=false;
|
|
39 |
echo "Keine Verbindung zur ERP<br>";
|
|
58 |
$ok=false; |
|
59 |
echo "Keine Verbindung zur ERP<br>"; |
|
40 | 60 |
echo $dbP->userinfo; |
61 |
$dbP=false; |
|
41 | 62 |
} |
42 | 63 |
else { |
43 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["div16NR"]."'"); |
|
64 |
$sql="SELECT id,description,buchungsgruppen_id FROM parts where partnumber = '%s'"; |
|
65 |
$rs=$dbP->getall(sprintf($sql,$_POST["div16NR"])); |
|
44 | 66 |
$_POST["div16ID"]=$rs[0][0]; |
45 |
$div16txt=$rs[0][1];
|
|
46 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["div07NR"]."'");
|
|
67 |
$div16txt=addslashes($rs[0][1]);
|
|
68 |
$rs=$dbP->getall(sprintf($sql,$_POST["div07NR"]));
|
|
47 | 69 |
$_POST["div07ID"]=$rs[0][0]; |
48 |
$div07txt=$rs[0][1];
|
|
49 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["versandNR"]."'");
|
|
70 |
$div07txt=addslashes($rs[0][1]);
|
|
71 |
$rs=$dbP->getall(sprintf($sql,$_POST["versandNR"]));
|
|
50 | 72 |
$_POST["versandID"]=$rs[0][0]; |
51 |
$versandtxt=$rs[0][1];
|
|
52 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["nachnNR"]."'");
|
|
73 |
$versandtxt=addslashes($rs[0][1]);
|
|
74 |
$rs=$dbP->getall(sprintf($sql,$_POST["nachnNR"]));
|
|
53 | 75 |
$_POST["nachnID"]=$rs[0][0]; |
54 |
$nachntxt=$rs[0][1];
|
|
55 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["minderNR"]."'");
|
|
76 |
$nachntxt=addslashes($rs[0][1]);
|
|
77 |
$rs=$dbP->getall(sprintf($sql,$_POST["minderNR"]));
|
|
56 | 78 |
$_POST["minderID"]=$rs[0][0]; |
57 |
$mindertxt=$rs[0][1];
|
|
58 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["paypalNR"]."'");
|
|
79 |
$mindertxt=addslashes($rs[0][1]);
|
|
80 |
$rs=$dbP->getall(sprintf($sql,$_POST["paypalNR"]));
|
|
59 | 81 |
$_POST["paypalID"]=$rs[0][0]; |
60 |
$paypaltxt=$rs[0][1];
|
|
61 |
$rs=$dbP->getall("select id,description from parts where partnumber = '".$_POST["treuhNR"]."'");
|
|
82 |
$paypaltxt=addslashes($rs[0][1]);
|
|
83 |
$rs=$dbP->getall(sprintf($sql,$_POST["treuhNR"]));
|
|
62 | 84 |
$_POST["treuhID"]=$rs[0][0]; |
63 |
$treuhtxt=$rs[0][1];
|
|
85 |
$treuhtxt=addslashes($rs[0][1]);
|
|
64 | 86 |
$rs=$dbP->getall("select id from employee where login = '".$_POST["ERPusrN"]."'"); |
65 | 87 |
$_POST["ERPusrID"]=$rs[0][0]; |
66 | 88 |
} |
67 |
$dsnM="mysql://".$_POST["SHOPuser"].":".$_POST["SHOPpass"]."@".$_POST["SHOPhost"]."/".$_POST["SHOPdbname"]; |
|
68 |
$dbM=DB::connect($dsnM); |
|
69 |
if (DB::isError($dbM)||!$dbM) { |
|
70 |
$ok=false; |
|
71 |
echo "Keine Verbindung zum Shop<br>"; |
|
89 |
$dsnM = array( |
|
90 |
'phptype' => 'mysql', |
|
91 |
'username' => $_POST["SHOPuser"], |
|
92 |
'password' => $_POST["SHOPpass"], |
|
93 |
'hostspec' => $_POST["SHOPhost"], |
|
94 |
'database' => $_POST["SHOPdbname"], |
|
95 |
'port' => $_POST["SHOPport"] |
|
96 |
); |
|
97 |
$dbM=@DB::connect($dsnM); |
|
98 |
if (DB::isError($dbM)||!$dbM) { |
|
99 |
//$ok=false; |
|
100 |
echo "Keine Verbindung zum Shop<br>"; |
|
72 | 101 |
echo $dbM->userinfo; |
73 |
}; |
|
102 |
$dbM=false; |
|
103 |
}; |
|
74 | 104 |
if (ok) { |
75 |
$f=fopen("conf.php","w"); |
|
105 |
$f=fopen("conf$login.php","w");
|
|
76 | 106 |
$v="1.5"; |
77 | 107 |
$d=date("Y/m/d H:i:s"); |
78 | 108 |
fputs($f,"<?\n// Verbindung zur ERP-db\n"); |
... | ... | |
126 | 156 |
fputs($f,"\$preA=\"".$_POST["preA"]."\";\n"); |
127 | 157 |
fputs($f,"\$preK=\"".$_POST["preK"]."\";\n"); |
128 | 158 |
fputs($f,"\$auftrnr=\"".$_POST["auftrnr"]."\";\n"); |
159 |
fputs($f,"\$utftrans=\"".$_POST["utftrans"]."\";\n"); |
|
129 | 160 |
fputs($f,"\$kdnum=\"".$_POST["kdnum"]."\";\n"); |
130 | 161 |
fputs($f,"\$pricegroup=\"".$_POST["pricegroup"]."\";\n"); |
162 |
fputs($f,"\$unit=\"".$_POST["unit"]."\";\n"); |
|
131 | 163 |
fputs($f,"\$showErr=\"true\";\n"); |
132 | 164 |
fputs($f,"?>"); |
133 | 165 |
fclose($f); |
... | ... | |
164 | 196 |
$preK=$_POST["preK"]; |
165 | 197 |
$kdnum=$_POST["kdnum"]; |
166 | 198 |
$pricegroup=$_POST["pricegroup"]; |
199 |
$unit=$_POST["unit"]; |
|
167 | 200 |
$auftrnr=$_POST["auftrnr"]; |
201 |
$utftrans=$_POST["utftrans"]; |
|
168 | 202 |
} |
169 | 203 |
} else { |
170 |
require "conf.php"; |
|
204 |
if (file_exists ("conf$login.php")) { |
|
205 |
require "conf$login.php"; |
|
206 |
} else { |
|
207 |
require "conf.php"; |
|
208 |
} |
|
209 |
$dsnP = array( |
|
210 |
'phptype' => 'pgsql', |
|
211 |
'username' => $ERPuser, |
|
212 |
'password' => $ERPpass, |
|
213 |
'hostspec' => $ERPhost, |
|
214 |
'database' => $ERPdbname, |
|
215 |
'port' => $ERPport |
|
216 |
); |
|
217 |
$dbP=@DB::connect($dsnP); |
|
218 |
if (DB::isError($dbP)||!$dbP) { |
|
219 |
echo "Keine Verbindung zur ERP<br>"; |
|
220 |
$dbP=false; |
|
221 |
//echo $dbP->userinfo; |
|
222 |
} |
|
171 | 223 |
} |
172 | 224 |
?> |
173 | 225 |
<html> |
... | ... | |
205 | 257 |
<td colspan="2"><input type="text" name="ERPpass" size="15" value="<?= $ERPpass ?>"></td> |
206 | 258 |
<td><input type="text" name="SHOPpass" size="15" value="<?= $SHOPpass ?>"></td> |
207 | 259 |
</tr> |
260 |
<tr> |
|
261 |
<td>UTF8-Transl.</td> |
|
262 |
<td colspan="2"><input type="checkbox" name="utftrans" <?= (empty($utftrans)?"":"checked") ?>></td> |
|
263 |
<td></td> |
|
264 |
</tr> |
|
208 | 265 |
<tr> |
209 | 266 |
<td>User-ID</td> |
210 | 267 |
<td colspan="2"><input type="text" name="ERPusrN" size="10" value="<?= $ERPusr["Name"] ?>"> |
... | ... | |
264 | 321 |
<td>ID Mindermenge</td> |
265 | 322 |
<td><input type="text" name="minderNR" size="10" value="<?= $minder["NR"] ?>"> |
266 | 323 |
<input type="checkbox" name="a1" <?= (empty($minder["ID"])?"":"checked") ?>></td> |
324 |
<td></td> |
|
325 |
</tr> |
|
326 |
<tr> |
|
327 |
<td>Std-Einheit</td> |
|
328 |
<td><select name="unit"> |
|
329 |
<? unit($unit); ?> |
|
330 |
</select></td> |
|
267 | 331 |
<td>Preisgruppe</td> |
268 | 332 |
<td><select name="pricegroup"> |
269 | 333 |
<? pg($pricegroup); ?> |
270 | 334 |
</select></td> |
271 |
</tr> |
|
272 | 335 |
<tr> |
273 | 336 |
<td colspan="2">Auftragsnummern durch</td> |
274 | 337 |
<td><input type="radio" name="auftrnr" value="1" <?= ($auftrnr==1)?"checked":"" ?>> LxO</td> |
Auch abrufbar als: Unified diff
Units, UTF-Trans, db-Connect