diff --git a/htdocs/index.php b/htdocs/index.php
index 304aad4726540afcf60ea4839a4e29062127c032..87e441a944f9877b9cd95ff04a1c46a0e1478adb 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -14,7 +14,7 @@ if (@$displaytime) {
     Settings
    -------------------------------------------------------- */
 
-include("settings.php");
+require_once("settings.php");
 if (!defined('SUCS_BASEDIR')) {
 	echo "Website unconfigured";
 	exit();
@@ -24,20 +24,18 @@ if (!defined('SUCS_BASEDIR')) {
     Libraries
    -------------------------------------------------------- */
 // Include our custom error handling business
-require("../lib/error.php");
+require_once("../lib/error.php");
 
 
 // Include the Smarty templating engine
-require(SMARTY_DIR."Smarty.class.php");
+require_once(SMARTY_DIR."Smarty.class.php");
 $smarty = new Smarty;
 $smarty->template_dir = SUCS_BASEDIR."templates";
 $smarty->compile_dir = SUCS_BASEDIR."templates_c";
 $smarty->plugins_dir[] = SUCS_BASEDIR."plugins";
 
-$smarty->assign("baseurl", SUCS_BASEURL);
-
 // Initialise the database
-require(ADODB_DIR."adodb.inc.php");
+require_once(ADODB_DIR."adodb.inc.php");
 $DB = NewADOConnection(SUCS_DBTYPE);
 $DB->Connect('dbname='.SUCS_DBNAME);
 $DB->SetFetchMode(ADODB_FETCH_ASSOC);
@@ -52,7 +50,7 @@ $smarty->assign_by_ref("session", $session);
    -------------------------------------------------------- */
 
 // Turn on adodb debugging by uncommenting:
-//$DB->debug = true;
+//$DB->debug = TRUE;
 
 // Turn on Smarty debugging by uncommenting:
 //$smarty->assign("debug",TRUE);
@@ -181,5 +179,4 @@ $smarty->display("foot".$language['file'].".tpl");
 // Save any changes made to the session data
 $session->save();
 
-
 ?>
diff --git a/templates/head.tpl b/templates/head.tpl
index 50cd7f6e4e2ec0ad3f237f8467ca1ebee7d66613..2f8ed490f80dc36928557711abe89cea4026e391 100644
--- a/templates/head.tpl
+++ b/templates/head.tpl
@@ -8,16 +8,16 @@
 
 	<script type="text/javascript" src="/js/cb.js"></script>
 
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/common.css" media="screen,print" />
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/sucs.css" media="screen" />
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/box.css" media="screen" />
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/downloads.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/common.css" media="screen,print" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/sucs.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/box.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/downloads.css" media="screen" />
 {if isset($extra_styles)}
 {foreach from=$extra_styles item=style}
 	<link rel="stylesheet" type="text/css" href="{$style}" media="screen" />
 {/foreach}	
 {/if}
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/print.css" media="print" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/print.css" media="print" />
 
 {if isset($rss_url)}
 	<link rel="alternate" type="application/rss+xml" title="{$title}" href="{$rss_url}" />
@@ -31,8 +31,8 @@
 {if $refresh}	<meta http-equiv="REFRESH" content="{$refresh}" />{/if}
                         
 {if $action=="edit"}
-	<script language="javascript" type="text/javascript" src="{$baseurl}/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
-	<script language="javascript" type="text/javascript" src="{$baseurl}/js/tiny_mce.js"></script>
+	<script language="javascript" type="text/javascript" src="{$smarty.const.SUCS_BASEURL}/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
+	<script language="javascript" type="text/javascript" src="{$smarty.const.SUCS_BASEURL}/js/tiny_mce.js"></script>
 {/if}
 
 {if isset($extra_scripts)}
@@ -42,14 +42,14 @@
 {/if}
 
 <!--[if IE]>
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/ie.css" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/ie.css" />
 <![endif]-->
 
 <!--[if lt IE 7]>
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/ielt7.css" media="screen" />
-	<link rel="stylesheet" type="text/css" href="{$baseurl}/css/boxie.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/ielt7.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="{$smarty.const.SUCS_BASEURL}/css/boxie.css" media="screen" />
 
-	<script defer type="text/javascript" language="JavaScript" src="{$baseurl}/js/pngfix.js"></script>
+	<script defer type="text/javascript" language="JavaScript" src="{$smarty.const.SUCS_BASEURL}/js/pngfix.js"></script>
 
 <![endif]-->
 
diff --git a/templates/login.tpl b/templates/login.tpl
index 1dff7d34225519610f19445d862438fe36489fd2..d1bea994aadf879a72667f13a40fabf92c6c8d7a 100644
--- a/templates/login.tpl
+++ b/templates/login.tpl
@@ -3,7 +3,7 @@
 					<div>
 {if $session->loggedin}
 Logged in as {$session->username}<br />
-<a href="{$baseurl}/Options">Membership Options</a><br />
+<a href="{$smarty.const.SUCS_BASEURL}/Options">Membership Options</a><br />
 
 {if $session->email_forward}
 Mail forwarded to {$session->email_forward}<br />
diff --git a/templates/members.tpl b/templates/members.tpl
index fbc331a1e9c810ec1eb5900489ea6805b076698a..8993d517aa77db4d2e1102e101bf9a8bae0f0989 100644
--- a/templates/members.tpl
+++ b/templates/members.tpl
@@ -12,7 +12,7 @@
 <div class="boxhead"><h2>Membership Details for {$results[0].uid}</h2></div>
 <div class="boxcontent">
 {if isset($results[0].picture) }
-	<img class="emblem" src="{$baseurl}{$results[0].picture}" alt="Picture of {$results[0].uid}" />
+	<img class="emblem" src="{$smarty.const.SUCS_BASEURL}{$results[0].picture}" alt="Picture of {$results[0].uid}" />
 {/if}
 <dl class="member">
 	<dt>Username</dt>
diff --git a/templates/menu.tpl b/templates/menu.tpl
index 9ed0c7c075d20dbb5753c15c351704f9ed2ea864..835131b23f55544e3bc4e00b7441262893048296 100644
--- a/templates/menu.tpl
+++ b/templates/menu.tpl
@@ -1,13 +1,13 @@
 	<div id="navigationC">
 	<ul>
 {foreach name=menu from=$menu key=name item=target}
-			<li>{if is_array($target)}<a href="{$baseurl}/{$name}"{if $select==$name} class="select"{/if}>{$name}</a>
+			<li>{if is_array($target)}<a href="{$smarty.const.SUCS_BASEURL}/{$name}"{if $select==$name} class="select"{/if}>{$name}</a>
 			<ul>
 {foreach name=submenu from=$target key=subitem item=subname}
-				<li><a href="{$baseurl}{$subname}"{if $subselect==$subitem} class="select"{/if}>{if $smarty.foreach.submenu.last}<span>{/if}{$subitem}{if $smarty.foreach.submenu.last}</span>{/if}</a></li>
+				<li><a href="{$smarty.const.SUCS_BASEURL}{$subname}"{if $subselect==$subitem} class="select"{/if}>{if $smarty.foreach.submenu.last}<span>{/if}{$subitem}{if $smarty.foreach.submenu.last}</span>{/if}</a></li>
 {/foreach}
 			</ul>
-			{else}<a href="{$baseurl}{$target}"{if $select==$name} class="select"{/if}><span>{$name}</span></a>{/if}</li>
+			{else}<a href="{$smarty.const.SUCS_BASEURL}{$target}"{if $select==$name} class="select"{/if}><span>{$name}</span></a>{/if}</li>
 {/foreach}
 	</ul>
 	</div>
diff --git a/templates/options.tpl b/templates/options.tpl
index 63f84fddff4c0d43d1dd737204fcd4cf7125bda7..3162a337aa19d70a44ee47b9d0175e62904f03dc 100644
--- a/templates/options.tpl
+++ b/templates/options.tpl
@@ -48,7 +48,7 @@
 		<label for="hackergotchi">Hackergotchi:</label>
 		<span class="textinput" id="hackergotchi">
 {if $hackergotchi}
-			<img src="{$baseurl}/pictures/people/{$session->username}.png" />
+			<img src="{$smarty.const.SUCS_BASEURL}/pictures/people/{$session->username}.png" />
 	<form action="{$self}" method="post">
 		<input type="hidden" name="action" value="clearhackergotchi" />
 		<input type="submit" value="Clear Hackergotchi" />
diff --git a/templates/pastebin.tpl b/templates/pastebin.tpl
index 7812c7e0fcdd0de5211d9b6442bcb7608056b129..4005ef2b0c4f8748d95ee94780d0aa13f52270f8 100644
--- a/templates/pastebin.tpl
+++ b/templates/pastebin.tpl
@@ -19,7 +19,7 @@
 {/if}
 
 {if $session->loggedin}
-	<form action="{$baseurl}{$path}" method="post">
+	<form action="{$smarty.const.SUCS_BASEURL}{$path}" method="post">
 		<div class="box">
 			<div class="boxhead"><h2>Paste an item</h2></div>
 			<div class="boxcontent">