<?

include("conf.php");
include("functions.php");

// CONNECT TO DATABASE
$db = mysql_connect($host, $user, $password)
	or die("<H1>COULD NOT CONNECT to host '$host' as user ´'$user'</H1>");

// SELECT DATABASE
if (mysql_select_db($usebase,$db)) {
  $noconnection=0; // means that a good connection to the db is available
} else {
  echo "<H1>Table '$usebase' is not available at host '$host'<BR>please check your database settings in conf.php</H1>";
  $noconnection=1; // means that NO connection to the db is available
  return -1;
}	



// SHOW 5 OLDER IMAGES BY DEFAULT
if (!isset($nimages)) {
  $nimages=0;
}

if (!isset($http_refresh)) {
  $http_refresh=10;
}

?>

<HTML>
<HEAD>
  <TITLE>MOTION DETECT</TITLE>
  <LINK REL="STYLESHEET" HREF="phpmotiondetect.css" TYPE="text/css">
  <? 
    if (ereg("index",$PHP_SELF)) {  
      echo "<META http-equiv=\"refresh\" content=\"$http_refresh\">\n";
    }
  ?>


</HEAD>
<BODY>

<?
echo $PHP_SELF;
?>


<TABLE WIDTH="100%" WIDTH="800" BORDER="0">
<TR>
<TD VALIGN="middle">

<?
echo " <FORM METHOD=\"GET\" ACTION=\"$PHP_SELF\">\n";
echo "<TABLE WIDTH=\"800\" BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"5\" ALIGN=\"center\">\n";
echo "<TR><TH CLASS=\"top\" COLSPAN=\"2\"><IMG BORDER=\"0\" SRC=\"images/motiondetect.gif\"></TH></TR>\n";
echo "<TR><TD CLASS=\"nav\" COLSPAN=\"2\">";
echo "[<A HREF=\"index.php\">Browsing</A>]";
echo " - [<A HREF=\"director.php\">Movie</A>]";
echo " - [<A HREF=\"stats.php\">Stats</A>]";
echo "</TD></TR>\n";

?>

<!-- PAGE CONTENT-->
<TR><TD CLASS="gray">
