<?php header('Content-type: text/html; charset=utf-8'); ?>
<html>
<link rel="stylesheet" type="text/css" href="css/style.css" />

<body bgcolor="white">
<?php
	include("scripts/sqlinfo.inc");
	mysql_connect($host, $user, $pass);
	mysql_selectdb(pyrot);
	
	$id = $_GET['id'];

	if(!$id){
		$result=mysql_query("select * from medlemmar where status=\"styrelse\"");
		printf("<center><table width=400><tr><td colspan=5><span class=\"header1\">Medlemslista</span></td></tr>");
		if($r=mysql_fetch_array($result)){
			printf("<tr><td colspan=5><b>Styrelsen<hr></b></td></tr>");
			do {
				printf("<tr><td>");
				if($r["photo"]!="")
					printf("<img src=\"images/foto.gif\"></img> ");
				printf("</td><td><a href=\"members.php?id=%s\">%s</a></td><td>%s
					</td><td>%s</td></tr>",
					$r["col_id"], $r["namn"], $r["tfn"], $r["mobtfn"]);
			} while($r=mysql_fetch_array($result));
			printf("<tr><td><br></td></tr>");
		}
		$result=mysql_query("select * from medlemmar where status=\"medlem\"");
		if($r=mysql_fetch_array($result)){
			printf("<tr><td colspan=5><b>Medlemmar<hr></b></td></tr>");
			do{
				printf("<tr><td>");
				if($r["photo"]!="")
					printf("<img src=\"images/foto.gif\"></img> ");
				printf("</td><td><a href=\"members.php?id=%s\">%s</a></td><td>%s
					</td><td>%s</td></tr>",
					$r["col_id"], $r["namn"], $r["tfn"], $r["mobtfn"]);
			}while($r=mysql_fetch_array($result));
			printf("<tr><td><br></td></tr>");
		}
		$result=mysql_query("select * from medlemmar where status=\"provis\"");
		if($r=mysql_fetch_array($result)){
			printf("<tr><td colspan=5><b>Provmedlemmar<hr></b></td></tr>");
			do{
				printf("<tr><td>");
				if($r["photo"]!="")
					printf("<img src=\"images/foto.gif\"></img>");
				printf("</td><td><a href=\"members.php?id=%s\">%s</a></td><td>%s
					</td><td>%s</td></tr>",
					$r["col_id"], $r["namn"], $r["tfn"], $r["mobtfn"]);
			}while($r=mysql_fetch_array($result));
			printf("<tr><td><br></td></tr>");
		}
		$result=mysql_query("select * from medlemmar where status=\"utbrand\"");
		if($r=mysql_fetch_array($result)){
			printf("<tr><td colspan=5><b>De utbrända<hr></b></td></tr>");
			do{
				printf("<tr><td>");
				if($r["photo"]!="")
					printf("<img src=\"images/foto.gif\"></img> ");
				printf("</td><td><a href=\"members.php?id=%s\">%s</a></td><td>%s
					</td><td>%s</td></tr>",
					$r["col_id"], $r["namn"], $r["tfn"], $r["mobtfn"]);
			}while($r=mysql_fetch_array($result));
			printf("<tr><td><br></td></tr>");
		}
		printf("</table></center>");
	}else{
	$result=mysql_query("select * from medlemmar where col_id = " . $id);
	if($r=mysql_fetch_array($result)){
		printf("<center><table width=400 cellpadding=0><tr><td valign=\"top\">
			<table width=250 border=0 cellpadding=0><tr><td colspan=2><span class=\"header1\">%s</span></td>
			<tr><td><b>E-mail:</b></td><td><a href=\"mailto:%s\">%s</a></td></tr>
			<tr><td><b>Telefon:</b></td><td>%s</td></tr>
			<re><td><b>Mobil:</b></td><td>%s</td></tr>
			<tr><td><b>Icq:</b></td><td>%s</td></tr>
			<tr><td><b>Linje:</b></td><td>%s</td></tr>
			<tr><td colspan=2>%s</td></tr></table></td>"
						,$r["namn"], $r["email"],$r["email"],
			$r["tfn"],$r["mobtfn"],$r["icq"],$r["linje"],$r["kommentar"]);
		if($r["photo"]!="")
			printf("<td align=\"left\"><img src=\"%s\" class=\"mpic\"></img></td></tr>", $r["photo"]);
		printf("<tr><td colspan=3><br><br><a href=\"members.php\">Medlemsförteckning</a></table></center>");
	}
}?>
</body>
</html>
