enteha
05-22-2009, 05:59 PM
Hi, I am trying to modify a php file that is about latest thread and post scrolling. This file as ready to use but I want to add an ability to show prefix name at the start os thread.I don`t know what variable control prefix rich.can anybody help me? the php file I said is here:
<?php
/
// ######################### REQUIRE BACK-END ############################
require_once('./includes/config.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
echo"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
$forum_path = "."; // Change this to reflect to your forum's Path.
$specific_forum_id = ""; // If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_a = ""; // If you dont wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_b = "";
$ignore_forum_id_c = "";
$ignore_forum_id_d = "";
$ignore_forum_id_e = "";
$ignore_forum_id_f = "";
$ignore_forum_id_g = "";
$ignore_forum_id_h = "";
$lastpost_limit = "20"; // Number of posts displayed.
$title_color = "#006600"; // This is the color of the title.
$text_color = "#CC3300"; // This is the color of the bottom text.
$title_limit = "100"; // This is the character limit.
echo"<marquee onmouseover=this.stop() onmouseout=this.start() dir=\"rtl\" direction=\"up\" scrollAmount=\"2\" scrolldelay=\"50\">";
echo "<table dir=\"rtl\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
$sforumid = '';
$iforumida = '';
$iforumidb = '';
$iforumidc = '';
$iforumidd = '';
$iforumide = '';
$iforumidf = '';
$iforumidg = '';
$iforumidh = '';
if ($specific_forum_id) {
$sforumid = "AND forumid = $specific_forum_id";
}
if ($ignore_forum_id_a) {
$iforumida = "AND forumid != $ignore_forum_id_a";
}
if ($ignore_forum_id_b) {
$iforumidb = "AND forumid != $ignore_forum_id_b";
}
if ($ignore_forum_id_c) {
$iforumidc = "AND forumid != $ignore_forum_id_c";
}
if ($ignore_forum_id_d) {
$iforumidd = "AND forumid != $ignore_forum_id_d";
}
if ($ignore_forum_id_e) {
$iforumide = "AND forumid != $ignore_forum_id_e";
}
if ($ignore_forum_id_f) {
$iforumidf = "AND forumid != $ignore_forum_id_f";
}
if ($ignore_forum_id_g) {
$iforumidg = "AND forumid != $ignore_forum_id_g";
}
if ($ignore_forum_id_h) {
$iforumidh = "AND forumid != $ignore_forum_id_h";
}
if ($lastpost_limit) {
$lastpost_limited = "LIMIT $lastpost_limit";
}
//dtabase connection
$server = $config['MasterServer']['servername'];
$databaseuser = $config['MasterServer']['username'];
$databasepass = $config['MasterServer']['password'];
$databasename = $config['Database']['dbname'];
$table_prefix = $config['Database']['tableprefix'];
$conn = mysql_connect("$server", "$databaseuser", "$databasepass") or die ('database error');
mysql_select_db("$databasename", $conn) or die ('database error');
//thread table sql query
$thread_sql_query = mysql_query("SELECT threadid,title,lastpost,lastposter,forumid,postuse rname,lastpostid FROM " . $table_prefix . "thread WHERE visible=1 AND open=1 $sforumid $iforumida $iforumidb $iforumidc $iforumidd $iforumide $iforumidf $iforumidg $iforumidh ORDER BY lastpost DESC $lastpost_limited");
while($thread_get_info = mysql_fetch_array($thread_sql_query))
{
$lastpost = $thread_get_info['lastpost'];
$lastposter = $thread_get_info['lastposter'];
$threadid = $thread_get_info['threadid'];
$forumid = $thread_get_info['forumid'];
$postusername = $thread_get_info['postusername'];
$lastpostid = $thread_get_info['lastpostid'];
$date = date ("m/d/y h:i A" ,$lastpost);
$threadtitle = $thread_get_info['title'];
$threadtitle = substr($threadtitle,0,$title_limit);
//forum table sql query
$forum_sql = mysql_query("SELECT title FROM " . $table_prefix . "forum WHERE forumid=$forumid");
$forum_get = mysql_fetch_array($forum_sql);
$forumtitle = $forum_get['title'];
//post table sql query
$post_sql = mysql_query("SELECT title,postid FROM " . $table_prefix . "post WHERE postid=$lastpostid");
$post_get = mysql_fetch_array($post_sql);
$lastposterid = $post_get['postid'];
$lastposttitle = $post_get['title'];
if (empty($lastposttitle)) {
$lastposttitle = ("response: $threadtitle");
}
$lastposttitle = substr($lastposttitle,0,$title_limit);
echo "<tr dir=\"rtl\"><td dir=\"rtl\"><font size=\"2\" face=\"utf-8\"><a target=_blank href=\"$forum_path/showthread.php?p=$lastposterid#post$lastposterid\"><FONT SIZE=\"4\" COLOR=\"$title_color\" face=\"tahoma\">$threadtitle</FONT></a></font><br> <font color=\"$text_color\" face=\"tahoma\" size='2'>Starter : $postusername |forum : $forumtitle | last post : $lastposter </FONT></td></tr>";
}
echo "</table>";
echo"</marquee>";
/*================================================= =====================*\
|| ################################################## ################### ||
|| ############################ END SCRIPT ############################# ||
|| ################################################## ################### ||
\*================================================ ======================*/
I knew that I should write a line such:
$threadtitle = $thread_get_info['title'];
but I don`t know how?
<?php
/
// ######################### REQUIRE BACK-END ############################
require_once('./includes/config.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
echo"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
$forum_path = "."; // Change this to reflect to your forum's Path.
$specific_forum_id = ""; // If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_a = ""; // If you dont wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_b = "";
$ignore_forum_id_c = "";
$ignore_forum_id_d = "";
$ignore_forum_id_e = "";
$ignore_forum_id_f = "";
$ignore_forum_id_g = "";
$ignore_forum_id_h = "";
$lastpost_limit = "20"; // Number of posts displayed.
$title_color = "#006600"; // This is the color of the title.
$text_color = "#CC3300"; // This is the color of the bottom text.
$title_limit = "100"; // This is the character limit.
echo"<marquee onmouseover=this.stop() onmouseout=this.start() dir=\"rtl\" direction=\"up\" scrollAmount=\"2\" scrolldelay=\"50\">";
echo "<table dir=\"rtl\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
$sforumid = '';
$iforumida = '';
$iforumidb = '';
$iforumidc = '';
$iforumidd = '';
$iforumide = '';
$iforumidf = '';
$iforumidg = '';
$iforumidh = '';
if ($specific_forum_id) {
$sforumid = "AND forumid = $specific_forum_id";
}
if ($ignore_forum_id_a) {
$iforumida = "AND forumid != $ignore_forum_id_a";
}
if ($ignore_forum_id_b) {
$iforumidb = "AND forumid != $ignore_forum_id_b";
}
if ($ignore_forum_id_c) {
$iforumidc = "AND forumid != $ignore_forum_id_c";
}
if ($ignore_forum_id_d) {
$iforumidd = "AND forumid != $ignore_forum_id_d";
}
if ($ignore_forum_id_e) {
$iforumide = "AND forumid != $ignore_forum_id_e";
}
if ($ignore_forum_id_f) {
$iforumidf = "AND forumid != $ignore_forum_id_f";
}
if ($ignore_forum_id_g) {
$iforumidg = "AND forumid != $ignore_forum_id_g";
}
if ($ignore_forum_id_h) {
$iforumidh = "AND forumid != $ignore_forum_id_h";
}
if ($lastpost_limit) {
$lastpost_limited = "LIMIT $lastpost_limit";
}
//dtabase connection
$server = $config['MasterServer']['servername'];
$databaseuser = $config['MasterServer']['username'];
$databasepass = $config['MasterServer']['password'];
$databasename = $config['Database']['dbname'];
$table_prefix = $config['Database']['tableprefix'];
$conn = mysql_connect("$server", "$databaseuser", "$databasepass") or die ('database error');
mysql_select_db("$databasename", $conn) or die ('database error');
//thread table sql query
$thread_sql_query = mysql_query("SELECT threadid,title,lastpost,lastposter,forumid,postuse rname,lastpostid FROM " . $table_prefix . "thread WHERE visible=1 AND open=1 $sforumid $iforumida $iforumidb $iforumidc $iforumidd $iforumide $iforumidf $iforumidg $iforumidh ORDER BY lastpost DESC $lastpost_limited");
while($thread_get_info = mysql_fetch_array($thread_sql_query))
{
$lastpost = $thread_get_info['lastpost'];
$lastposter = $thread_get_info['lastposter'];
$threadid = $thread_get_info['threadid'];
$forumid = $thread_get_info['forumid'];
$postusername = $thread_get_info['postusername'];
$lastpostid = $thread_get_info['lastpostid'];
$date = date ("m/d/y h:i A" ,$lastpost);
$threadtitle = $thread_get_info['title'];
$threadtitle = substr($threadtitle,0,$title_limit);
//forum table sql query
$forum_sql = mysql_query("SELECT title FROM " . $table_prefix . "forum WHERE forumid=$forumid");
$forum_get = mysql_fetch_array($forum_sql);
$forumtitle = $forum_get['title'];
//post table sql query
$post_sql = mysql_query("SELECT title,postid FROM " . $table_prefix . "post WHERE postid=$lastpostid");
$post_get = mysql_fetch_array($post_sql);
$lastposterid = $post_get['postid'];
$lastposttitle = $post_get['title'];
if (empty($lastposttitle)) {
$lastposttitle = ("response: $threadtitle");
}
$lastposttitle = substr($lastposttitle,0,$title_limit);
echo "<tr dir=\"rtl\"><td dir=\"rtl\"><font size=\"2\" face=\"utf-8\"><a target=_blank href=\"$forum_path/showthread.php?p=$lastposterid#post$lastposterid\"><FONT SIZE=\"4\" COLOR=\"$title_color\" face=\"tahoma\">$threadtitle</FONT></a></font><br> <font color=\"$text_color\" face=\"tahoma\" size='2'>Starter : $postusername |forum : $forumtitle | last post : $lastposter </FONT></td></tr>";
}
echo "</table>";
echo"</marquee>";
/*================================================= =====================*\
|| ################################################## ################### ||
|| ############################ END SCRIPT ############################# ||
|| ################################################## ################### ||
\*================================================ ======================*/
I knew that I should write a line such:
$threadtitle = $thread_get_info['title'];
but I don`t know how?