<?php //-->-->-->-->-->-->-->--> require '/usr50/home/retrovox/public_html/manage/php-lib/RETROVOX-CONSTANT-VARIABLES.php'; require '/usr50/home/retrovox/public_html/manage/php-lib/fnRetrovoxParseXml.php'; $sDataPath = '/usr50/home/retrovox/public_html/product-data'; $sProductId = $_GET["product"]; $sFilePath = "$sDataPath/product-$sProductId.xml"; if ($sProductId == '') { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox Products'> <META HTTP-EQUIV='Description' CONTENT='Retrovox Product, no item'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Product Display, (No product specified)</title> </head> <body> ${S-RETROVOX-TITLE-IMAGE-HTML} <center><h1>No product was specified to edit</h1></center> <br> <ol type = 'a'> <li> <a href = '/product-data/'>View the product data directory</a></li> <li> <a href = '/manage/add-product-form.php'> Add a new product to the Retrovox database</a></li> <li> Select a product to edit from the list below <table border = '0'> <tr><td>ID</td><td>Product Name</td><td>action</td><td>action</td> <td>action</td><td>action</td></tr>"; $iCurrentProductId = 0; $sExtractedId = ''; //-- to get the product-id from the file name $sFileContents = ''; $aaProductData = ''; $iCount = '0'; //-- used to shade alternate rows of display table $dh = opendir($sDataPath); while (false !== ($sCurrentFileName = readdir($dh))) { $sExtractedId = str_replace('.xml', '', str_replace('product-', '', $sCurrentFileName)); if (is_numeric($sExtractedId)) { $iCurrentProductId = $sExtractedId; $sFileContents = implode('', file($sDataPath."/".$sCurrentFileName)); $aaProductData = fnRetrovoxParseXml($sFileContents); if (($iCount % 2) == 0) { $sBackgroundColour = "#ffffff"; } else { $sBackgroundColour = "#efefef"; } echo " <tr bgcolor = \"$sBackgroundColour\"><td>". $aaProductData['product-id']."</td><td>". $aaProductData['product-name']. "</td><td><a href = '/product-data/display-product.php?product=". $aaProductData['product-id']."'>view page </a></td><td> <a href = '/product-data/display-product-tabular.php?product=". $aaProductData['product-id']."'>view data </a></td><td> <a href = '/product-data/display-product-xml.php?product=". $aaProductData['product-id']."'>view xml </a></td><td> <a href = '/manage/edit-product-form.php?product=". $aaProductData['product-id']."'>edit </a></td></tr>"; $iCount++; } //-- if is product data file } //-- while more files echo " </table></li> </ol> <small>TIP: You can specify a product to edit using a 'query string' in the URL for this page. For example, you could type <a href='http://www.retrovox.com.au/product-data/display-product-tabular.php?product=62'> http://www.retrovox.com.au/product-data/display-product-tabular.php?product=62</a> in your browsers address-bar in order to view the product with the id 62 </small> </body> </html>"; exit; } //-- if no product if (!file_exists($sFilePath)) { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox'> <META HTTP-EQUIV='Description' CONTENT='Retrovox notepad, item doesnt exist'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Product Display, (The item doesn't exist)</title> </head> <body> ${S-RETROVOX-TITLE-IMAGE-HTML} <center><h1>The item doesn't exist</h1></center> <p>There is no product on the Retrovox site with the product-id which you just specified. Please try again</p> <br> <ol type = 'a'> <li> <a href = '/product-data/'>View the product data directory</a></li> <li> <a href = '/manage/add-product-form.php'> Add a new product to the Retrovox database</a></li> </ol> </body> </html>"; exit; } //-- if product doesnt exist if (!is_readable($sFilePath)) { echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'> <html> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'> <META HTTP-EQUIV='Keywords' CONTENT='Retrovox'> <META HTTP-EQUIV='Description' CONTENT='Retrovox, product file not readable'> <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'> <head><title>Retrovox Product Display, (The product file is not readable)</title> </head> <body> ${S-RETROVOX-TITLE-IMAGE-HTML} <center><h1>The product file is not readable</h1></center> <p>The file containing the data for the product which you specified is not readable. The permissions for this file will need to be altered by the system administrator </p> <br> </body> </html>"; return; } //-- if product file not readable //$aaProductData = parse_ini_file($sFilePath); //echo "short-description=".$aaProductData["short-description"]; $sProductData = implode('', file($sFilePath)); $aaProductData = fnRetrovoxParseXml($sProductData); //--<--<--<--<--< ?> <HTML> <HEAD> <TITLE>Edit Retrovox Product Information </TITLE> </HEAD> <body> <?=${S-RETROVOX-TITLE-IMAGE-HTML}?> <center> <form method = 'post' action = 'http://www.retrovox.com.au/manage/update-product.php'> <table border = "1"> <?php //-->-->-->-->-->-->-->--> echo " <tr> <td><strong><em>product-id</em></strong></td> <td>".$aaProductData['product-id']. "<input type = 'hidden' name = 'product-id' value = '".$aaProductData['product-id']."'></td> </tr> \n"; foreach ($aaProductData as $key => $value) { if (($key != 'long-description') && ($key != 'product-id')) { echo " <tr> <td><strong><em>$key</em></strong></td> <td><input type = 'text' name = '$key' value = '".htmlspecialchars($value)."'> </td> </tr> \n"; } } //-- foreach echo " <tr> <td><strong><em>long-description</em></strong></td> <td><textarea name = 'long-description' cols = '40' rows = '3'>". htmlspecialchars($aaProductData['long-description'])."</textarea></td> </tr> \n"; //--<--<--<--<--<--<--<--< ?> <tr><td> <input type = 'submit' value = 'S a v e T h e C h a n g e s'> </td></tr> </table> </form> </center> <ol type = 'a'> <li><a href = '../product-data/display-product.php?product=<?=$sProductId?>'> View the web-page for this product</a></li> <li><a href = '../product-data/product-<?=$sProductId?>.xml'> View the raw XML data for this product</a></li> <li><a href = '../product-data/display-product-xml.php?product=<?=$sProductId?>'> View the XML data for this product in a web-page</a></li> <li><a href = '../product-data/display-product-tabular.php?product=<?=$sProductId?>'> View the data for this product in a tabular format</a></li> </ol> </body> </html>