<?
$visit = mysql_result(mysql_query("SELECT * FROM `who_theme` WHERE `us` = '".$user['id']."' and `theme` = '".$id."'",0);
if($visit == 0)mysql_query("INSERT INTO `who_theme` SET `theme` = '".$id."', `us` = '".$user['id']."', `time` = '".time()."'"
else mysql_query("UPDATE `who_theme` SET `time` = '".time()."' WHERE `us` = '".$user['id']."' and `theme` = '".$id."'"
?>