News:

Wondering if this will always be free?  See why free is better.

Main Menu

Settings.php Problem

Started by daZiiii_boi, January 18, 2006, 08:24:57 AM

Previous topic - Next topic

daZiiii_boi

Hey I've been having no problems with my SMF Forum until checking today I recieve this error

Parse error: parse error, unexpected T_STRING in /home/bigdaz69/public_html/forum/Settings.php on line 28


Below is the Settings.php on my server could you please point out what may be wrong  :)
 

Quote<?php

require_once('SSI.php');

$totaldetopics=88;

if ($modSettings['smfVersion'] < '1.1')
   ob_start('ob_sessrewrite');

header('Content-Type: text/plain');

echo '<?xml version="1.0" encoding="UTF-8"?' . '>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84 [nofollow]">';

$request = db_query("
   SELECT posterTime
   FROM {$db_prefix}messages
   WHERE ID_MSG >= " . ($modSettings['maxMsgID'] - 30) . "
   ORDER BY ID_MSG DESC
   LIMIT 10", __FILE__, __LINE__);
$latest_post_times = array(time());
while ($row = mysql_fetch_assoc($request))
   $latest_post_times[] = $row['posterTime'];
mysql_free_result($request);

$request = db_query("
   SELECT ID_BOARD
   FROM {$db_prefix}boards", __FILE__, __LINE__);           <<< THIS LINE 28
$boards = array();
while ($row = mysql_fetch_assoc($request))
{
   $request2 = db_query("
      SELECT posterTime
      FROM {$db_prefix}messages
      WHERE ID_BOARD = $row[ID_BOARD]" . ($modSettings['totalMessages'] > 100000 ? "
         AND ID_MSG >= " . ($modSettings['maxMsgID'] * 0.5) : '') . "
      ORDER BY ID_MSG DESC
      LIMIT 10", __FILE__, __LINE__);
   $board_post_times = array(time());
   while ($row2 = mysql_fetch_assoc($request2))
      $board_post_times[] = $row2['posterTime'];
   mysql_free_result($request2);

   $boards[] = array(
      'id' => $row['ID_BOARD'],
      'times' => $board_post_times,
   );
}
mysql_free_result($request);



$request = db_query("
   SELECT ID_MEMBER
   FROM {$db_prefix}members
   ORDER BY totalTimeLoggedIn DESC
   LIMIT 20", __FILE__, __LINE__);                       
$members = array();
while ($row = mysql_fetch_assoc($request))
{
   $request2 = db_query("
      SELECT posterTime
      FROM {$db_prefix}messages
      WHERE ID_MEMBER = $row[ID_MEMBER]" . ($modSettings['totalMessages'] > 100000 ? "
         AND ID_MSG >= " . ($modSettings['maxMsgID'] * 0.5) : '') . "
      ORDER BY ID_MSG DESC
      LIMIT 10", __FILE__, __LINE__);
   $member_post_times = array(time());
   while ($row2 = mysql_fetch_assoc($request2))
      $member_post_times[] = $row2['posterTime'];
   mysql_free_result($request2);

   $members[] = array(
      'id' => $row['ID_MEMBER'],
      'times' => $member_post_times,
   );
}
mysql_free_result($request);

// First, the forum URL.  Highest priority!
echo '
   <url>
      <loc>', $scripturl, '</loc>
      <lastmod>', posts_max_time($latest_post_times), '</lastmod>
      <changefreq>', posts_to_freq($latest_post_times), '</changefreq>
      <priority>1.0</priority>
   </url>';

// Now the boards!
foreach ($boards as $board)
{
   echo '
   <url>
      <loc>', $scripturl, '/board,', $board['id'], '.0.html</loc>
      <lastmod>', posts_max_time($board['times']), '</lastmod>
      <changefreq>', posts_to_freq($board['times']), '</changefreq>
      <priority>', posts_to_priority(0.8, $board['times']), '</priority>
   </url>';
}

// Popular topics too...

$indice;
for ($indice=1; $indice!=$totaldetopics; $indice++)
{
   echo '
   <url>
      <loc>', $scripturl, '/topic,', $indice, '.0.html</loc>
      <lastmod>', posts_max_time($topic['times']), '</lastmod>
      <changefreq>', posts_to_freq($board['times']), '</changefreq>
      <priority>', posts_to_priority(0.7, $board['times']), '</priority>
   </url>';
}

// Most active members?
foreach ($members as $member)
{
   echo '
   <url>
      <loc>', $scripturl, '?action=profile;u=', $member['id'], '</loc>
      <lastmod>', posts_max_time($member['times']), '</lastmod>
      <changefreq>', posts_to_freq($member['times']), '</changefreq>
      <priority>', posts_to_priority(0.5, $board['times']), '</priority>
   </url>';
}

echo '
</urlset>';

function posts_max_time($post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00', time() - 3600 * 24 * 10);

   return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00', max($post_times));
}

function posts_to_priority($base, $post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return sprintf('%1.1f', $base);

   $s = (max($post_times) - min($post_times)) / count($post_times);

   if ($s < 3600 * 24)
      $mod = 0.1;
   else
      $mod = 0;

   return sprintf('%1.1f', $base + $mod);
}

function posts_to_freq($post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return 'yearly';

   $s = (max($post_times) - min($post_times)) / count($post_times);

   // Changes more often than every hour.
   if ($s < 3600)
      return 'always';
   elseif ($s < 3600 * 12)
      return 'hourly';
   elseif ($s < 3600 * 24 * 4)
      return 'daily';
   else
      return 'monthly';
}

?>

eric123

$request = db_query("
   SELECT posterTime
   FROM {$db_prefix}messages
   WHERE ID_MSG >= " . ($modSettings['maxMsgID'] - 30) . "
   ORDER BY ID_MSG DESC
   LIMIT 10", __FILE__, __LINE__);
$latest_post_times = array(time());
while ($row = mysql_fetch_assoc($request))
   $latest_post_times[] = $row['posterTime'];
mysql_free_result($request);

$request = db_query("
   SELECT ID_BOARD
   FROM {$db_prefix}boards", __FILE__, __LINE__);           <<< THIS LINE 28
$boards = array();
while ($row = mysql_fetch_assoc($request))


I think it is becuase you have $request twice as the same variable.

JayBachatero

You need to escape ' with \.  Open Settings.php and replace this line.

$mmessage = 'Okay faithful users...we\'re attempting to restore an older backup of the database...news will be posted once we\'re back!';      # Description of why the forum is in maintenance mode.

-JayBachatero
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

daZiiii_boi

Hey so how shall I actually fix this problem could you copy the text I quoted and then fix the line 28 if possible I would much appreciate this as I'm not to much of a scripting person.  :D :o :(

JayBachatero

You need to open Settings.php and find $mmessage = and replace that line with $mmessage 'Okay faithful users...we\'re attempting to restore an older backup of the database...news will be posted once we\'re back!';      # Description of why the forum is in maintenance mode.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Advertisement: