Location: PHPKode > projects > DarkCodex Forum System > darkcodex/admin/changecatorder.php
include ("config.inc");
include ("forum.inc");

$dbh = db_connect();

$user = authenticate();
if ($user[Status] != 'Administrator') {
    not_right ("You must be logged in, and be a valid administrator to access this.");

# -----------------------------------------------
# Grab the current boards and display there order
$query = <<<END_SQL
    SELECT DISTINCT Title,Number
    FROM Category 
$sth = mysql_query($query,$dbh) or die ("Query syntax error: $query. " . mysql_error() );
$rows = mysql_num_rows($sth);

# ------------------------
# Send them a confirmation
send_header ("Sort the category order.");
table_header("Sort the category order.");

print "Below you can change the order that the categories are displayed.  Make sure you assign each category an individual number starting at 1<p>";
print "<FORM METHOD=POST action=\"$config[cgiurl]/admin/dochangecatorder.php\">";

for ($i=0;$i < $rows; $i++) {
    list($Title,$Number) = mysql_fetch_array($sth);
    $formtitle = $Title;
    $formtitle = preg_replace( "/ /", "_SP_", $formtitle);
    print "<input type=text size=2 name=\"$formtitle\" value=$Number> $Title<br>";
print "<br><br>";
print "<input type=submit value=\"Change order\">";
print "</form>";  
Return current item: DarkCodex Forum System