SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    European Union
    0 Post(s)
    0 Thread(s)

    A little PHP issues.

    I have lost my admin rights in a test forum I installed called PunBB.
    I am told that I have to install MyPhpAdmin, there give my username "Webnauts" and the value 2 instead.

    Can someone tell me were are these fields that I must edit all that?

    Also, I am trying to make this forum software accessible with W3C/WAU WCAG 1.0 AAA and I have another little problem, while I am not a Programmer. The most files are done.

    I need to include in this file a doctype and a title.
    Here you can have a look:

         // The maximum number of topics that will be displayed
         $show_max_topics = 60;
         // The length at which topic subjects will be truncated (for HTML output)
         $max_subject_length = 30;
         // Some language strings used in this script (edit if your website is in
         // a language other than english)
         $lang_extern = array(
         // action=online
     'Users online'		 	=>	'Users online',	// As in "Users online: 8". The same applies to the next 5 strings.
     'Guests online'		 	=>	'Guests online',
         // action=stats
     'Registered users'			=>	'Registered users',
         'Newest registered user'	=>	'Newest registered user',
     'Topics'		 		=>	'Topics',
     'Posts'		 		 =>	'Posts',
     'RSS Description Active'	=>	'The most recently active topics at',	// board_title will be appended to this string
     'RSS Description New'	 =>	'The newest topics at',	// board_title will be appended to this string
     'Forum'		 		 =>	'Forum',	// The name of the forum
     'Author'		 		=> 'Author',	// The user who started the topic
     'Posted'		 		=> 'Posted',	// The date/time the topic was started
     'Last post'		 		=>	'Last post'	// The date/time of the last post in the topic
         // DO NOT EDIT ANYTHING BELOW THIS LINE! (unless you know what you are doing)
         $pun_root = './';
         @include $pun_root.'config.php';
         // If PUN isn't defined, config.php is missing or corrupt
         if (!defined('PUN'))
     	exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');
         // Disable error reporting for uninitialized variables
         error_reporting(E_ERROR | E_WARNING | E_PARSE);
         // Turn off magic_quotes_runtime
         // Attempt to load the common language file
         @include $pun_root.'lang/'.$language.'/'.$language.'_common.php';
         if (!isset($lang_common))
     	exit('There is no valid language pack \''.$language.'\' installed. Plese check $language setting in config.php.');
         // Load the functions script
         require $pun_root.'include/functions.php';
         // Load DB abstraction layer and try to connect
         require $pun_root.'include/dblayer/common_db.php';
         // Get the forum config
     $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
         while ($cur_config_item = $db->fetch_row($result))
         	$pun_config[$cur_config_item[0]] = $cur_config_item[1];
         // Make sure we have permission to read the forums
         if ($pun_config['p_guests_read'] == '0')
         	exit('No permission');
         // Converts the CDATA end sequence ]]> into ]]&gt;
         function escape_cdata($str)
         	return str_replace(']]>', ']]&gt;', $str);
         // Show recent discussions
         if ($_GET['action'] == 'active' || $_GET['action'] == 'new')
         	$order_by = ($_GET['action'] == 'active') ? 't.last_post' : 't.posted';
         	$forum_sql = '';
         	// Was a forum ID supplied?
         	if (isset($_GET['fid']))
         		$fid = intval($_GET['fid']);
         		if (!empty($fid))
         			$forum_sql = ''.$fid.' AND ';
         	// Should we output this as RSS?
         	if (isset($_GET['type']) && strtoupper($_GET['type']) == 'RSS')
     		$rss_description = ($_GET['action'] == 'active') ? $lang_extern['RSS Description Active'] : $lang_extern['RSS Description New'];
         		$url_action = ($_GET['action'] == 'active') ? '&amp;action=new' : '';
         		// Send XML/no cache headers
         		header('Content-Type: text/xml');
         		header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
         		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         		header('Pragma: public');
         		// It's time for some syndication!
     		echo '<?xml version="1.0" encoding="'.$lang_common['lang_encoding'].'"?>'."\r\n";
     		echo '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "">'."\r\n";
         		echo '<rss version="0.91">'."\r\n";
         		echo '<channel>'."\r\n";
     		echo "\t".'<title>'.pun_htmlspecialchars($pun_config['o_board_title']).'</title>'."\r\n";
         		echo "\t".'<link>'.$pun_config['o_base_url'].'/</link>'."\r\n";
     		echo "\t".'<description>'.pun_htmlspecialchars($rss_description.' '.$pun_config['o_board_title']).'</description>'."\r\n";
         		echo "\t".'<language>en-us</language>'."\r\n";
         		// Fetch 15 topics
     		$result = $db->query('SELECT, t.poster, t.subject, t.posted, t.last_post, AS fid, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON WHERE t.moved_to IS NULL AND '.$forum_sql.'f.admmod_only=0 ORDER BY '.$order_by.' DESC LIMIT 15') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
         		while ($cur_topic = $db->fetch_assoc($result))
         			if ($pun_config['o_censoring'] == '1')
     		 	$cur_topic['subject'] = censor_words($cur_topic['subject']);
         			echo "\t".'<item>'."\r\n";
     			echo "\t\t".'<title>'.pun_htmlspecialchars($cur_topic['subject']).'</title>'."\r\n";
     			echo "\t\t".'<link>'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].$url_action.'</link>'."\r\n";
     			echo "\t\t".'<description><![CDATA['.escape_cdata($lang_extern['Forum'].': <a href="'.$pun_config['o_base_url'].'/viewforum.php?id='.$cur_topic['fid'].'" target="_blank">'.$cur_topic['forum_name'].'</a><br />'."\r\n".$lang_extern['Author'].': '.$cur_topic['poster'].'<br />'."\r\n".$lang_extern['Posted'].': '.date('r', $cur_topic['posted']).'<br />'."\r\n".$lang_extern['Last post'].': '.date('r', $cur_topic['last_post'])).']]></description>'."\r\n";
         			echo "\t".'</item>'."\r\n";
         		echo '</channel>'."\r\n";
         		echo '</rss>';
         	// Output regular HTML
         		$show = intval($_GET['show']);
         		if ($show < 1 || $show > 50)
         			$show = 15;
         		// Fetch $show topics
     		$result = $db->query('SELECT, t.subject FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON WHERE t.moved_to IS NULL AND '.$forum_sql.'f.admmod_only=0 ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
         		while ($cur_topic = $db->fetch_assoc($result))
         			if ($pun_config['o_censoring'] == '1')
     		 	$cur_topic['subject'] = censor_words($cur_topic['subject']);
     			if (pun_strlen($cur_topic['subject']) > $max_subject_length)
     		 	$subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
     				$subject_truncated = $cur_topic['subject'];
     			echo '<b>&middot;</b> <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&amp;action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a><br>'."\n";
         // Show users online
         else if ($_GET['action'] == 'online')
         	// Fetch users online info and generate strings for output
         	$num_guests = $num_users = 0;
     	$result = $db->query('SELECT user_id FROM '.$db->prefix.'online ORDER BY ident') or error('Unable to fetch online users info', __FILE__, __LINE__, $db->error());
         	while (list($cur_online_id) = $db->fetch_row($result))
         		if ($cur_online_id > 0)
         	echo $lang_extern['Users online'].': '.$num_users.'<br>';
         	echo $lang_extern['Guests online'].': '.$num_guests;
         // Show board statistics
         else if ($_GET['action'] == 'stats')
         	// Collect some statistics from the database
     	$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
         	$stats['total_users'] = $db->result($result, 0);
     	$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
         	$stats['last_user'] = $db->fetch_assoc($result);
     	$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
         	list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
         	echo $lang_extern['Registered users'].': '.$stats['total_users'].'<br>';
     	echo $lang_extern['Newest registered user'].': <a href="'.$pun_config['o_base_url'].'/profile.php?id='.$stats['last_user']['id'].'">'.pun_htmlspecialchars($stats['last_user']['username']).'</a><br>';
         	echo $lang_extern['Topics'].': '.$stats['total_topics'].'<br>';
         	echo $lang_extern['Posts'].': '.$stats['total_posts'];
         	exit('Bad request');
    Thanks in advance.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts