<?
  include_once("config.php");

  $link = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die ("Could not connect");

  @mysql_select_db(DB_NAME, $link);


//$r=@mysql_query("drop table blogusers",$link);

$r = mysql_query (
		"create table blogusers (
		id int(11) not null AUTO_INCREMENT,
		username text not null,
		password text not null,
		template int(11) not null default 1,
		posts int(11) not null default 0,
		code int(11) not null,
		primary key (id)
		)", $link);
if ($r) echo "Table <em>blogusers</em> created.<BR>\n";
else {
  $r=mysql_error();
  echo "<br><b>Error while blogusers table create:</b>$r<br>";
}

$r = mysql_query (
		"create table blog_templates (
		id int(11) not null AUTO_INCREMENT,
		name text not null,
		primary key (id)
		)", $link);
if ($r) echo "Table <em>blog_templates</em> created.<BR>\n";
else {
  $r=mysql_error();
  echo "<br><b>Error while blog_templates table create:</b>$r<br>";
}
for ($i=1;$i<=10;$i++) {
  $r=mysql_query("insert into blog_templates(name) values('template".$i."')");
}

?>