science-ation/common.inc.php

105 lines
1.8 KiB
PHP
Raw Normal View History

<?
require("config.inc.php");
mysql_connect($DBHOST,$DBUSER,$DBPASS);
mysql_select_db($DBNAME);
function i18n($str)
{
if(!$str)
return "";
if($_SESSION['lang'])
{
if($_SESSION['lang']=="en")
return $str;
else
{
$q=mysql_query("SELECT * FROM languages WHERE lang='".$_SESSION['lang']."' AND str='".mysql_escape_string($str)."'");
if($r=@mysql_fetch_object($q))
{
if($r->val)
return $r->val;
else
{
return "<font color=red>($str)</font>";
}
}
else
{
mysql_query("INSERT INTO languages (lang,str) VALUES ('".$_SESSION['lang']."','".mysql_escape_string($str)."')");
echo mysql_error();
return "<font color=red>($str)</font>";
}
}
}
else
{
//no language set, assume english
return $str;
}
}
function send_header($title="")
{
global $FAIRYEAR;
$q=mysql_query("SELECT * FROM config WHERE year='$FAIRYEAR'");
while($r=mysql_fetch_object($q))
{
$config[$r->var]=$r->val;
}
?>
2004-11-10 15:31:30 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
2004-11-10 15:31:30 +00:00
<head><title><?=$title?></title>
<link rel="stylesheet" href="sfiab.css" type="text/css" />
2004-11-10 15:31:30 +00:00
</head>
<body>
<div id="header">
<?
echo "<h1>".i18n($config['fairname'])."</h1>";
?>
2004-11-10 15:31:30 +00:00
<hr />
</div>
<div id="left">
<ul class="mainnav">
<li><a href="register_participants.php">Participant Registration</a></li>
<li><a href="register_judges.php">Judges Registration</a></li>
</ul>
<br />
<ul class="mainnav">
<li><a href="admin/">Fair Administration</a></li>
<li><a href="config/">SFIAB Configuration</a></li>
</ul>
<br />
<p class="aligncenter">
<a href="http://www.sfiab.ca/">Return to SFIAB Development Page</a>
</p>
</div>
<div id="main">
<?
}
function send_footer()
{
?>
</div>
<div id="footer">
</div>
2004-11-10 15:31:30 +00:00
</body>
</html>
<?
}
?>