<?
  /* Main include info */
  ini_set('include_path',$_SERVER['DOCUMENT_ROOT'] . "/../include/");
  include("site.inc");

  /* Assign the page title */
  $data[tpl]->assign("PAGE_TITLE","");

  /* Main defines */
  $data[tpl]->define(array(index=>"index/index.html"));
  $data[tpl]->define(array(body=>"/main.html"));

  //DoSession();

  $data['tpl']->assign("CVID","1738");

  $query = "SELECT vid,artist,title,thumb FROM videos ORDER BY vid DESC LIMIT 0,3";
  $res = mysql_query($query);

  //$newVids = "<TABLE BORDER=\"0\"><TR>";
  for ($i = 0;$i < mysql_num_rows($res);$i++) {
    $VID     = mysql_result($res,$i,'vid');
    $vArtist = mysql_result($res,$i,'artist');
    $vTitle  = mysql_result($res,$i,'title');
    $vThumb  = mysql_result($res,$i,'thumb');
    if (strlen($vArtits) > 18)
      $vArtist = substr($vArtist,0,16) . "...";
    if (strlen($vTitle) > 18)
      $vTitle = substr($vTitle,0,16) . "...";
    $newVids .= "<A HREF=\"/watch/$VID\"><IMG SRC=\"$vThumb\" width=\"100\"><BR>$vArtist<BR>$vTitle</A><BR>";
    //$newVids .= "<TD VALIGN=\"top\"><A HREF=\"/watch/$VID\"><IMG SRC=\"$vThumb\" width=\"100\"><BR>$vArtist<BR>$vTitle</A></TD>";
    }
  //$newVids .= "</TR></TABLE>";

  $data['tpl']->assign("NEW_VIDS",$newVids);

  $query = "SELECT uid,username,main_image,profile_image FROM users WHERE active = 1 ORDER BY uid DESC LIMIT 0,5";

  $res = mysql_query($query);

  $newMembers = "<TABLE BORDER=\"0\"><TR>";

  for ($i = 0;$i < mysql_num_rows($res);$i++) {
    $username = mysql_result($res,$i,'username');
    /* Set Profile Image */
    $mid = mysql_result($res,$i,'profile_image');
    if ($mid == 0)
      $thumb = mysql_result($res,$i,'main_image');
    else
      $thumb = $avatars[$mid];

    $newMembers .= "<TD><A HREF=\"/$username\"><IMG SRC=\"$thumb-small.png\" width=\"100\"><BR>$username</A></TD>";
    }

  $newMembers .= "</TR></TABLE>";
  $data['tpl']->assign("NEW_MEMBERS",$newMembers);
  



  /* Parse and print */
  $data[tpl]->parse(BODY, array("body"));
  $data[tpl]->parse(INDEX, array("index"));
  $data[tpl]->FastPrint("INDEX");
?>
