hi guys i
want little help frm u i dont know how to add database in my sql and how to add a user to my sql so i want a help frm u how to add this code to my site and where i have to upload this file and what i have to add in database and i have to add this code in my ipb forums to add a latest forum script and this is the code
want little help frm u i dont know how to add database in my sql and how to add a user to my sql so i want a help frm u how to add this code to my site and where i have to upload this file and what i have to add in database and i have to add this code in my ipb forums to add a latest forum script and this is the code
pls help me soon i have to add this script to my ipb forums and i dont know how to add database and add a usename to database//Run these two Queries in MySQL Toolbox or PHPmyAdmin
ALTER TABLE `ibf_members` ADD `latest_posts` LONGTEXT NOT NULL AFTER `auto_track` ;
ALTER TABLE `ibf_members` ADD `latest_post_show` MEDIUMINT( 2 ) DEFAULT '8' NOT NULL AFTER `latest_posts` ;
//**************************//
// open sources/UserCp.php //
//**************************//
////////
//Find//
////////
case '51':
$this->remove_forum_tracker();
break;
/////////////
//Below Put//
/////////////
case '90':
$this->forums_select();
break;
case '91':
$this->forums_set();
break;
case '92':
$this->amount_set();
break;
////////
//Find//
////////
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 1, NAV => $this->nav ) );
}
/////////////
//Below Put//
/////////////
function forums_select()
{
global $ibforums, $DB, $std;
$query = $DB->query("SELECT latest_posts, latest_post_show, id FROM ibf_members WHERE id=".$ibforums->member[id]);
$row = $DB->fetch_row($query);
$checkedforums = explode("," , $row[latest_posts]);
$row[latest_post_show] == 8 ? $amount .= "<option value=8 selected>8</option>" : $amount .= "<option value=8>8</option>";
$row[latest_post_show] == 10 ? $amount .= "<option value=10 selected>10</option>" : $amount .= "<option value=10>10</option>";
$row[latest_post_show] == 15 ? $amount .= "<option value=15 selected>15</option>" : $amount .= "<option value=15>15</option>";
$row[latest_post_show] == 20 ? $amount .= "<option value=20 selected>20</option>" : $amount .= "<option value=20>20</option>";
$this->output .= $this->html->start_latest($amount);
foreach ($ibforums->perm_id_array as $i)
$fast .= "OR read_perms LIKE '".$i."' OR read_perms LIKE '%,".$i."' OR read_perms LIKE '".$i.",%' OR read_perms LIKE '%,".$i.",%' ";
$query = $DB->query("SELECT f.category, c.id as cat_id, c.position as cat_position, c.name as cat_name
FROM ibf_forums f, ibf_categories c
WHERE c.id=f.category
ORDER BY c.position");
while($row = $DB->fetch_row($query)) {
$cats[$row[cat_id]] = $row[cat_name];
}
$query = $DB->query("SELECT category, name, id, description, subwrap
FROM ibf_forums
WHERE read_perms = '*' ".$fast. "
ORDER BY position");
while($row = $DB->fetch_row($query)) {
$forums[] = array( name => $row[name],
cat => $row[category],
id => $row[id],
desc => $row[description],
sub => $row[subwrap],
);
}
foreach($cats as $k=>$v) {
$printcat = 0;
foreach($forums as $f=>$g) {
$checked = "";
foreach($checkedforums as $m=>$n) {
($n == $forums[$f][id]) ? $checked = CHECKED : "";
}
if($forums[$f][cat] == $k) {
$printcat++;
if($printcat == 1)
$this->output .= $this->html->cat_row($v);
$this->output .= $this->html->latest_post_row($forums[$f][name],$forums[$f][id],$forums[$f][desc],$checked);
}
}
}
$this->output .= $this->html->end_latest();
}
function forums_set()
{
global $ibforums, $DB, $print;
$forums = $_POST[forums];
$end = count($forums);
$count = 1;
foreach($forums as $k => $v) {
if($count == $end) {
$dbquery .= $v;
} else {
$dbquery .= $v . ",";
$count++;
}
}
$DB->query("UPDATE ibf_members SET latest_posts='$dbquery' WHERE id=".$ibforums->member[id]);
$print->redirect_screen( "Latest Posts choices updated.", 'act=UserCP&CODE=90' );
}
function amount_set()
{
global $ibforums, $DB, $print;
$amount = $_POST[show];
$DB->query("UPDATE ibf_members SET latest_post_show='$amount' WHERE id=".$ibforums->member[id]);
$print->redirect_screen( "Latest Posts choices updated.", 'act=UserCP&CODE=90' );
}
//**************************//
// open sources/Boards.php //
//**************************//
////////
//Find//
////////
$this->output .= $this->html->PageTop( $std->get_date( $ibforums->input['last_visit'], 'LONG' ) );
/////////////
//Below Put//
/////////////
//---------------------------------------
// Latest Posts
//---------------------------------------
if($ibforums->member[id] !=0) {
$query = $DB->query("SELECT latest_posts, latest_post_show FROM ibf_members WHERE id=".$ibforums->member[id]);
$row = $DB->fetch_row($query);
$dbquery = "forum_id in ($row[latest_posts])";
$show = $row[latest_post_show];
} else {
foreach ($ibforums->perm_id_array as $i)
$fast .= "OR f.read_perms LIKE '".$i."' OR f.read_perms LIKE '%,".$i."' OR f.read_perms LIKE '".$i.",%' OR f.read_perms LIKE '%,".$i.",%' ";
$dbquery = "f.read_perms = '*' $fast";
$show = 8;
}
if(!$row[latest_posts] && $ibforums->member[id] !=0) {
$post_data .= "<tr bgcolor=#E4EAF2>
<td align=center colspan=3>You have no forums selected. Select them from your UserCP.</td>
</tr>";
$this->output .= $this->html->latest_posts($post_data,$show);
} else {
$query = $DB->query("SELECT t.last_poster_name, t.last_poster_id, t.title, t.tid, t.forum_id, t.last_post, f.name ".
"FROM ibf_topics AS t LEFT JOIN ibf_forums AS f ON f.id=t.forum_id ".
"WHERE " . $dbquery .
" ORDER BY last_post DESC LIMIT 0,".$show);
while($out = $DB->fetch_row($query))
{
$post_data .= "<tr bgcolor=#E4EAF2>"
. "<td align=left>"
. "<a href='{$ibforums->base_url}showtopic=$out[tid]&view=getlastpost'>$out[title]</a></td>"
. "<td align=left>"
. "<a href='{$ibforums->base_url}showforum=$out[forum_id]'>$out[name]</a></font></td>"
. "<td align=left>"
. "<a href='{$ibforums->base_url}act=Profile&CODE=03&MID=$out[last_poster_id]'>$out[last_poster_name]</a></td>"
. "</tr>";
}
$this->output .= $this->html->latest_posts($post_data,$show);
}
//---------------------------------------
// End Latest Posts
//---------------------------------------
//*****************************//
// open skin/s1/skin_ucp.php //
//*****************************//
////////
//Find//
////////
<?php
class skin_ucp {
/////////////
//Below Put//
/////////////
function start_latest($select) {
global $ibforums;
return <<<EOF
<table class=tablebasic>
<tr>
<td class=titlemedium>Latest Posts Setup</td>
<td class=titlemedium>Amount to show:
<form action="{$ibforums->base_url}act=UserCP&CODE=92" method="post" name="setamount">
<select name=show>
$select
</select>
 <input type=submit value="Update Amount">
</form></td>
</tr>
<form action="{$ibforums->base_url}act=UserCP&CODE=91" method="post" name="setforums">
EOF;
}
function cat_row($name) {
global $ibforums;
return <<<EOF
<tr>
<td class=maintitle colspan=2>$name</td>
</tr>
EOF;
}
function latest_post_row($forum, $id , $desc, $checked) {
global $ibforums;
return <<<EOF
<tr>
<td class=row3 width=30%><input type="checkbox" name="forums[]" value="$id" $checked>$forum</td>
<td class=row2 width=70%>$desc</td>
</tr>
EOF;
}
function end_latest() {
global $ibforums;
return <<<EOF
</table>
<center><input type=submit value="Set Forums"></center>
</form>
EOF;
}
////////
//Find//
////////
· <a href='{$base_url}act=UserCP&CODE=28'>{$ibforums->lang['m_passy_opt']}</a><br />
</p>
/////////////
//Below Put//
/////////////
<div class='pformstrip'>Latest Posts</div>
<p>
· <a href='{$base_url}act=UserCP&CODE=90'>Latest Posts</a><br />
</p>
//*****************************//
// open skin/s1/skin_boards.php//
//*****************************//
////////
//Find//
////////
<?php
class skin_boards {
/////////////
//Below Put//
/////////////
function latest_posts($Data,$show) {
global $ibforums;
return <<<EOF
<table cellpadding='1' cellspacing='1' width='75%' class=plainborder align=center>
<tr>
<td class=maintitle colspan=3>$show latest posts
<tr>
<td class='titlemedium' align=left>Thread</td>
<td class='titlemedium' align=left>In Forum</td>
<td class='titlemedium' align=left>By</td>
</tr>
$Data
</table>
<br />
EOF;
}
///////////////
//All Done !!//
///////////////