professional-sql-04-public-files-admin.php / php
<?php // include shared code include '../lib/common.php'; include '../lib/db.php'; include '../lib/functions.php'; // must be logged in to access this page // include '401.php'; // processes incoming data if the form has been submitted if (isset(// delete existing addresses query = sprintf('TRUNCATE TABLE\ %sSEARCH_CRAWL', DB_TBL_PREFIX); mysql_query(GLOBALS['DB']); // add addresses list to database _POST['addresses'], "\n", false); if (count(values = array(); foreach (address) { address, query = sprintf('INSERT INTO\ %sSEARCH_CRAWL (DOCUMENT_URL) ' . 'VALUES ("\ %s")', DB_TBL_PREFIX, implode ('"), ("', query, // delete existing stop words query = sprintf('TRUNCATE TABLE\ %sSEARCH_STOP_WORD', DB_TBL_PREFIX); mysql_query(GLOBALS['DB']); // add stop word list to database _POST['stop_words'], "\n", false); if (count(values = array(); foreach (word) { word, query = sprintf('INSERT INTO\ %sSEARCH_STOP_WORD (TERM_VALUE) ' . 'VALUES ("\ %s")', DB_TBL_PREFIX, implode ('"), ("', query, // generate HTML form ob_start(); ?> <form method="post" action="<?php echo htmlspecialchars(_SERVER['PHP_SELF']); ?>"> <table> <tr> <td style="vertical-align:top; text-align:right"> <label for="addresses">Include Addresses</label></td> <td><small>Enter addresses to include in crawling, one address per line.</small><br/> <textarea name="addresses" id="addresses" rows="5" cols="60"><?php //retrieve list of addresses\ %sSEARCH_CRAWL ' . 'ORDER BY DOCUMENT_URL ASC', DB_TBL_PREFIX); result = mysql_query(GLOBALS['DB']); while (result)) { echo htmlspecialchars(result); ?></textarea> </td> </tr><tr> <td style="vertical-align:top; text-align:right"> <label for="stop_words">Stop Words</label></td> <td><small>Enter words to omit from the index, one per line.</small><br/> <textarea name="stop_words" id="stop_words" rows="5" cols="60"><?php //retrieve list of stop words\ %sSEARCH_STOP_WORD ORDER BY ' . 'TERM_VALUE ASC', DB_TBL_PREFIX); result = mysql_query(GLOBALS['DB']); while (result)) { echo htmlspecialchars(result); ?></textarea> </td> </tr><tr> <td> </td> <td><input type="submit" value="Submit"/></td> <td><input type="hidden" name="submitted" value="1"/></td> </tr><tr> </table> </form> <?php // display the page include '../templates/template-page.php'; ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.