Nein, ich mache das nicht beruflich, beruflich bin ich TK- und Computer-Techniker, aber bin dabei PHP, JS, HTML und CSS zu lernen aber auch nur soviel wie ich es für mich und ein Paar Kunden von mir brauche.
@kerstinaxmann ich will ja die title metatags auf einmal abspeichern können oder versteh ich da gerade etwas falsch...
was meinst du ganz genau mit Kategorien Alt Tags und Bildernamen? Meinst du Kategorien alt_text? und gm_prd_image_name?
Hier ist das fertige Ergebnis. Allerdings habe ich inzwischen auch in Admin-Menü integriert und bin noch am testen, ob alles einwandfrei funktioniert? An diese Stelle möchte ich mich auch bei Moritz für seine wertvolle Tipps bedanken, die mir den richtigen Weg zur Sicherheit gelehrt haben. Bei dieser Version muss man zuerst als Admin angemeldet sein um die Datei abrufen zu können. Die Datei als "products_edit_view.php im Haupt-Ordner des Shops hochladen. Auch die CSS-Datei in haupt Ordner des Shops hochladen. PHP: <?php require_once 'includes/application_top.php'; xtc_db_close(); if($_SESSION['customers_status']['customers_status_id'] !== '0') { die('Zugriff verweigert'); } echo '<html>'; echo '<head>'; echo '<link rel="stylesheet" type="text/css" href="ChangeProductsInfo.css" />'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; echo '<title>Produkte in Datenbak ändern</title>'; ?> <script type="text/javascript"> function send(ak,id) { if(ak==1) document.f.ak.value = "up"; document.f.id.value = id; document.f.submit(); } </script> <?php echo '</head>'; ?> <body> <?php //Informations to the connection $host = "Hostname"; //Hostname eingeben $username = "Benutzername"; //Username eingeben $password = "Passwort"; //passwort eingeben $db_name = "DB-Name"; //Datenbanknname eingeben //Connect to server and select database mysql_connect($host, $username, $password) or die('cannot connect'); mysql_select_db($db_name) or die('cannot select DB'); mysql_query('SET NAMES utf8'); // Aktion ausführen if(isset($_POST["ak"])) { // Datensätze ändern if($_POST["ak"]=="up") { $id = (int)$_POST["id"]; // sicherstellen, dass id eine Zahl ist, um SQL-Injection zu verhindern // mysql_real_escape ersetzt ' durch \', um SQL-Injection zu verhindern $sqlab = "UPDATE products p, products_description pd set " . " p.products_model = '" . mysql_real_escape_string($_POST["p_mod"][$id]) . "', " . " p.products_price = '" . mysql_real_escape_string($_POST["p_p"][$id]) . "', " . " pd.products_meta_title = '" . mysql_real_escape_string($_POST["p_mt"][$id]) . "', " . " pd.products_name = '" . mysql_real_escape_string($_POST["p_n"][$id]) . "', " . " pd.products_keywords = '" . mysql_real_escape_string($_POST["p_kw"][$id]) . "'" . " WHERE p.products_id = $id" . " and pd.products_id = p.products_id"; mysql_query($sqlab); } } // Formularbeginn echo '<form name="f" action="products_edit_view.php" method="post">'; echo '<input name="ak" type="hidden" />'; echo '<input name="id" type="hidden" />'; //Tabellenbeginn echo "\n\n" . '<table border>' . '<tr>' . '<td style="color:#999999">Kategorie</td>' . '<td>Art-Nr.</td>' . '<td>Prod-Name</td>' . '<td>Price-Brutto</td>' . '<td>Price-Netto</td>' . '<td>Prod-Meta-Titel</td>' . '<td>Prod-Keywords</td>' . '<td>Aktion</td>' . '</tr>'; //Anzeigen $products_query = 'SELECT p.products_model, pd.products_name, p.products_price, p.products_tax_class_id, pd.products_meta_title, pd.products_keywords, cd.categories_name, p.products_id as products_id, pd.products_id as products_id, p2c.categories_id as categories_id, cd.categories_id as categories_id FROM (products as p INNER JOIN products_description as pd ON pd.products_id = p.products_id) inner join products_to_categories as p2c on p2c.products_id = pd.products_id inner join categories_description as cd ON cd.categories_id = p2c.categories_id WHERE pd.language_id=2 AND cd.language_id=2 order by pd.products_name asc'; $res = mysql_query($products_query) or die ('MySQL-Error: ' . mysql_error()); //Alle vorhandene Datensätze while ($dsatz = mysql_fetch_array($res)) { $id = $dsatz['products_id']; $price_brutto = round($dsatz['products_price'] * 1.07, 2); $price_netto = ($price_brutto/1.07); // htmlspecialchars ersetzt " durch " , um XSS zu verhindern echo "\n\n" . '<tr>' . '<td><input name="cat-name[' . $id . ']" value="' . htmlspecialchars($dsatz['categories_name']) . '" size="16" readonly style="color:#666" /></td>' . '<td><input name="p_mod[' . $id . ']" value="' . htmlspecialchars($dsatz['products_model']) . '" size="8" /></td>' . '<td><input name="p_n[' . $id . ']" value="' . htmlspecialchars($dsatz['products_name']) . '" size="25" /></td>' . '<td><input name="p_p_b[' . $id . ']" value="' . $price_brutto . '" size="9" readonly style="color:#666" /></td>' . '<td><input name="p_p[' . $id . ']" value="' . htmlspecialchars($dsatz['products_price']) . '" size="9" /></td>' . '<td><input name="p_mt[' . $id . ']" value="' . htmlspecialchars($dsatz['products_meta_title']) . '" size="20" /></td>' . '<td><input name="p_kw[' . $id . ']" value="' . htmlspecialchars($dsatz['products_keywords']) . '" size="30" /></td>' . '<td><a href="javascript:send(1,' . $id . ');">ändern</a>' . '</tr>'; } echo '</table>'; echo '</form>'; ?> </body> </html>