kb-show.php3 878 Bytes
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
5 6 7 8
# All rights reserved.
#
include("defs.php3");

9
# Page arguments.
10
$optargs = OptionalPageArguments("idx",       PAGEARG_INTEGER,
11 12
				 "xref_tag",  PAGEARG_STRING);

13
if (isset($xref_tag) && $xref_tag != "") {
14 15 16 17 18 19 20
    if (! preg_match("/^[-\w]+$/", $xref_tag)) {
	PAGEARGERROR("Invalid characters in $xref_tag");
    }
    $query_result =
	DBQueryFatal("select * from knowledge_base_entries ".
		     "where xref_tag='$xref_tag'");
    if (! mysql_num_rows($query_result)) {
21 22
	USERERROR("No such knowledge_base entry: $xref_tag", 1, 
		  HTTP_404_NOT_FOUND);
23 24 25 26
    }
    $row = mysql_fetch_array($query_result);
    $idx = $row['idx'];
}
27
if (isset($idx)) {
28
    header("Location: $WIKIDOCURL/kb${idx}", TRUE, 301);
29 30
}
else {
31
    header("Location: $WIKIDOCURL/KnowledgeBase", TRUE, 301);
32
}    
33 34

?>