Thanks Sean, can you fix this code then?
PHP Code:
<?
# Edit me to point to the config.php3 on your PC.
include "config.php3";
#----------------------------------------------------------------->
# Version: $Id: index.php3,v 1.20 2002/10/23 20:43:33 ldrolez Exp $
# Website: [url]http://mythreads.sourceforge.net[/url]
#
# Desc: Main script for maintaining a links database
#
#
# License: This code is released under the terms of the GNU GPL
# version 2 or later. Please refer to [url]www.gnu.org[/url] for a copy
# of this license.
#
#----------------------------------------------------------------->
# main() : This function controls the script functions.
function main()
{
include("./lib/lib_main.php3");
global $tpl, $allow, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $admin_username, $admin_password,$add_link,$sug_category;
global $config;
# Do not report uninitialized variables
error_reporting (E_ERROR | E_WARNING | E_PARSE);
# Disable magic_quotes_runtime
set_magic_quotes_runtime(0);
if( !get_magic_quotes_gpc() )
{
if( is_array($HTTP_GET_VARS) )
{
while( list($k, $v) = each($HTTP_GET_VARS) )
{
if( is_array($HTTP_GET_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
{
$HTTP_GET_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_GET_VARS[$k]);
}
else
{
$HTTP_GET_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_GET_VARS);
}
if( is_array($HTTP_POST_VARS) )
{
while( list($k, $v) = each($HTTP_POST_VARS) )
{
if( is_array($HTTP_POST_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
{
$HTTP_POST_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_POST_VARS[$k]);
}
else
{
$HTTP_POST_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_POST_VARS);
}
if( is_array($HTTP_COOKIE_VARS) )
{
while( list($k, $v) = each($HTTP_COOKIE_VARS) )
{
if( is_array($HTTP_COOKIE_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
{
$HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_COOKIE_VARS[$k]);
}
else
{
$HTTP_COOKIE_VARS[$k] = addslashes($v);
}
}
@reset($HTTP_COOKIE_VARS);
}
}
DatabaseConnect();
if (isset ($HTTP_GET_VARS["mode"]))
{
if ($HTTP_GET_VARS["mode"] == 'search')
{
include("./lib/lib_search.php3");
}
else if ($HTTP_POST_VARS["sorry_go_back"] != '')
{
showMainPage();
}
else if (eregi("(add_link|update_link|add_category)",$HTTP_GET_VARS["mode"]))
{
include("./lib/lib_addupdate.php3");
}
else if ($HTTP_GET_VARS["mode"] == 'admin')
{
include("./lib/lib_rdf.php3");
include("./lib/lib_admin.php3");
}
else
{
showMainPage();
}
}
else if(isset ($HTTP_GET_VARS["count"]))
{
countIt($HTTP_GET_VARS["count"]);
}
else if (isset ($HTTP_GET_VARS["category"]) || isset ($HTTP_GET_VARS["more"]) )
{
# Get the content before showing the webpage
if ($HTTP_GET_VARS["category"] == 'top_links')
{
$your_current_location = Message("top_links");
$category_links=Top_Hits($config["sp_max_top_links"]);
}
else if ($HTTP_GET_VARS["category"] == 'new_links')
{
$your_current_location = Message("new_links");
$category_links=Newly_Added($config["sp_max_new_links"]);
}
else if ($HTTP_GET_VARS["category"] == 'upd_links')
{
$your_current_location = Message("upd_links");
$category_links=Newly_Updated($config["sp_max_upd_links"]);
}
else if (isset ($HTTP_GET_VARS["more"]))
{
$your_current_location = Message("details");
$category_links = showMore($HTTP_GET_VARS["more"], $your_current_location);
}
else
{
$categories = viewPage($HTTP_GET_VARS["category"]);
$your_current_location = display_category($HTTP_GET_VARS["category"]);
$category_links = display_category_links($HTTP_GET_VARS["category"], $HTTP_GET_VARS["view"]);
}
# remove html tags (useful for headings, title)
$your_current_location2 = ereg_replace("<[^>]+>", "", $your_current_location);
# Sets a few variables before we parse the HTML template
$tpl->set_var( array(
"ADD_LINK" => "$add_link"."&category=$HTTP_GET_VARS[category]",
"SUG_CATEGORY" => "$sug_category"."&category=$HTTP_GET_VARS[category]",
"SUB_CATEGORIES" => $categories,
"CATEGORY_LINKS" => $category_links,
"HEAD_INFO" => $your_current_location2,
"INFO" => $your_current_location
));
showStartTemplate();
}
else {
showMainPage();
}
} # End Main Function
function DatabaseConnect()
{
global $database, $host, $username, $password, $config, $mylink;
if ($config["use_pconnect"] == 1) {
$mylink = mysql_pconnect( $host, $username, $password);
} else {
$mylink = mysql_connect( $host, $username, $password);
}
if (!$mylink)
{
print "<h3>could not connect to database</h3>\n";
exit;
}
mysql_select_db($database);
}
function showStartTemplate()
{
global $tpl;
$tpl->parse("MyOutput", "start");
$tpl->p("MyOutput");
}
# Call the main function which controls everything
main();
?>
Bookmarks