<?

  function main ()
  {
    $_GET['cat_id'] = strip_tags ($_GET['cat_id']);
    $_GET['id'] = strip_tags ($_GET['id']);
    $_GET['topmenuitem'] = strip_tags ($_GET['topmenuitem']);
    echo '<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td>';
    include 'lang/' . language;
    function interview ()
    {
      include 'config.inc.php';
      include 'lang/' . language;
      if ($_GET['tim'])
      {
        $SQL1 = '' . 'SELECT * FROM articles WHERE type=3 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT ' . interv_amount;
      }
      else
      {
        $SQL1 = 'SELECT * FROM articles WHERE type=3 ORDER by tim DESC LIMIT ' . interv_amount;
      }

      if (!($result = mysql_query ($SQL1)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      echo '		
		<table width="';
      echo interv_wind_width;
      echo '" border="0" cellspacing="0" cellpadding="5" ';
      if (interv_border == '1')
      {
        echo 'style="border: 1px solid gray;"';
      }

      echo ' bgcolor="';
      echo interv_bg_color;
      echo '">

			';
      while ($row = mysql_fetch_array ($result))
      {
        echo '<tr><td valign="top">
				<a href="index.php?id=';
        echo $row['id'];
        echo '" STYLE="color:';
        echo interv_title_color;
        echo '; font-family:';
        echo interv_title_font;
        echo '; font-size:';
        echo interv_title_font_size;
        echo '; font-weight:';
        echo interv_title_font_weight;
        echo ';">';
        echo $row['title'];
        echo '</a><br>';
        if (interv_tmb_display == 'yes')
        {
          if ($dir = @opendir ('upload/thumbnails/'))
          {
            while ($file = readdir ($dir) !== false)
            {
              if (strstr ($file, $row['tim']))
              {
                echo '<A href="index.php?id=';
                echo $row['id'];
                echo '"><IMG SRC="upload/thumbnails/';
                echo $file;
                echo '" vspace="3" align="';
                echo interv_tmb_align;
                echo '" ';
                if (interv_tmb_width)
                {
                  echo 'width="';
                  echo interv_tmb_width;
                  echo '"';
                }

                echo ' ';
                if (interv_tmb_height)
                {
                  echo 'height="';
                  echo interv_tmb_height;
                  echo '"';
                }

                echo ' style="border: 1px solid Black;"></a>';
                continue;
              }
            }

            closedir ($dir);
          }
        }

        echo '					
					
					<font STYLE="color:';
        echo interv_description_color;
        echo '; font-family:';
        echo interv_description_font;
        echo '; font-size:';
        echo interv_description_font_size;
        echo '; font-weight:';
        echo interv_description_font_weight;
        echo ';">&#8226;&nbsp;';
        echo $row['description'];
        echo '</font><br>
				</td></tr>
			';
      }

      echo '			</table>
';
    }

    function catlist ()
    {
      if ((((((!$_GET['cat_id'] AND !$_GET['id']) AND !$_GET['words']) AND !$_GET['discuss']) AND !$_GET['PostComment']) AND !$_GET['topmenuitem']))
      {
        if (!($result = mysql_query ('SELECT * FROM categories')))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }

        $total = mysql_num_rows ($result);
        $table_rows = ceil ($total / 2);
        echo '		
		<table width="100%" border="0" cellspacing="3" cellpadding="2">
		';
        for ($i = 0; $i < $table_rows; ++$i)
        {
          $cat_title = mysql_fetch_array ($result);
          $r1 = $cat_title['name'];
          echo '		
		<tr>
			<td bgcolor=';
          echo catlist_bg_color;
          echo ' width="50%">';
          if (catlist_bullet == 'yes')
          {
            echo '<img src="upload/Image/bullet.gif" border="0" align="absmiddle"> ';
          }

          echo '<font STYLE="color:';
          echo catlist_color;
          echo '; font-family:';
          echo catlist_font;
          echo '; font-size:';
          echo catlist_font_size;
          echo '; font-weight:';
          echo catlist_font_weight;
          echo ';">';
          echo $cat_title['name'];
          echo '</font></td>
			';
          $cat_title = mysql_fetch_array ($result);
          $r2 = $cat_title['name'];
          if ($r2)
          {
            echo '			<td bgcolor=';
            echo catlist_bg_color;
            echo ' width="50%">';
            if (catlist_bullet == 'yes')
            {
              echo '<img src="upload/Image/bullet.gif" border="0" align="absmiddle"> ';
            }

            echo '<font STYLE="color:';
            echo catlist_color;
            echo '; font-family:';
            echo catlist_font;
            echo '; font-size:';
            echo catlist_font_size;
            echo '; font-weight:';
            echo catlist_font_weight;
            echo ';">';
            echo $r2;
            echo '</font></td>
			';
          }

          echo '		</tr>
		
		<tr>
			<td valign="top">
					';
          if ($_GET['tim'])
          {
            $SQL1 = '' . 'SELECT * FROM articles WHERE instr(category, \'' . $r1 . '\') AND LENGTH(category)=LENGTH(\'' . $r1 . '\') AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC';
          }
          else
          {
            $SQL1 = '' . 'SELECT * FROM articles WHERE instr(category, \'' . $r1 . '\') AND LENGTH(category)=LENGTH(\'' . $r1 . '\') AND status=1 ORDER by tim DESC';
          }

          if (!($result1 = mysql_query ($SQL1)))
          {
            exit ('<b>Error:</b>' . mysql_error ());
            ;
          }

          echo '					';
          for ($ii = 0; $ii < catlist_amount; ++$ii)
          {
            if ($article1 = mysql_fetch_array ($result1))
            {
              echo '<font color="black"><b>.</b></font> <a href="index.php?id=';
              echo $article1['id'];
              echo '" STYLE="color:';
              echo catlist_title_color;
              echo '; font-family:';
              echo catlist_title_font;
              echo '; font-size:';
              echo catlist_title_font_size;
              echo '; font-weight:';
              echo catlist_title_font_weight;
              echo ';">';
              echo $article1['title'];
              echo '</a><br>';
              continue;
            }
          }

          echo '			</td>
			<td valign="top">
					';
          if ($_GET['tim'])
          {
            $SQL2 = '' . 'SELECT * FROM articles WHERE instr(category, \'' . $r2 . '\') AND LENGTH(category)=LENGTH(\'' . $r2 . '\') AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC';
          }
          else
          {
            $SQL2 = '' . 'SELECT * FROM articles WHERE instr(category, \'' . $r2 . '\') AND LENGTH(category)=LENGTH(\'' . $r2 . '\') AND status=1 ORDER by tim DESC';
          }

          if (!($result2 = mysql_query ($SQL2)))
          {
            exit ('<b>Error:</b>' . mysql_error ());
            ;
          }

          echo '					';
          for ($ii = 0; $ii < catlist_amount; ++$ii)
          {
            if (($r2 AND $article2 = mysql_fetch_array ($result2)))
            {
              echo '<font color="black"><b>.</b></font> <a href="index.php?id=';
              echo $article2['id'];
              echo '" STYLE="color:';
              echo catlist_title_color;
              echo '; font-family:';
              echo catlist_title_font;
              echo '; font-size:';
              echo catlist_title_font_size;
              echo '; font-weight:';
              echo catlist_title_font_weight;
              echo ';">';
              echo $article2['title'];
              echo '</a><br>';
              continue;
            }
          }

          echo '			</td>
		</tr>

		';
        }

        echo '		</table>
';
      }

    }

    function last2post ()
    {
      if ((((((!$_GET['cat_id'] AND !$_GET['id']) AND !$_GET['words']) AND !$_GET['discuss']) AND !$_GET['PostComment']) AND !$_GET['topmenuitem']))
      {
        if (las2post_category != 'All')
        {
          if ($_GET['tim'])
          {
            $SQL1 = 'SELECT * FROM articles WHERE instr(category, \'' . las2post_category . ('' . '\') AND status=1 AND type<1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT') . las2post_amount;
          }
          else
          {
            $SQL1 = 'SELECT * FROM articles WHERE instr(category, \'' . las2post_category . '\') AND status=1 AND type<1 ORDER by tim DESC LIMIT ' . las2post_amount;
          }
        }
        else
        {
          if ($_GET['tim'])
          {
            $SQL1 = '' . 'SELECT * FROM articles WHERE status=1 AND type<1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT ' . las2post_amount;
          }
          else
          {
            $SQL1 = 'SELECT * FROM articles WHERE status=1 AND type<1 ORDER by tim DESC LIMIT ' . las2post_amount;
          }
        }

        if (!($result1 = mysql_query ($SQL1)))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }

        $total = mysql_num_rows ($result1);
        for ($i = 0; $i < las2post_amount / las2post_column; ++$i)
        {
          if ($i < $total / las2post_column)
          {
            echo '		
		<table width="100%" border="0" cellspacing="3" background="images/back.gif"><tr>

		';
            for ($j = 0; $j < las2post_column; ++$j)
            {
              $row1 = mysql_fetch_array ($result1);
              echo '
		<td width="25%" valign="top" ';
              if ($j < las2post_column - 1)
              {
                echo 'style="border-';
                if (txt_direction == 'LTR')
                {
                  echo 'right';
                }
                else
                {
                  echo 'left';
                }

                echo ': 1px dotted gray;"';
              }

              echo ' width="50%">
		<a href="index.php?id=';
              echo $row1['id'];
              echo '" STYLE="color:';
              echo las2post_title_color;
              echo '; font-family:';
              echo las2post_title_font;
              echo '; font-size:';
              echo las2post_title_font_size;
              echo '; font-weight:';
              echo las2post_title_font_weight;
              echo ';">';
              echo $row1['title'];
              echo '</a><br>
		<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="5"></td></tr></table>

		';
              if ($dir = @opendir ('upload/thumbnails'))
              {
                while ($file = readdir ($dir) !== false)
                {
                  if (strstr ($file, $row1['tim']))
                  {
                    echo '<a href="index.php?id=';
                    echo $row1['id'];
                    echo '"><IMG SRC="upload/thumbnails/';
                    echo $file;
                    echo '" hspace="2" align="';
                    echo las2post_tmb_align;
                    echo '" ';
                    if (las2post_tmb_width)
                    {
                      echo 'width="';
                      echo las2post_tmb_width;
                      echo '"';
                    }

                    echo ' ';
                    if (las2post_tmb_height)
                    {
                      echo 'height="';
                      echo las2post_tmb_height;
                      echo '"';
                    }

                    echo ' style="border: 1px solid Black;"></a>';
                    continue;
                  }
                }

                closedir ($dir);
              }

              echo '		<font STYLE="color:';
              echo las2post_description_color;
              echo '; font-family:';
              echo las2post_description_font;
              echo '; font-size:';
              echo las2post_description_font_size;
              echo '; font-weight:';
              echo las2post_description_font_weight;
              echo ';">';
              echo $row1['description'];
              echo '</font>
		</td>
	';
            }

            echo '	</tr></table>';
            if ($i + 1 < $total / las2post_column)
            {
              echo '<table width="100%" border="0" cellspacing="0" style="border-bottom: 1px dotted gray;"><tr><td></td></tr></table>';
              continue;
            }

            continue;
          }
        }
      }

    }

    function day_article ()
    {
      if ($_GET['tim'])
      {
        $SQL = '' . 'SELECT * FROM articles WHERE type=1 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC';
      }
      else
      {
        $SQL = 'SELECT * FROM articles WHERE type=1 AND status=1 ORDER by tim DESC';
      }

      if (!($result = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row = mysql_fetch_array ($result);
      if ($_GET['tim'])
      {
        $SQL = '' . 'SELECT * FROM articles WHERE type=2 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT ' . head_day_amount;
      }
      else
      {
        $SQL = 'SELECT * FROM articles WHERE type=2 AND status=1 ORDER by tim DESC LIMIT ' . head_day_amount;
      }

      if (!($result1 = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      echo '			<table width="100%" border="0" cellspacing="0" cellpadding="5" style="border-bottom: 1px dotted gray;"><tr>
			<td width="300" valign="top">
';
      if ($dir = @opendir ('upload/images'))
      {
        while ($file = readdir ($dir) !== false)
        {
          if (strstr ($file, $row['tim']))
          {
            echo '<a href="index.php?id=';
            echo $row['id'];
            echo '"><IMG SRC="upload/images/';
            echo $file;
            echo '" ';
            if (day_image_width)
            {
              echo 'width="';
              echo day_image_width;
              echo '"';
            }

            echo ' ';
            if (day_image_height)
            {
              echo 'height="';
              echo day_image_height;
              echo '"';
            }

            echo ' style="border: 1px solid Black;"></a><BR>';
            continue;
          }
        }

        closedir ($dir);
      }

      echo '				<a href="index.php?id=';
      echo $row['id'];
      echo '" STYLE="color:';
      echo day_title_color;
      echo '; font-family:';
      echo day_title_font;
      echo '; font-size:';
      echo day_title_font_size;
      echo '; font-weight:';
      echo day_title_font_weight;
      echo ';">';
      echo $row['title'];
      echo '</a><br>
				<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="5"></td></tr></table>
				<font STYLE="color:';
      echo day_description_color;
      echo '; font-family:';
      echo day_description_font;
      echo '; font-size:';
      echo day_description_font_size;
      echo '; font-weight:';
      echo day_description_font_weight;
      echo ';">';
      echo $row['description'];
      echo '</font>
			
			</td>
			<td width="170" valign="top" style="border-';
      if (txt_direction == 'LTR')
      {
        echo 'left';
      }
      else
      {
        echo 'right';
      }

      echo ': 1px dotted gray;">

			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			';
      while ($row1 = mysql_fetch_array ($result1))
      {
        echo '			<tr><td valign="top">
			<font color="black"><b>.</b></font> <a href="index.php?id=';
        echo $row1['id'];
        echo '" STYLE="color:';
        echo head_day_title_color;
        echo '; font-family:';
        echo head_day_title_font;
        echo '; font-size:';
        echo head_day_title_font_size;
        echo '; font-weight:';
        echo head_day_title_font_weight;
        echo ';">';
        echo $row1['title'];
        echo '</a>
			<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="5"></td></tr></table>
			';
        if (head_day_tmb == 'yes')
        {
          if ($dir = @opendir ('upload/thumbnails/'))
          {
            while ($file = readdir ($dir) !== false)
            {
              if (strstr ($file, $row1['tim']))
              {
                echo '<a href="index.php?id=';
                echo $row1['id'];
                echo '"><IMG SRC="upload/thumbnails/';
                echo $file;
                echo '" align="';
                echo head_day_tmb_align;
                echo '" ';
                if (head_day_tmb_align)
                {
                  echo 'width="';
                  echo head_day_tmb_width;
                  echo '"';
                }

                echo ' ';
                if (head_day_tmb_height)
                {
                  echo 'height="';
                  echo head_day_tmb_height;
                  echo '"';
                }

                echo ' style="border: 1px solid Black;"></a>';
                continue;
              }
            }

            closedir ($dir);
          }
        }

        echo '					
				<font STYLE="color:';
        echo head_day_description_color;
        echo '; font-family:';
        echo head_day_description_font;
        echo '; font-size:';
        echo head_day_description_font_size;
        echo '; font-weight:';
        echo head_day_description_font_weight;
        echo ';">';
        echo $row1['description'];
        echo '</font><br>
				</td></tr>
				';
      }

      echo '			</table>
			</td>

			</tr></table>
';
    }

    function typical_article ()
    {
      include 'lang/' . language;
      if ($_GET['tim'])
      {
        $SQL = '' . 'SELECT * FROM articles WHERE category=\'' . $_GET['cat_id'] . '\' AND type=0 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT ' . typical_amount;
      }
      else
      {
        $SQL = '' . 'SELECT * FROM articles WHERE category=\'' . $_GET['cat_id'] . '\' AND type=0 AND status=1 ORDER by tim DESC LIMIT ' . typical_amount;
      }

      if (!($result = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row = mysql_fetch_array ($result);
      if (!($result = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      if ($dir = @opendir ('upload/cat_images/'))
      {
        while ($file = readdir ($dir) !== false)
        {
          if (strpos ($_GET['cat_id'], '~'))
          {
            $patt = substr ($_GET['cat_id'], 0, strpos ($_GET['cat_id'], '~'));
          }
          else
          {
            $patt = $_GET['cat_id'];
          }

          if (strstr ($file, $patt))
          {
            echo '<IMG SRC="upload/cat_images/';
            echo $file;
            echo '" width="100%" border=0>';
            continue;
          }
        }

        closedir ($dir);
      }

      echo '
';
      if ($_GET['tim'])
      {
        $SQL0 = '' . 'SELECT * FROM articles WHERE instr(category,\'' . $_GET['cat_id'] . '\') AND type=2 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT ' . typical_headlines_amount;
      }
      else
      {
        $SQL0 = '' . 'SELECT * FROM articles WHERE instr(category,\'' . $_GET['cat_id'] . '\') AND type=2 AND status=1 ORDER by tim DESC LIMIT ' . typical_headlines_amount;
      }

      if (!($result0 = mysql_query ($SQL0)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row0 = mysql_fetch_array ($result0);
      if (!($result0 = mysql_query ($SQL0)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      if ($row0)
      {
        echo '		
			<table width="150" border="0" cellspacing="0" cellpadding="7" align="right" style="border: ';
        if (typical_headlines_border == 1)
        {
          echo 1;
        }
        else
        {
          echo 0;
        }

        echo 'px solid ';
        echo typical_headlines_border_color;
        echo '; background: ';
        echo typical_headlines_bg_color;
        echo ';">
			<tr bgcolor="';
        echo typical_headlines__bg__color;
        echo '"><td align="center" valign="top"><font STYLE="color:';
        echo typical_headlines__color;
        echo '; font-family:';
        echo typical_headlines__font;
        echo '; font-size:';
        echo typical_headlines__font__size;
        echo '; font-weight:';
        echo typical_headlines__font__weight;
        echo ';">';
        echo $text__Headlines;
        echo '</font></td></tr>
			<tr><td valign="top">
			';
        while ($row0 = mysql_fetch_array ($result0))
        {
          echo '<a href="index.php?id=';
          echo $row0['id'];
          echo '" STYLE="color:';
          echo typical_headlines_title_color;
          echo '; font-family:';
          echo typical_headlines_title_font;
          echo '; font-size:';
          echo typical_headlines_title_font_size;
          echo '; font-weight:';
          echo typical_headlines_title_font_weight;
          echo ';">';
          echo $row0['title'];
          echo '</a>
				<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="5"></td></tr></table>
				';
          if (typical_headlines_tmb == 'yes')
          {
            if ($dir = @opendir ('upload/thumbnails/'))
            {
              while ($file = readdir ($dir) !== false)
              {
                if (strstr ($file, $row0['tim']))
                {
                  echo '<a href="index.php?id=';
                  echo $row0['id'];
                  echo '"><IMG SRC="upload/thumbnails/';
                  echo $file;
                  echo '" vspace="5" align="';
                  echo typical_headlines_tmb_align;
                  echo '" ';
                  if (typical_headlines_tmb_width)
                  {
                    echo 'width="';
                    echo typical_headlines_tmb_width;
                    echo '"';
                  }

                  echo ' ';
                  if (typical_headlines_tmb_height)
                  {
                    echo 'height="';
                    echo typical_headlines_tmb_height;
                    echo '"';
                  }

                  echo '></a>';
                  continue;
                }
              }

              closedir ($dir);
            }
          }

          echo '					
					
					<font STYLE="color:';
          echo typical_headlines_description_color;
          echo '; font-family:';
          echo typical_headlines_description_font;
          echo '; font-size:';
          echo typical_headlines_description_font_size;
          echo '; font-weight:';
          echo typical_headlines_description_font_weight;
          echo ';">&#8226;&nbsp;';
          echo $row0['description'];
          echo '</font><br>
			';
        }

        echo '			</td></tr></table>
	';
      }

      echo '		
		
	<table border="0">
		
	';
      while ($row = mysql_fetch_array ($result))
      {
        echo '			<tr><td valign="top">
				<a href="index.php?id=';
        echo $row['id'];
        echo '" STYLE="color:';
        echo typical_title_color;
        echo '; font-family:';
        echo typical_title_font;
        echo '; font-size:';
        echo typical_title_font_size;
        echo '; font-weight:';
        echo typical_title_font_weight;
        echo ';">';
        echo $row['title'];
        echo '</a>
			</td></tr>
			
			<tr><td valign="top" height=1></td></tr>
			
			<tr><td valign="top">
				';
        if ($dir = @opendir ('upload/thumbnails/'))
        {
          while ($file = readdir ($dir) !== false)
          {
            if (strstr ($file, $row['tim']))
            {
              echo '<a href="index.php?id=';
              echo $row['id'];
              echo '"><IMG SRC="upload/thumbnails/';
              echo $file;
              echo '" align="';
              echo typical_tmb_align;
              echo '" ';
              if (typical_tmb_width)
              {
                echo 'width="';
                echo typical_tmb_width;
                echo '"';
              }

              echo ' ';
              if (typical_tmb_height)
              {
                echo 'height="';
                echo typical_tmb_height;
                echo '"';
              }

              echo ' style="border: 1px solid Black;"></a>';
              continue;
            }
          }

          closedir ($dir);
        }

        echo '				
				<font STYLE="color:';
        echo typical_description_color;
        echo '; font-family:';
        echo typical_description_font;
        echo '; font-size:';
        echo typical_description_font_size;
        echo '; font-weight:';
        echo typical_description_font_weight;
        echo ';">';
        echo $row['description'];
        echo '</font>
	
			</td></tr>
			<tr><td valign="top" height=7></td></tr>
	';
      }

      echo '		
		</table>
';
    }

    function display_article ()
    {
      include 'lang/' . language;
      if (!($result = mysql_query ('' . 'select * from articles where id=\'' . $_GET['id'] . '\'')))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row = mysql_fetch_array ($result);
      if ($row['id'])
      {
        if ($dir = @opendir ('upload/cat_images'))
        {
          while ($file = readdir ($dir) !== false)
          {
            if (strstr ($file, $row['category']))
            {
              echo '<IMG SRC="upload/cat_images/';
              echo $file;
              echo '" BORDER="0">';
              continue;
            }
          }

          closedir ($dir);
        }

        echo '<table width="100%" border="0"><tr><td height=5></td></tr></table>
<font STYLE="color:';
        echo title_color;
        echo '; font-family:';
        echo title_font;
        echo '; font-size:';
        echo title_font_size;
        echo '; font-weight:';
        echo title_font_weight;
        echo ';">';
        echo $row['title'];
        echo '</font>

 
<table border="0" cellspacing="0" cellpadding="3">
<tr>
	<td align="left">
		';
        echo '		';
        echo '<s';
        echo 'elect name="rate">
		';
        for ($i = 0; $i < sizeof ($article_vote_options); ++$i)
        {
          echo '<option value="';
          echo sizeof ($article_vote_options) - $i;
          echo '">';
          echo $article_vote_options[$i];
          echo '</option>';
        }

        echo '		</select>
		<input type="hidden" name="id" value="';
        echo $row['id'];
        echo '"><input type="submit" name="article_rate" value="';
        echo $text__Rate;
        echo '">
		';
        echo '	</td>
	<td align="left">';
        rating_result ($_GET['id']);
        echo '</td>
	<td align="right">
	<a href="newsadmin/preview.php?id=';
        echo $row['id'];
        echo '" target="_blank"><img src="inc/images/printer.gif" border="0" alt="';
        echo $text__Printable;
        echo '" align="left"></a>
	<a href="javascript:" onclick="window.open(\'inc/mail2friend.php?url=';
        echo $_SERVER['REQUEST_URI'];
        echo '\',\'form\',\'top=100,left=100,width=300,height=400\');"><img src="inc/images/email.gif" border="0" alt="';
        echo $text__email;
        echo '" align="left"></a>
	<a href="index.php?discuss=';
        echo $row['id'];
        echo '"><img src="inc/images/forum.gif" border="0" alt="';
        echo $text__discuss;
        echo '" align="left"></a>
	</td>
	<td align="right"><a href="inc/rss.php?id=';
        echo $row['id'];
        echo '" target="_blank"><img src="inc/images/xml.gif" border="0"></a></td>
</tr>
</table>
<table width="100%" border="0" style="border-top: 1px solid Silver;"><tr><td height=5></td></tr></table>

<table border="0" cellspacing="0" cellpadding="5" align="right"><tr><td valign="top">


			';
        if ($dir = @opendir ('upload/images'))
        {
          while ($file = readdir ($dir) !== false)
          {
            if (strstr ($file, $row['tim']))
            {
              echo '<IMG SRC="upload/images/';
              echo $file;
              echo '" ';
              if (image_width)
              {
                echo 'width="';
                echo image_width;
                echo '"';
              }

              echo ' ';
              if (image_height)
              {
                echo 'height="';
                echo image_height;
                echo '"';
              }

              echo ' style="border: 1px solid Black;">';
              continue;
            }
          }

          closedir ($dir);
        }

        echo '
</td></tr><tr><td>



';
        if (!($result_related = mysql_query ('' . 'select * from articles where type=0 AND status=1 AND id!=' . $row['id'] . ' AND category=\'' . addslashes ($row['category']) . '\' ORDER by tim DESC LIMIT ' . headlines_amount)))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }

        $total = mysql_num_rows ($result_related);
        if ($total)
        {
          echo '
<table width="';
          if (image_width)
          {
            echo image_width;
          }
          else
          {
            echo '150';
          }

          echo '" border="0" cellspacing="0" cellpadding="7" style="border: ';
          if (headlines_border == 1)
          {
            echo 1;
          }
          else
          {
            echo 0;
          }

          echo 'px solid ';
          echo headlines_border_color;
          echo '; background: ';
          echo headlines_bg_color;
          echo ';">
<tr>
	<td align="center" bgcolor="';
          echo headlines__bg__color;
          echo '"><font STYLE="color:';
          echo headlines__color;
          echo '; font-family:';
          echo headlines__font;
          echo '; font-size:';
          echo headlines__font__size;
          echo '; font-weight:';
          echo headlines__font__weight;
          echo ';">';
          echo $text__Releated_articles;
          echo '</font></td>
</tr>
<tr>
	<td>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
';
          while ($row_related = mysql_fetch_array ($result_related))
          {
            echo '<tr><td>
				<a href="index.php?id=';
            echo $row_related['id'];
            echo '" STYLE="color:';
            echo headlines_title_color;
            echo '; font-family:';
            echo headlines_title_font;
            echo '; font-size:';
            echo headlines_title_font_size;
            echo '; font-weight:';
            echo headlines_title_font_weight;
            echo ';">';
            echo $row_related['title'];
            echo '</a>
				';
            if (headlines_tmb == 'yes')
            {
              if ($dir = @opendir ('upload/thumbnails/'))
              {
                while ($file = readdir ($dir) !== false)
                {
                  if (strstr ($file, $row_related['tim']))
                  {
                    echo '<a href="index.php?id=';
                    echo $row_related['id'];
                    echo '"><IMG SRC="upload/thumbnails/';
                    echo $file;
                    echo '" vspace="5"  align="';
                    echo tmb_align;
                    echo '" ';
                    if (tmb_width)
                    {
                      echo 'width="';
                      echo tmb_width;
                      echo '"';
                    }

                    echo ' ';
                    if (tmb_height)
                    {
                      echo 'height="';
                      echo tmb_height;
                      echo '"';
                    }

                    echo '></a>';
                    continue;
                  }
                }

                closedir ($dir);
              }
            }

            echo '<br><font STYLE="color:';
            echo headlines_description_color;
            echo '; font-family:';
            echo headlines_description_font;
            echo '; font-size:';
            echo headlines_description_font_size;
            echo '; font-weight:';
            echo headlines_description_font_weight;
            echo ';">&#8226;&nbsp;';
            echo $row_related['description'];
            echo '</font>';
            echo '</td></tr>';
          }

          echo '</table>

	</td>
</tr>
</table>
';
        }

        echo '

</td></tr></table>
				
				
<font style="color: navy; font-family:tahoma; font-size:11px;"><u>';
        echo '' . $text__Posted . ' ' . showdate ($row['tim']);
        echo '</u></FONT><br>
&#8226;&nbsp;<font STYLE="color:';
        echo description_color;
        echo '; font-family:';
        echo description_font;
        echo '; font-size:';
        echo description_font_size;
        echo '; font-weight:';
        echo description_font_weight;
        echo ';">';
        echo $row['description'];
        echo '</font><br><br>';
        if ($dir = @opendir ('upload/multimedia'))
        {
          while ($file = readdir ($dir) !== false)
          {
            if (strstr ($file, $row['tim']))
            {
              echo '<A HREF="upload/multimedia/';
              echo $file;
              echo '" BORDER="0"><img src="inc/images/wmedia.gif" vspace="5" alt="';
              echo $text__Multimedia;
              echo '" align="left" border="0"></A>';
              $image_size = getimagesize ('' . 'upload/images/' . $file);
              continue;
            }
          }

          closedir ($dir);
        }

        echo $row['body'];
      }

    }

    function rating ()
    {
      include 'config.inc.php';
      if (!($result = mysql_query ('' . 'select * from rating where id=\'' . $_GET['id'] . '\'')))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      if ($row = mysql_fetch_array ($result))
      {
        if ($row['time'] < $curtime[0] - 3600)
        {
          $SQL = 'UPDATE rating SET rating=\'' . ($row['rating'] + $_GET['rate']) . '\', amount=\'' . ($row['amount'] + 1) . ('' . '\', time=\'' . $curtime['0'] . '\' WHERE id=\'' . $_GET['id'] . '\'');
          if (!(mysql_query ($SQL)))
          {
            exit ('<b>Error:</b>' . mysql_error ());
            ;
          }
        }
      }
      else
      {
        $SQL = '' . 'INSERT INTO rating VALUES(\'' . $_GET['id'] . '\',\'' . $_GET['rate'] . '\',\'1\',\'' . $curtime['0'] . '\')';
        if (!(mysql_query ($SQL)))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }
      }

    }

    function rating_result ($ID)
    {
      include 'lang/' . language;
      if (!($result = mysql_query ('' . 'select * from rating where id=\'' . $ID . '\'')))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      if ($row = mysql_fetch_array ($result))
      {
        $RATE = $row['rating'] / $row['amount'];
        echo '' . '<font style="color: navy; font-family:arial; font-size:11px;"><b>' . $text__Rating . ' ';
        for ($i = 0; $i < floor ($RATE); ++$i)
        {
          echo '<img src="inc/images/star.gif" border="0" align="absmiddle">';
        }

        if (floor ($RATE) < round ($RATE, 0))
        {
          echo '<img src="inc/images/halfstar.gif" border="0" align="absmiddle">';
        }

        for ($i = 0; $i < sizeof ($article_vote_options) - round ($RATE, 0); ++$i)
        {
          echo '<img src="inc/images/emptystar.gif" border="0" align="absmiddle">';
        }

        echo ' <font color="#800000">' . round ($RATE, 2) . '</font> / ' . sizeof ($article_vote_options) . ('' . '</b> (' . $row['amount'] . ' ' . $text__votes . ')</font>&nbsp;&nbsp;');
      }
      else
      {
        echo '<font style="color: navy; font-family:tahoma; font-size:11px;">';
        echo $text__Rating;
        echo '</font>';
        for ($i = 0; $i < sizeof ($article_vote_options); ++$i)
        {
          echo '<img src="inc/images/emptystar.gif" border="0" align="absmiddle">';
        }

        echo '<font style="color: navy; font-family:tahoma; font-size:11px;"> (0 ';
        echo $text__votes;
        echo ')</font>';
      }

    }

    function search_results ()
    {
      include 'lang/' . language;
      $words = str_replace ('"', '', trim ($_GET['words']));
      $SQL = 'select * from articles where title LIKE \'%' . $words . '%\' or description LIKE \'%' . $words . '%\' or body LIKE \'%' . $words . '%\' ORDER by tim DESC';
      if (!($result = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $found = mysql_num_rows ($result);
      if (($_GET['limit'] AND !$_GET['last']))
      {
        $SQLL = $SQL . ' LIMIT ' . $_GET['limit'] . ',10';
      }
      else
      {
        if ($_GET['last'])
        {
          $SQLL = $SQL . ' LIMIT ' . $_GET['limit'] . ',' . $_GET['last'];
        }
        else
        {
          $SQLL = $SQL . ' LIMIT 10';
        }
      }

      if (!($result = mysql_query ($SQLL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      echo '
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">
	<TR><TD COLSPAN="2" ALIGN="center" style="background-color:#DDDDDD;"><font style="color:black; font-family: tahoma; font-size:  12px;"><B>';
      echo $text__Search_Result;
      echo '</B> ';
      echo $text__found;
      echo ' <FONT COLOR="Red"><B>';
      echo $found;
      echo '</B></FONT> ';
      echo $text__articles_for;
      echo ' <FONT COLOR="Red"><B>"';
      echo $words;
      echo '"</B></FONT></font></TD></TR>
	<TR><TD colspan=2>

	';
      $count = 0;
      while ($row = mysql_fetch_array ($result))
      {
        echo '
		<font style="color:black; font-family: tahoma; font-size:12px;">';
        echo ++$count + $_GET['limit'];
        echo ' - </FONT><A HREF="index.php?id=';
        echo $row['id'];
        echo '" style="color:blue; font-family:tahoma; font-size:12px;">';
        echo str_replace ($words, '<FONT COLOR=Red><B>' . $words . '</B></FONT>', stripslashes ($row['title']));
        echo '</A><BR>

		<font style="color:black; font-family: tahoma; font-size:12px;">
			';
        echo str_replace ($words, '<FONT COLOR=Red><B>' . $words . '</B></FONT>', stripslashes ($row['title'])) . '<BR><br>';
        echo '		</FONT>

';
      }

      echo '
	</TD></TR><TR><TD colspan=2 ALIGN="center"><BR>


	<font style="font-family: tahoma; font-size: 12px;">
	';
      for ($i = 0; $i < floor ($found / 10); ++$i)
      {
        if ($_GET['limit'] / 10 == $i)
        {
          echo '<FONT COLOR="Navy">';
          echo $i * 10 + 1;
          echo '-';
          echo $i * 10 + 10;
          echo '</FONT>&nbsp;';
          continue;
        }
        else
        {
          echo '<A HREF="index.php?words=';
          echo $words;
          echo '&where=';
          echo $_GET['where'];
          echo '&limit=';
          echo $i * 10;
          echo '" style="color: navy;">';
          echo $i * 10 + 1;
          echo '-';
          echo $i * 10 + 10;
          echo '</A>&nbsp;';
          continue;
        }
      }

      if ((10 < $found AND !$_GET['last']))
      {
        if (0 < $found - floor ($found / 10) * 10)
        {
          echo '<A HREF="index.php?words=';
          echo $words;
          echo '&where=';
          echo $_GET['where'];
          echo '&limit=';
          echo $i * 10;
          echo '&last=';
          echo $found - floor ($found / 10) * 10;
          echo '" style="color: navy;">';
          echo $text__last_link;
          echo '&nbsp;';
          echo $found - floor ($found / 10) * 10;
          echo '</A>&nbsp;';
        }
      }
      else
      {
        echo '<FONT COLOR="Navy">';
        echo $text__last_link;
        echo '&nbsp;';
        echo $found - floor ($found / 10) * 10;
        echo '</FONT>';
      }

      echo '</FONT>
	</TD></TR></TABLE>
';
    }

    function display_comments ()
    {
      include 'lang/' . language;
      if (!($result1 = mysql_query ('' . 'select * from articles where id=' . $_GET['discuss'])))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row1 = mysql_fetch_array ($result1);
      echo '<font STYLE="color:';
      echo title_color;
      echo '; font-family:';
      echo title_font;
      echo '; font-size:';
      echo title_font_size;
      echo '; font-weight:';
      echo title_font_weight;
      echo ';">';
      echo $row1['title'];
      echo '<hr></font>';
      echo '<div align="right"><input type="button" name="PostComment" value="';
      echo $text__Add_Comment;
      echo '" onclick="window.open(\'inc/comments.php?id=';
      echo $row1['id'];
      echo '\',\'form\',\'top=100,left=100,width=360,height=400\');"></div>';
      if (!($result = mysql_query ('' . 'select * from comments where parent=' . $_GET['discuss'])))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      while ($row = mysql_fetch_array ($result))
      {
        echo '<li><a href="mailto:';
        echo $row['email'];
        echo '"><font STYLE="color:blue; font-family:';
        echo typical_description_font;
        echo '; font-size:';
        echo typical_description_font_size;
        echo '; font-weight:';
        echo typical_description_font_weight;
        echo ';">';
        echo $row['name'];
        echo '</font></a>&nbsp;';
        echo '<font STYLE="color:';
        echo typical_description_color;
        echo '; font-family:';
        echo typical_description_font;
        echo '; font-size:';
        echo typical_description_font_size;
        echo '; font-weight:';
        echo typical_description_font_weight;
        echo ';"><i>(';
        echo $text__Posted . ' ' . showdate ($row['tim']);
        echo ')</i></font>';
        echo '<br><font STYLE="color:';
        echo typical_description_color;
        echo '; font-family:';
        echo typical_description_font;
        echo '; font-size:';
        echo typical_description_font_size;
        echo '; font-weight:';
        echo typical_description_font_weight;
        echo ';">';
        echo $row['comment'];
        echo '</font>';
      }

      echo '<br><br><br>';
    }

    function session ()
    {
      include 'config.inc.php';
      $reset = date ('t', $curtime[0]);
      if (!($result = mysql_query ('SELECT * FROM session')))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $unitotal = mysql_fetch_array ($result);
      if (!$unitotal)
      {
        if (!(mysql_query ('INSERT INTO session VALUES(\'0\',\'1\',\'yes\')')))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }
      }

      if (($reset == 0 AND $unitotal['reset'] == 'yes'))
      {
        if (!(mysql_query ('DELETE FROM session_detail')))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }

        if (!(mysql_query ('UPDATE session SET reset=\'no\'')))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }
      }

      if (0 < $reset)
      {
        if (!(mysql_query ('UPDATE session SET reset=\'yes\'')))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }
      }

      $ADDR = $_SERVER['REMOTE_ADDR'];
      $HOST = gethostbyaddr ($_SERVER['REMOTE_ADDR']);
      $REFF = $_SERVER['HTTP_REFERER'];
      $URI = $_SERVER['REQUEST_URI'];
      if ($URI == '/')
      {
        $URI = 'http://' . $_SERVER['HTTP_HOST'];
      }
      else
      {
        $URI = 'http://' . $_SERVER['HTTP_HOST'] . $URI;
      }

      $AGENT = $_SERVER['HTTP_USER_AGENT'];
      if ($ADDR != '62.168.186.25')
      {
        if (!($result1 = mysql_query ('' . 'SELECT * FROM session_detail WHERE REMOTE_ADDR=\'' . $ADDR . '\'')))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }

        $row = mysql_fetch_array ($result1);
        if (!$row)
        {
          $unique_hits = $unitotal['unique_hits'] + 1;
          if (!(mysql_query ('' . 'UPDATE session SET unique_hits=' . $unique_hits)))
          {
            exit ('<b>Error:</b>' . mysql_error ());
            ;
          }
        }

        $total_hits = $unitotal['total_hits'] + 1;
        if (!(mysql_query ('' . 'UPDATE session SET total_hits=' . $total_hits)))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }

        $SQL = '' . 'INSERT INTO session_detail VALUES(\'\',\'' . $ADDR . '\',\'' . $HOST . '\',\'' . $REFF . '\',\'' . $URI . '\',\'' . $AGENT . '\',\'' . $curtime['0'] . '\')';
        if (!(mysql_query ($SQL)))
        {
          exit ('<b>Error:</b>' . mysql_error ());
          ;
        }
      }

    }

    include 'config.inc.php';
    if (counter == 'yes')
    {
      session ();
    }

    if ($_GET['cal_tim'])
    {
      $TMP = split (':', $_GET['cal_tim']);
      for ($i = 0; $i < 12; ++$i)
      {
        if ($TMP[0] == $month[$i])
        {
          $_GET['tim'] = mktime (23, 59, 59, $i + 1, date ('j', $curtime[0]), $TMP[1]);
          continue;
        }
      }
    }

    if (((($_GET['address'] AND !$_GET['words']) AND !$_GET['article_rate']) AND !$_GET['go']))
    {
      echo '<s';
      echo 'cript>window.open(\'newsadmin/newsletter/mailer.php?address=';
      echo $_GET['address'];
      echo '&action=';
      echo $_GET['action'];
      echo '&submitted=';
      echo $_GET['submitted'];
      echo '\',\'form\',\'width=400,height=400\');</script>';
      unset ($_GET[submitted]);
    }

    if ($_GET['article_rate'])
    {
      rating ();
    }

    if ($_GET['cat_id'] != '')
    {
      $SQL = '' . 'SELECT * FROM categories WHERE instr(\'' . $_GET['cat_id'] . '\',name)';
      if (!($result = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row = mysql_fetch_array ($result);
      unset ($granted);
      if (!($result_auth = mysql_query ('select * from visitors')))
      {
        exit ('Invalid query');
        ;
      }

      while ($row_auth = mysql_fetch_array ($result_auth))
      {
        if ($_COOKIE['autorized'] == md5 (md5 ($row_auth['username'] . $row_auth['password'])))
        {
          $granted = true;
          continue;
        }
      }

      if (($row['protect'] == 'on' AND !$granted))
      {
        include 'inc/login.php';
      }
      else
      {
        typical_article ();
      }
    }

    if ($_GET['id'] != '')
    {
      $SQL = '' . 'SELECT * FROM articles WHERE id=' . $_GET['id'];
      if (!($result = mysql_query ($SQL)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row = mysql_fetch_array ($result);
      $SQL1 = '' . 'SELECT * FROM categories WHERE instr(\'' . $row['category'] . '\',name)';
      if (!($result1 = mysql_query ($SQL1)))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row1 = mysql_fetch_array ($result1);
      if (($row1['protect'] == 'on' AND !$_COOKIE['autorized']))
      {
        include 'inc/login.php';
      }
      else
      {
        display_article ();
      }
    }

    if (($_GET['discuss'] AND !$_GET['words']))
    {
      display_comments ();
    }

    if ($_GET['words'] != '')
    {
      if ($_GET['where'] == 1)
      {
        search_results ();
      }
      else
      {
        if (search_where == 'google')
        {
          echo '<iframe src="http://www.google.com/search?q=';
          echo $_GET['words'];
          echo '" frameborder="0" width="100%" height="700" scrolling="auto"></iframe>';
        }

        if (search_where == 'altavista')
        {
          echo '<iframe src="http://www.altavista.com/web/results?q=';
          echo $_GET['words'];
          echo '" frameborder="0" width="100%" height="700" scrolling="auto"></iframe>';
        }

        if (search_where == 'yahoo')
        {
          echo '<iframe src="http://search.yahoo.com/search?p=';
          echo $_GET['words'];
          echo '" frameborder="0" width="100%" height="700" scrolling="auto"></iframe>';
        }
      }
    }

    if ($_GET['rssfeed'] != '')
    {
      rssfeed ($_GET['rssfeed']);
    }

    if (((((!$_GET['cat_id'] AND !$_GET['id']) AND !$_GET['words']) AND !$_GET['discuss']) AND !$_GET['PostComment']))
    {
      if (($_GET['topmenuitem'] AND file_exists ($documentroot . '/upload/topmenu/' . $_GET['topmenuitem'] . '.html')))
      {
        include $documentroot . '/upload/topmenu/' . $_GET['topmenuitem'] . '.html';
      }
      else
      {
        day_article ();
      }
    }

    echo '</td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="5"></td></tr></table>';
  }

  function categories ()
  {
    echo '	<table width="100%" border="0" cellspacing="0" cellpadding="1" ';
    if (cat_border == '1')
    {
      echo 'style="border: 1px solid ';
      echo cat_border_color;
      echo ';"';
    }

    if (cat_border == '2')
    {
      echo 'style="border-top-width:1px; border-top-style:solid; border-top-color:';
      echo cat_border_color;
      echo '; border-left-width:1px; border-left-style:solid; border-left-color:';
      echo cat_border_color;
      echo '; border-right-width:1px; border-right-style:solid; border-right-color:';
      echo cat_border_color;
      echo ';"';
    }

    echo '>
	';
    if (!($result1 = mysql_query ('SELECT * FROM categories')))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    while ($row1 = mysql_fetch_array ($result1))
    {
      echo '
	<tr><td colspan="2" ';
      if ($_GET['cat_id'] == urlencode ($row1['name']))
      {
        echo 'bgcolor=' . cat_color . ' ';
      }
      else
      {
        echo 'bgcolor=' . cat_bg_color . ' ';
      }

      if (cat_border == '2')
      {
        echo 'style="border-bottom-width:1px; border-bottom-style: solid; border-bottom-color:';
        echo cat_border_color;
        echo ';"';
      }

      echo '>
	';
      if (cat_bullet_display == 'yes')
      {
        echo '&nbsp;<img src="upload/Image/cat_bullet.gif" border="0" align="absmiddle">&nbsp;';
      }

      echo '	<a href="index.php';
      if ($_GET['tim'])
      {
        echo '?tim=' . $_GET['tim'] . '&';
      }
      else
      {
        echo '?';
      }

      echo 'cat_id=';
      echo urlencode ($row1['name']);
      echo '" style="text-decoration:';
      echo cat_decoration;
      echo ';color:';
      if ($_GET['cat_id'] == urlencode ($row1['name']))
      {
        echo cat_bg_color;
      }
      else
      {
        echo cat_color;
      }

      echo '; font-family:';
      echo cat_font;
      echo '; font-size:';
      echo cat_font_size;
      echo '; font-weight:';
      echo cat_font_weight;
      echo ';">';
      echo $row1['name'];
      echo '</a>

	';
      if (!($result2 = mysql_query ('' . 'SELECT * FROM sub_categories WHERE parent=\'' . $row1['id'] . '\'')))
      {
        exit ('<b>Error:</b>' . mysql_error ());
        ;
      }

      $row2 = mysql_fetch_array ($result2);
      if ((($row2['name'] != '' AND $_GET['cat_id'] == $row1['name']) OR strstr ($_GET['cat_id'], $row1['name'] . '~')))
      {
        $pieces = split ('
', $row2['name']);
        for ($i = 0; $i < sizeof ($pieces); ++$i)
        {
          echo '			</td></tr><tr><td width="1"></td><td ';
          if ($_GET['cat_id'] == urlencode ($row1['name']) . '~' . $pieces[$i])
          {
            echo 'bgcolor=' . cat_color . ' ';
          }
          else
          {
            echo 'bgcolor=' . cat_bg_color . ' ';
          }

          echo '>
				';
          if (cat_bullet_display == 'yes')
          {
            echo '<img src="upload/Image/cat_sub_bullet.gif" border="0" align="absmiddle">&nbsp;';
          }

          echo '<a href="index.php';
          if ($_GET['tim'])
          {
            echo '?tim=' . $_GET['tim'] . '&';
          }
          else
          {
            echo '?';
          }

          echo 'cat_id=';
          echo urlencode ($row1['name']);
          echo '~';
          echo urlencode ($pieces[$i]);
          echo '" style="text-decoration:';
          echo cat_decoration;
          echo ';color:';
          if ($_GET['cat_id'] == urlencode ($row1['name']) . '~' . $pieces[$i])
          {
            echo cat_bg_color;
          }
          else
          {
            echo cat_color;
          }

          echo '; font-family:';
          echo cat_font;
          echo '; font-size:';
          echo cat_font_size;
          echo '; font-weight:';
          echo cat_font_weight;
          echo ';">';
          echo $pieces[$i];
          echo '</a>
			</td></tr>';
        }
      }

      echo '
	
	</td></tr>
	
	';
    }

    echo '
</table>
';
  }

  function newsletter ($color)
  {
    include 'lang/' . language;
    echo '<table border="0" cellspacing="0" cellpadding="0"><tr><td>
<input type="hidden" name="submitted" value="true">
<input type="text" name="address" value="E-mail Address" onFocus="this.value=\'\'" size="17"><br>
<input type="radio" name="action" value="add" checked><font color="';
    echo $color;
    echo '" style="font-family: Tahoma; font-size: 11;">';
    echo $text__Subscribe;
    echo '</font><br>
<input type="radio" name="action" value="remove"><font color="';
    echo $color;
    echo '" style="font-family: Tahoma; font-size: 11;">';
    echo $text__Unsubscribe;
    echo '</font><BR>
<input type="submit" value="';
    echo $text__Submit;
    echo '">
</td></tr></table>
';
  }

  function search ()
  {
    include 'lang/' . language;
    echo '<input type="text" name="words" size="';
    echo search_width;
    echo '">
<input type="radio" NAME="where" value="1" checked><font STYLE="color:';
    echo search_color;
    echo '; font-family:';
    echo search_font;
    echo '; font-size:';
    echo search_font_size;
    echo '; font-weight:';
    echo search_font_weight;
    echo ';">';
    echo $text__Local;
    echo '</font>
<input type="radio" NAME="where" value="2"><font STYLE="color:';
    echo search_color;
    echo '; font-family:';
    echo search_font;
    echo '; font-size:';
    echo search_font_size;
    echo '; font-weight:';
    echo search_font_weight;
    echo ';">';
    echo $text__Web;
    echo '</font>

<INPUT TYPE="submit" NAME="go" VALUE="';
    echo $text__GO;
    echo '">
';
  }

  function show_last_update ($color)
  {
    include 'lang/' . language;
    if (!($result = mysql_query ('SELECT * FROM articles ORDER by tim DESC')))
    {
      exit ('Invalid query');
      ;
    }

    $row = mysql_fetch_array ($result);
    echo '
	<FONT color="';
    echo $color;
    echo '" face=tahoma STYLE="font-size: 11px;">';
    echo $text__Last_Updated;
    echo ' ';
    echo showdate ($row['tim']);
    echo '</FONT>


';
  }

  function favorites ()
  {
    include 'lang/' . language;
    echo '	<a href="javascript:document.all[0].style.behavior=\'url(#default#homepage)\';document.all[0].setHomePage(location.href);"><img src="inc/images/home.gif" alt="';
    echo $text__Make_this_site_your_Homepage;
    echo '" border="0" ></a>
	<a href="mailto:';
    echo email;
    echo '"><img src="inc/images/e-mail.gif" alt="';
    echo $text__mail_us;
    echo '" border="0"></a>

	';
    echo '<S';
    echo 'CRIPT language=JavaScript>
		var bookmarkurl="';
    echo 'http://' . $_SERVER['SERVER_NAME'];
    echo '"
		var bookmarktitle=" ';
    echo title;
    echo ' "
		document.write(\'<a href="javascript:window.external.AddFavorite(bookmarkurl,bookmarktitle);"><img src="inc/images/favorit.gif" border=0 height=11 width=13 hspace=2 alt="';
    echo $text__Add_to_Favorites;
    echo '"></a>\');
	</SCRIPT>

';
  }

  function scroller ($amount, $color)
  {
    echo '<s';
    echo 'tyle type="text/css">a:link {color:white;} a:visited {color :silver;}</style>';
    include 'config.inc.php';
    if (!($result = mysql_query ('SELECT * FROM articles WHERE status=1 ORDER by tim DESC LIMIT ' . $amount)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    while ($row = mysql_fetch_array ($result))
    {
      $TITLE = $TITLE . ('' . '<a href="index.php?id=' . $row['id'] . '" STYLE="color:' . $color . ';"><font face="Tahoma" style="font-size:12;">' . $row['title'] . '</font></a>&nbsp;&nbsp;-&nbsp;&nbsp;');
    }

    echo '<marquee behavior="scroll" direction="';
    if (txt_direction == 'LTR')
    {
      echo 'left';
    }
    else
    {
      echo 'right';
    }

    echo '" width="100%" scrollamount= "2" scrolldelay= "50" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>';
    echo $TITLE;
    echo '</marquee>';
  }

  function vscroll ()
  {
    include 'config.inc.php';
    include 'lang/' . language;
    if (vscroll_category != '')
    {
      if ($_GET['tim'])
      {
        $SQL = 'SELECT * FROM articles WHERE instr(category, \'' . vscroll_category . ('' . '\') AND tim<' . $_GET['tim'] . ' AND type!=1 AND status=1 ORDER by tim DESC LIMIT ') . vscroll_amount;
      }
      else
      {
        $SQL = 'SELECT * FROM articles WHERE instr(category, \'' . vscroll_category . '\') AND type!=1 AND status=1 ORDER by tim DESC LIMIT ' . vscroll_amount;
      }
    }
    else
    {
      if ($_GET['tim'])
      {
        $SQL = '' . 'SELECT * FROM articles WHERE type!=1 AND tim<' . $_GET['tim'] . ' AND status=1 ORDER by tim DESC LIMIT ' . vscroll_amount;
      }
      else
      {
        $SQL = 'SELECT * FROM articles WHERE type!=1 AND status=1 ORDER by tim DESC LIMIT ' . vscroll_amount;
      }
    }

    if (!($result = mysql_query ($SQL)))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    echo '		
		<MARQUEE "scroll" width="99%" bgcolor="';
    echo vscroll_bg_color;
    echo '" style="border:';
    echo vscroll_border;
    echo 'px solid ';
    echo vscroll_border_color;
    echo ';" vspace=\'0\' direction="';
    echo vscroll_direct;
    echo '" height="';
    echo vscroll_wind_height;
    echo '" width="';
    echo vscroll_wind_width;
    echo '" scrollamount= "2" scrolldelay= "50" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>
		<table width="99%" border="0" cellspacing="0" cellpadding="5">

			';
    while ($row = mysql_fetch_array ($result))
    {
      echo '<tr><td valign="top" style="border-bottom: 1px dotted maroon;">
				<a href="index.php?id=';
      echo $row['id'];
      echo '" STYLE="color:';
      echo vscroll_title_color;
      echo '; font-family:';
      echo vscroll_title_font;
      echo '; font-size:';
      echo vscroll_title_font_size;
      echo '; font-weight:';
      echo vscroll_title_font_weight;
      echo ';">';
      echo $row['title'];
      echo '</a><br>';
      if (vscroll_tmb_display == 'yes')
      {
        if ($dir = @opendir ('upload/thumbnails/'))
        {
          while ($file = readdir ($dir) !== false)
          {
            if (strstr ($file, $row['tim']))
            {
              echo '<a href="index.php?id=';
              echo $row['id'];
              echo '"><IMG SRC="upload/thumbnails/';
              echo $file;
              echo '" vspace="3" align="';
              echo vscroll_tmb_align;
              echo '" ';
              if (vscroll_tmb_width)
              {
                echo 'width="';
                echo vscroll_tmb_width;
                echo '"';
              }

              echo ' ';
              if (vscroll_tmb_height)
              {
                echo 'height="';
                echo vscroll_tmb_height;
                echo '"';
              }

              echo ' style="border: 1px solid Black;"></a>';
              continue;
            }
          }

          closedir ($dir);
        }
      }

      echo '					
					
					<font STYLE="color:';
      echo vscroll_description_color;
      echo '; font-family:';
      echo vscroll_description_font;
      echo '; font-size:';
      echo vscroll_description_font_size;
      echo '; font-weight:';
      echo vscroll_description_font_weight;
      echo ';">&#8226;&nbsp;';
      echo $row['description'];
      echo '</font><br>
				</td></tr>
			';
    }

    echo '			</table>
			</MARQUEE>
';
  }

  function topdate ($color, $font, $size)
  {
    include 'config.inc.php';
    include 'lang/' . language;
    echo '<font style="font-family: ';
    echo $font;
    echo '; font-size: ';
    echo $size;
    echo 'px; color: ';
    echo $color;
    echo ';">
	';
    echo $month[date ('n', $curtime[0]) - 1] . date (' d', $curtime[0]) . ' d., ' . $week_days_full_name[date ('w', $curtime[0])];
    echo '	</font>';
  }

  function topmenu ()
  {
    include 'config.inc.php';
    if (!($result = mysql_query ('SELECT * FROM topmenu')))
    {
      exit ('Query failed4');
      ;
    }

    $SETT = mysql_fetch_array ($result);
    $items = split ('
', $SETT['items']);
    echo '
<table border="0" cellspacing="0" cellpadding="';
    echo topmenu_padding;
    echo '" ';
    if (topmenu_bg_color)
    {
      echo 'bgcolor="';
      echo topmenu_bg_color;
    }

    echo '" ';
    if (topmenu_border == '1')
    {
      echo 'style="border: 1px solid ';
      echo topmenu_border_color;
      echo ';"';
    }

    echo '>
<tr>
	';
    for ($i = 0; $i < sizeof ($items); ++$i)
    {
      if (($items[$i] != '' AND 0 < $i))
      {
        echo '			<td ';
        if (topmenu_horizontal)
        {
          echo 'align="';
          echo topmenu_horizontal;
          echo '"';
        }

        echo ' ';
        if (topmenu_vertical)
        {
          echo 'valign="';
          echo topmenu_vertical;
          echo '"';
        }

        echo ' ';
        if (0 < topmenu_width)
        {
          echo 'width="';
          echo topmenu_width;
          echo '"';
        }

        echo ' ';
        if (0 < topmenu_height)
        {
          echo 'height="';
          echo topmenu_height;
          echo '"';
        }

        echo ' ';
        if (file_exists ($documentroot . '/upload/Image/topmenu_bg.gif'))
        {
          echo 'background="/upload/Image/topmenu_bg"';
        }

        echo ' style="';
        if (topmenu_border == '2')
        {
          echo 'border-top-width:1px; border-top-style:solid; border-top-color:';
          echo topmenu_border_color;
          echo '; border-left-width:1px; border-left-style:solid; border-left-color:';
          echo topmenu_border_color;
          echo '; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:';
          echo topmenu_border_color;
          echo '; ';
          if (sizeof ($items) - $i < 2)
          {
            echo 'border-right-width:1px; border-right-style:solid; border-right-color:';
            echo topmenu_border_color;
            echo ';';
          }
        }

        echo '">
				<a href="index.php?topmenuitem=';
        echo $items[$i];
        echo '" style="text-decoration:';
        echo topmenu_decoration;
        echo ';color:';
        echo topmenu_color;
        echo '; font-family:';
        echo topmenu_font;
        echo '; font-size:';
        echo topmenu_font_size;
        echo '; font-weight:';
        echo topmenu_font_weight;
        echo ';">';
        echo $items[$i];
        echo '</a>
			</td>
		';
        continue;
      }
      else
      {
        echo '			<td ';
        if (topmenu_horizontal)
        {
          echo 'align="';
          echo topmenu_horizontal;
          echo '"';
        }

        echo ' ';
        if (topmenu_vertical)
        {
          echo 'valign="';
          echo topmenu_vertical;
          echo '"';
        }

        echo ' ';
        if (0 < topmenu_width)
        {
          echo 'width="';
          echo topmenu_width;
          echo '"';
        }

        echo ' ';
        if (0 < topmenu_height)
        {
          echo 'height="';
          echo topmenu_height;
          echo '"';
        }

        echo ' ';
        if (file_exists ($documentroot . '/upload/Image/topmenu_bg.gif'))
        {
          echo 'background="/upload/Image/topmenu_bg"';
        }

        echo ' style="';
        if (topmenu_border == '2')
        {
          echo 'border-top-width:1px; border-top-style:solid; border-top-color:';
          echo topmenu_border_color;
          echo '; border-left-width:1px; border-left-style:solid; border-left-color:';
          echo topmenu_border_color;
          echo '; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:';
          echo topmenu_border_color;
          echo '; ';
          if (sizeof ($items) - $i < 2)
          {
            echo 'border-right-width:1px; border-right-style:solid; border-right-color:';
            echo topmenu_border_color;
            echo ';';
          }
        }

        echo '">
				<a href="/" style="text-decoration:';
        echo topmenu_decoration;
        echo ';color:';
        echo topmenu_color;
        echo '; font-family:';
        echo topmenu_font;
        echo '; font-size:';
        echo topmenu_font_size;
        echo '; font-weight:';
        echo topmenu_font_weight;
        echo ';">';
        echo $items[$i];
        echo '</a>
			</td>
	
		';
        continue;
      }
    }

    echo '</tr>
</table>

';
  }

  function showdate ($time)
  {
    include 'lang/' . language;
    $out = str_replace ('#d', date ('d', $time), date_format);
    $out = str_replace ('#m', date ('m', $time), $out);
    $out = str_replace ('#M', $month[date ('m', $time)], $out);
    $out = str_replace ('#y', date ('y', $time), $out);
    $out = str_replace ('#Y', date ('Y', $time), $out);
    $out = str_replace ('#h', date ('h', $time), $out);
    $out = str_replace ('#H', date ('H', $time), $out);
    $out = str_replace ('#i', date ('i', $time), $out);
    if (strstr (date_format, '#h'))
    {
      $out = $out . date (' A', $time);
    }

    return $out;
  }

  function show_poll ($id)
  {
    include 'lang/' . language;
    if (!($result1 = mysql_query ('' . 'SELECT * FROM poll WHERE id=' . $id)))
    {
      exit ('Query failed4');
      ;
    }

    $row1 = mysql_fetch_array ($result1);
    echo '

';
    echo '<S';
    echo 'CRIPT>
function vote(thisform)
{
	if(thisform.answer.value)
	{
		window.open(\'inc/vote.php?action=Vote&id=';
    echo $row1['id'];
    echo '&answer=\'+thisform.answer.value,\'form\',\'width=400,height=400\');
	}
	else
	{
		alert("Make your choice please!");
	}
}
</SCRIPT>

<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=3 ALIGN=center>
<TR>
	<TD STYLE="border: ';
    echo poll_border;
    echo 'px solid ';
    echo poll_border_color;
    echo '; background: ';
    echo poll_bg_color;
    echo ';">
		
		<FONT STYLE="font-family:';
    echo poll_question_font;
    echo '; color:';
    echo poll_question_color;
    echo '; font-size:';
    echo poll_question_font_size;
    echo '; font-weight :';
    echo poll_question_font_weight;
    echo ';">';
    echo $row1['question'];
    echo '</FONT><BR><BR>
		<FONT STYLE="font-family:';
    echo poll_answer_font;
    echo '; color:';
    echo poll_answer_color;
    echo '; font-size:';
    echo poll_answer_font_size;
    echo '; font-weight :';
    echo poll_answer_font_weight;
    echo ';">
			';
    $cat = split ('
', $row1['answer']);
    for ($i = 0; $i < sizeof ($cat); ++$i)
    {
      echo '<INPUT TYPE=radio NAME="answer" onClick="this.form.answer.value =\'';
      echo $i;
      echo '\'">';
      echo $cat[$i];
      echo '<BR>';
    }

    echo '		</FONT>
		<BR><DIV ALIGN="center">
			<input type="button" name="action" value="';
    echo $text__Vote;
    echo '" onClick="vote(this.form)"><input type="button" name="action" value="';
    echo $text__Result;
    echo '" onClick="window.open(\'inc/vote.php?action=Result&id=';
    echo $row1['id'];
    echo '\',\'form\',\'width=400,height=400\');">
		</DIV>

	</TD>
</TR>
</TABLE>
';
  }

  function rss ()
  {
    echo '<a href="inc/rss_feed.php?category=';
    echo rss_category;
    echo '&amount=';
    echo rss_amount;
    echo '" target="_blank"><img alt="';
    echo rss_amount;
    echo ' last posted articles" src="inc/images/xml.gif" border="0" align="absmiddle"></a>';
  }

  function calendar ()
  {
    include 'config.inc.php';
    include 'lang/' . language;
    $_GET['tim'] = strip_tags ($_GET['tim']);
    $_GET['cat_id'] = strip_tags ($_GET['cat_id']);
    if (!($result1 = mysql_query ('SELECT * FROM categories')))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    while ($row1 = mysql_fetch_array ($result1))
    {
      if (trim ($_GET['cat_id']) == $row1['name'])
      {
        $CAT_ID = $row1['name'];
        continue;
      }
    }

    if (!($result_MIN = mysql_query ('SELECT min(tim) as tim FROM articles')))
    {
      exit ('Invalid query1');
      ;
    }

    $row_MIN = mysql_fetch_array ($result_MIN);
    if (!$_GET['tim'])
    {
      $Calendar_Time = mktime (23, 59, 59, date ('n', $curtime[0]), date ('j', $curtime[0]), date ('Y', $curtime[0]));
    }
    else
    {
      $Calendar_Time = $_GET['tim'];
    }

    $Week_Start = cal_first;
    $Month_Days = date ('t', $Calendar_Time);
    $Month_Start_Day = date ('w', mktime (0, 0, 0, date ('n', $Calendar_Time), 1, date ('Y', $Calendar_Time)));
    if ($Month_Start_Day - $Week_Start < 0)
    {
      $Month_Start_Day = 7 + ($Month_Start_Day - $Week_Start);
    }
    else
    {
      $Month_Start_Day = abs ($Month_Start_Day - $Week_Start);
    }

    if ((4 < $Month_Start_Day AND 30 < $Month_Days))
    {
      $long_month = 6;
    }
    else
    {
      $long_month = 5;
    }

    echo '

<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" style="background-color:';
    echo cal_bg_color;
    echo ';">
<TR>
	<TD ALIGN=center colspan=7>
		';
    echo '<S';
    echo 'ELECT NAME="cal_month">';
    for ($i = 0; $i < 12; ++$i)
    {
      echo '<OPTION VALUE="';
      echo $month[$i];
      echo '" ';
      if ($month[$i] == $month[date ('n', $Calendar_Time) - 1])
      {
        echo 'SELECTED';
      }

      echo '>';
      echo $month[$i];
      echo '</OPTION>';
    }

    echo '</SELECT>';
    echo '<S';
    echo 'ELECT NAME="cal_year">';
    for ($i = 1980; $i <= date ('Y', $curtime[0]); ++$i)
    {
      echo '<OPTION VALUE="';
      echo $i;
      echo '" ';
      if ($i == date ('Y', $Calendar_Time))
      {
        echo 'SELECTED';
      }

      echo '>';
      echo $i;
      echo '</OPTION>';
    }

    echo '</SELECT><input type="button" name="cal_time" value=">" onclick="javascript:window.location=\'';
    echo $_SERVER['SCRIPT_URI'];
    echo '?cat_id=';
    echo $CAT_ID;
    echo '&cal_tim=\' + this.form.cal_month.value + \':\' + this.form.cal_year.value">
	</TD>
</TR>

<TR>
';
    for ($i = $Week_Start; $i < 7 + $Week_Start; ++$i)
    {
      $ii = $i;
      if (6 < $ii)
      {
        $ii = 0;
      }

      echo '<TD ALIGN=center BGCOLOR="';
      echo cal_wd_bg_color;
      echo '"><font color="';
      if (($ii == 0 OR $ii == 6))
      {
        echo 'red';
      }
      else
      {
        echo 'black';
      }

      echo '" STYLE="font-family:Tahoma; font-size:9px;">';
      echo $day[$ii];
      echo '</font></TD>';
    }

    echo '</TR>


';
    for ($j = 0; $j < $long_month; ++$j)
    {
      echo '<TR>';
      for ($i = 0; $i < 7; ++$i)
      {
        echo '				<TD ALIGN=center BGCOLOR="';
        if ($i + $j * 7 - $Month_Start_Day + 1 == date ('d', $Calendar_Time))
        {
          echo cal_cd_bg_color;
        }
        else
        {
          if (((($Week_Start == 0 AND $i == 0) OR ($Week_Start == 1 AND $i == 5)) OR 5 < $i))
          {
            echo cal_hd_bg_color;
          }
          else
          {
            echo '#FBFBFB';
          }
        }

        echo '">
				<font color="';
        if ($i + $j * 7 - $Month_Start_Day + 1 == date ('d', $Calendar_Time))
        {
          echo cal_cd_color;
        }
        else
        {
          echo cal_d_color;
        }

        echo '" STYLE="font-family:Tahoma; font-size:11px;">
				';
        $calendar_stamp = mktime (23, 59, 59, date ('n', $Calendar_Time), $i + $j * 7 - $Month_Start_Day + 1, date ('Y', $Calendar_Time));
        if (($row_MIN['tim'] < $calendar_stamp AND $calendar_stamp - 86399 < $curtime[0]))
        {
          echo '					<A HREF="index.php?cat_id=';
          echo $CAT_ID;
          echo '&tim=';
          echo $calendar_stamp;
          echo '" STYLE="color:';
          if ($i + $j * 7 - $Month_Start_Day + 1 == date ('d', $Calendar_Time))
          {
            echo cal_cd_color;
          }
          else
          {
            echo 'navy';
          }

          echo '; font-family:tahoma; font-size:10px; font-weight:bold; text-decoration:none;">
			';
        }

        echo '				';
        if (($Month_Start_Day <= $i + $j * 7 AND $i + $j * 7 - $Month_Start_Day + 1 <= $Month_Days))
        {
          echo $i + $j * 7 - $Month_Start_Day + 1;
        }

        echo '				</A></font></TD>';
      }

      echo '</TR>';
    }

    echo '
</TABLE>

';
  }

  function show_banner ($groupID)
  {
    $SQL = '' . 'SELECT * FROM ban_source WHERE (imp_limit=\'0\' OR imp_limit>imp_total) AND gr=\'' . $groupID . '\' AND active=\'on\' ORDER by id';
    if (!($result = mysql_query ($SQL)))
    {
      exit ('Invalid query');
      ;
    }

    if ($r_seed = mysql_num_rows ($result))
    {
      $seed = rand (0, $r_seed - 1);
      if (mysql_data_seek ($result, $seed))
      {
        $row = mysql_fetch_array ($result);
        echo '<A HREF="';
        echo $row['url'];
        echo '" target="_blank" onClick=Javascript:window.location="index.php?url=';
        echo $row['id'];
        echo '"><IMG SRC="upload/banners/';
        echo $row['image'];
        echo '" BORDER="0"></A>';
        $total_rised = $row['imp_total'] + 1;
        if (!(mysql_query ('' . 'UPDATE ban_source SET imp_total=\'' . $total_rised . '\' WHERE id=\'' . $row['id'] . '\'')))
        {
          exit ('Invalid query');
          ;
        }
      }
    }

    if ($_GET['url'] != '')
    {
      if (!($result = mysql_query ('' . 'SELECT * FROM ban_source WHERE id=\'' . $_GET['url'] . '\'')))
      {
        exit ('Invalid query');
        ;
      }

      $row = mysql_fetch_array ($result);
      $total_rised = $row['clicks'] + 1;
      if (!(mysql_query ('' . 'UPDATE ban_source SET clicks=\'' . $total_rised . '\' WHERE id=\'' . $_GET['url'] . '\'')))
      {
        exit ('Invalid query');
        ;
      }
    }

  }

  if (include 'key.php')
  {
    if (md5 ($domain) != $key1)
    {
      echo '<b>Invalid or expired license.</b><br><br>Please contact <a href="mailto:support@newsphp.com">support@newsphp.com</a>';
      exit ();
    }

    if (md5 ($key1) != $key2)
    {
      echo '<b>Invalid or expired license.</b><br><br>Please contact <a href="mailto:support@newsphp.com">support@newsphp.com</a>';
      exit ();
    }
  }
  else
  {
    echo '<br><br><b>Invalid or expired license.</b><br><br>Please contact <a href="mailto:support@newsphp.com">support@newsphp.com</a>';
    exit ();
  }

  if (!($result = mysql_query ('select * from styles WHERE active=\'yes\'')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $row = mysql_fetch_row ($result);
  for ($i = 0; $i < sizeof ($row); ++$i)
  {
    define (mysql_field_name ($result, $i), $row[$i]);
  }

  if (!($result1 = mysql_query ('select * from properties')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $row1 = mysql_fetch_row ($result1);
  for ($i = 0; $i < sizeof ($row1); ++$i)
  {
    define (mysql_field_name ($result1, $i), $row1[$i]);
  }

  echo '
';
?>
