// $Id: confedit.php 2009/02/10 14:41:30 hli Exp $ if (!isset($_SERVER['PHP_AUTH_USER'])) { Header("WWW-Authenticate: Basic realm=\"Configurations-Editor\""); Header("HTTP/1.0 401 Unauthorized"); echo "Sie müssen sich autentifizieren\n"; exit; } else { $login=($_GET["login"])?$_GET["login"]:$_POST["login"]; if (file_exists ("conf$login.php")) { require "conf$login.php"; } else { require "conf.php"; } if ($_SERVER['PHP_AUTH_USER']<>$ERPftpuser || $_SERVER['PHP_AUTH_PW']<>$ERPftppwd) { Header("WWW-Authenticate: Basic realm=\"My Realm\""); Header("HTTP/1.0 401 Unauthorized"); echo "Sie müssen sich autentifizieren\n"; exit; } require_once "DB.php"; function unit($sel) { global $dbP; $sql="select name from units order by sortkey"; $pgs=$dbP->getall($sql); if ($sel=='') $sel=$pgs[0][0]; if ($pgs) foreach ($pgs as $row) { echo "\t".$row[0]."\n"; } } function pg($sel) { global $dbP; $sql="select id,pricegroup from pricegroup"; $pgs=$dbP->getall($sql); echo "\tStandard VK\n"; if ($pgs) foreach ($pgs as $row) { echo "\t".$row[1]."\n"; } } if ($_POST["ok"]=="sichern") { $ok=true; $dsnP = array( 'phptype' => 'pgsql', 'username' => $_POST["ERPuser"], 'password' => $_POST["ERPpass"], 'hostspec' => $_POST["ERPhost"], 'database' => $_POST["ERPdbname"], 'port' => $_POST["ERPport"] ); $dbP=@DB::connect($dsnP); if (DB::isError($dbP)||!$dbP) { $ok=false; echo "Keine Verbindung zur ERP"; echo $dbP->userinfo; $dbP=false; } else { $sql="SELECT id,description,buchungsgruppen_id FROM parts where partnumber = '%s'"; $rs=$dbP->getall(sprintf($sql,$_POST["div16NR"])); $_POST["div16ID"]=$rs[0][0]; $div16txt=addslashes($rs[0][1]); $rs=$dbP->getall(sprintf($sql,$_POST["div07NR"])); $_POST["div07ID"]=$rs[0][0]; $div07txt=addslashes($rs[0][1]); $rs=$dbP->getall(sprintf($sql,$_POST["versandNR"])); $_POST["versandID"]=$rs[0][0]; $versandtxt=addslashes($rs[0][1]); $rs=$dbP->getall(sprintf($sql,$_POST["nachnNR"])); $_POST["nachnID"]=$rs[0][0]; $nachntxt=addslashes($rs[0][1]); $rs=$dbP->getall(sprintf($sql,$_POST["minderNR"])); $_POST["minderID"]=$rs[0][0]; $mindertxt=addslashes($rs[0][1]); $rs=$dbP->getall(sprintf($sql,$_POST["paypalNR"])); $_POST["paypalID"]=$rs[0][0]; $paypaltxt=addslashes($rs[0][1]); $rs=$dbP->getall(sprintf($sql,$_POST["treuhNR"])); $_POST["treuhID"]=$rs[0][0]; $treuhtxt=addslashes($rs[0][1]); $rs=$dbP->getall("select id from employee where login = '".$_POST["ERPusrN"]."'"); $_POST["ERPusrID"]=$rs[0][0]; } $dsnM = array( 'phptype' => 'mysql', 'username' => $_POST["SHOPuser"], 'password' => $_POST["SHOPpass"], 'hostspec' => $_POST["SHOPhost"], 'database' => $_POST["SHOPdbname"], 'port' => $_POST["SHOPport"] ); $dbM=@DB::connect($dsnM); if (DB::isError($dbM)||!$dbM) { //$ok=false; echo "Keine Verbindung zum Shop"; echo $dbM->userinfo; $dbM=false; }; if (ok) { $f=fopen("conf$login.php","w"); $v="1.5"; $d=date("Y/m/d H:i:s"); fputs($f,"\n// Verbindung zur ERP-db\n"); fputs($f,"\$ERPuser=\"".$_POST["ERPuser"]."\";\n"); fputs($f,"\$ERPpass=\"".$_POST["ERPpass"]."\";\n"); fputs($f,"\$ERPhost=\"".$_POST["ERPhost"]."\";\n"); fputs($f,"\$ERPdbname=\"".$_POST["ERPdbname"]."\";\n"); fputs($f,"\$ERPdns=\"pgsql://\$ERPuser:\$ERPpass@\$ERPhost/\$ERPdbname\";\n"); fputs($f,"\$ERPusr[\"Name\"]=\"".$_POST["ERPusrN"]."\";\n"); fputs($f,"\$ERPusr[\"ID\"]=\"".$_POST["ERPusrID"]."\";\n"); fputs($f,"\$ERPdir=\"".$_POST["ERPdir"]."\";\n"); fputs($f,"\$ERPimgdir=\"".$_POST["ERPimgdir"]."\";\n"); fputs($f,"\$maxSize=\"".$_POST["maxSize"]."\";\n"); fputs($f,"\$ERPftphost=\"".$_POST["ERPftphost"]."\";\n"); fputs($f,"\$ERPftpuser=\"".$_POST["ERPftpuser"]."\";\n"); fputs($f,"\$ERPftppwd=\"".$_POST["ERPftppwd"]."\";\n"); fputs($f,"//Verbindung zur osCommerce-db\n"); fputs($f,"\$SHOPuser=\"".$_POST["SHOPuser"]."\";\n"); fputs($f,"\$SHOPpass=\"".$_POST["SHOPpass"]."\";\n"); fputs($f,"\$SHOPhost=\"".$_POST["SHOPhost"]."\";\n"); fputs($f,"\$SHOPdbname=\"".$_POST["SHOPdbname"]."\";\n"); fputs($f,"\$SHOPdns=\"mysql://\$SHOPuser:\$SHOPpass@\$SHOPhost/\$SHOPdbname\";\n"); fputs($f,"\$SHOPdir=\"".$_POST["SHOPdir"]."\";\n"); fputs($f,"\$SHOPimgdir=\"".$_POST["SHOPimgdir"]."\";\n"); fputs($f,"\$SHOPftphost=\"".$_POST["SHOPftphost"]."\";\n"); fputs($f,"\$SHOPftpuser=\"".$_POST["SHOPftpuser"]."\";\n"); fputs($f,"\$SHOPftppwd=\"".$_POST["SHOPftppwd"]."\";\n"); fputs($f,"\$div16[\"ID\"]=\"".$_POST["div16ID"]."\";\n"); fputs($f,"\$div07[\"ID\"]=\"".$_POST["div07ID"]."\";\n"); fputs($f,"\$versand[\"ID\"]=\"".$_POST["versandID"]."\";\n"); fputs($f,"\$nachn[\"ID\"]=\"".$_POST["nachnID"]."\";\n"); fputs($f,"\$minder[\"ID\"]=\"".$_POST["minderID"]."\";\n"); fputs($f,"\$treuh[\"ID\"]=\"".$_POST["treuhID"]."\";\n"); fputs($f,"\$paypal[\"ID\"]=\"".$_POST["paypalID"]."\";\n"); fputs($f,"\$div16[\"NR\"]=\"".$_POST["div16NR"]."\";\n"); fputs($f,"\$div07[\"NR\"]=\"".$_POST["div07NR"]."\";\n"); fputs($f,"\$versand[\"NR\"]=\"".$_POST["versandNR"]."\";\n"); fputs($f,"\$nachn[\"NR\"]=\"".$_POST["nachnNR"]."\";\n"); fputs($f,"\$minder[\"NR\"]=\"".$_POST["minderNR"]."\";\n"); fputs($f,"\$treuh[\"NR\"]=\"".$_POST["treuhNR"]."\";\n"); fputs($f,"\$paypal[\"NR\"]=\"".$_POST["paypalNR"]."\";\n"); fputs($f,"\$div16[\"TXT\"]=\"".$div16txt."\";\n"); fputs($f,"\$div07[\"TXT\"]=\"".$div07txt."\";\n"); fputs($f,"\$versand[\"TXT\"]=\"".$versandtxt."\";\n"); fputs($f,"\$nachn[\"TXT\"]=\"".$nachntxt."\";\n"); fputs($f,"\$minder[\"TXT\"]=\"".$mindertxt."\";\n"); fputs($f,"\$treuh[\"TXT\"]=\"".$treuhtxt."\";\n"); fputs($f,"\$paypal[\"TXT\"]=\"".$paypaltxt."\";\n"); fputs($f,"\$bgcol[1]=\"#ddddff\";\n"); fputs($f,"\$bgcol[2]=\"#ddffdd\";\n"); fputs($f,"\$preA=\"".$_POST["preA"]."\";\n"); fputs($f,"\$preK=\"".$_POST["preK"]."\";\n"); fputs($f,"\$auftrnr=\"".$_POST["auftrnr"]."\";\n"); fputs($f,"\$utftrans=\"".$_POST["utftrans"]."\";\n"); fputs($f,"\$kdnum=\"".$_POST["kdnum"]."\";\n"); fputs($f,"\$mwst=\"".$_POST["mwst"]."\";\n"); fputs($f,"\$pricegroup=\"".$_POST["pricegroup"]."\";\n"); fputs($f,"\$unit=\"".$_POST["unit"]."\";\n"); fputs($f,"\$showErr=\"true\";\n"); fputs($f,"?>"); fclose($f); require "conf.php"; } else { $ERPuser=$_POST["ERPuser"]; $ERPpass=$_POST["ERPpass"]; $ERPhost=$_POST["ERPhost"]; $ERPdbname=$_POST["ERPdbname"]; $ERPusrN=$_POST["ERPusrN"]; $ERPdir=$_POST["ERPdir"]; $ERPimgdir=$_POST["ERPimgdir"]; $maxSize=$_POST["maxSize"]; $ERPftphost=$_POST["ERPftphost"]; $ERPftpuser=$_POST["ERPftpuser"]; $ERPftppwd=$_POST["ERPftppwd"]; $SHOPuser=$_POST["SHOPuser"]; $SHOPpass=$_POST["SHOPpass"]; $SHOPhost=$_POST["SHOPhost"]; $SHOPdbname=$_POST["SHOPdbname"]; $SHOPdir=$_POST["SHOPdir"]; $SHOPimgdir=$_POST["SHOPimgdir"]; $SHOPftphost=$_POST["SHOPftphost"]; $SHOPftpuser=$_POST["SHOPftpuser"]; $SHOPftppwd=$_POST["SHOPftppwd"]; $div16NR=$_POST["div16NR"]; $div07NR=$_POST["div07NR"]; $versandNR=$_POST["versandNR"]; $nachnNR=$_POST["nachnNR"]; $treuhNR=$_POST["treuhNR"]; $minderNR=$_POST["minderNR"]; $paypalNR=$_POST["paypalNR"]; $preA=$_POST["preA"]; $preK=$_POST["preK"]; $mwst=empty($_POST["mwst"])?1:$_POST["mwst"]; $kdnum=$_POST["kdnum"]; $pricegroup=$_POST["pricegroup"]; $unit=$_POST["unit"]; $auftrnr=$_POST["auftrnr"]; $utftrans=$_POST["utftrans"]; } } else { if (file_exists ("conf$login.php")) { require "conf$login.php"; } else { require "conf.php"; } $dsnP = array( 'phptype' => 'pgsql', 'username' => $ERPuser, 'password' => $ERPpass, 'hostspec' => $ERPhost, 'database' => $ERPdbname, 'port' => $ERPport ); $dbP=@DB::connect($dsnP); if (DB::isError($dbP)||!$dbP) { echo "Keine Verbindung zur ERP"; $dbP=false; //echo $dbP->userinfo; } } ?> "> "> "> "> "> "> "> "> DatenLx-ERPShop db-Host Database db-User Name db-User PWD UTF8-Transl. > Preise > incl. 1)?"checked":"" ?>> excl. MwSt User-ID "> > CSV-Dir Image-Dir FTP-Host FTP-User FTP-User PWD ID Diverse 16% "> > ID Diverse 7% "> > ID Versand "> > ID Nachname "> > ID Paypal "> > ID Treuhand "> > ID Mindermenge "> > Std-Einheit unit($unit); ?> Preisgruppe pg($pricegroup); ?> Auftragsnummern durch > LxO 1)?"checked":"" ?>> Shop Kundennummern durch > LxO 1)?"checked":"" ?>> Shop Nummernerweiterung Auftrag Kunde } ?>