Dynamic Meta Title Proplem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
caykoylu
Forum Newbie
Posts: 3
Joined: Thu Aug 03, 2006 7:48 pm

Dynamic Meta Title Proplem

Post by caykoylu »

I have a site.But I have a proplem about dynamic title.

Site Title is static.so itsn't change every page.

Can You Help me?

index.php code

Code: Select all

<? 

  include_once 'config.inc.php';
  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 ());
      ;
    }

    $row000 = mysql_fetch_array ($result);
  }

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

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

    $row000 = mysql_fetch_array ($result);
  }

  if (($_POST['username'] AND $_POST['password']))
  {
    if (!($result = mysql_query ('select * from visitors')))
    {
      exit ('Invalid query');
      ;
    }

    while ($row = mysql_fetch_array ($result))
    {
      if (($row['username'] == $_POST['username'] AND $row['password'] == md5 ($_POST['password'])))
      {
        $TMP = split ('
', $row['allowed']);
        if (in_array ($_POST['visitor_allow'], $TMP))
        {
          setcookie ('autorized', md5 (md5 ($row['username'] . $row['password'])));
          header ('Location: index.php?cat_id=' . urlencode ($_POST['cat_id']) . ('' . '&id=' . $_POST['id']));
          continue;
        }

        continue;
      }
    }
  }

  include_once 'inc/main.php';
  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]);
  }

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

  $row2 = mysql_fetch_array ($result2);
  echo '
';
  if (txt_direction == 'LTR')
  {
    echo '<html>';
  }
  else
  {
    echo '<html dir="rtl">';
  }

  echo '<head>
<title>';
  echo title;
  echo '</title>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=';
  echo encoding;
  echo '">
	<META NAME="keywords" CONTENT="';
  echo keywords;
  echo '">
	<META NAME="description" CONTENT="';
  echo description;
  echo '">
</head>
';
  echo bodytagset;
  echo '
';
  if (($row000['protect'] == 'on' AND !$_COOKIE['autorized']))
  {
  }
  else
  {
    echo '<form>';
  }

  include_once '' . 'upload/templates/' . $row2['skin'];
  if (($row000['protect'] == 'on' AND !$_COOKIE['autorized']))
  {
  }
  else
  {
    echo '</form>';
  }

  echo '</body></html>';
?>

main.php code:

Code: Select all

<? 

  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 ';">•&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 ';">•&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 ';">•&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>
•&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')))
      {
        ?>
Last edited by caykoylu on Fri Aug 04, 2006 1:57 am, edited 1 time in total.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

caykoylu,
Help us to help you:
  • Use

    Code: Select all

    tags
    [*]Explain your problem in more detail and with greater clarity
    [*]Don't post that much code. Do you seriously think i'm going to read through all that?[/list]
caykoylu
Forum Newbie
Posts: 3
Joined: Thu Aug 03, 2006 7:48 pm

I'm Sorry for tags

Post by caykoylu »

I'm sorry.

I want change meta tag dependent in article Title. Namely, I want be article Title = page meta title.

Sincerely
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Code: Select all

echo '<title>' . $title . '</title>';
no?
User avatar
ronverdonk
Forum Commoner
Posts: 34
Joined: Sat Jun 10, 2006 7:06 am
Location: Netherlands

Post by ronverdonk »

Why do you start 3 threads on the same problem? Please stick to your original one.
Post Reply