Signature Addon to forum
First add this in PHPmyAdmin
SQL:
ALTER TABLE `members` ADD `sig` BLOB(100000000) NOT NULL
Now open forum.php and find
We will be working in this section first off
Now find in forumdisplay
if($thread[sticky] == Yes)
{
echo ("<td id='mains'><b>Sticky:</b> $bbctt2</td></tr>");
}
else
{
echo ("<td id='mains'><b>$bbctt2</b></td></tr>");
}
echo ("<tr>
<td id='mains' align='center' width='120'><a href=javascript:void(window.open('members.php?user=$thread[poster]','client','status=1,width=400,height=250,top=60,left=60'))>$thread[poster]</a><br>
<img src='$threadavatar[avatar]'>
");
if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
{
echo ("<br><a href='forum_mod.php?page=lock&id=$thread[id]'>Lock</a> - <a href='?page=editthread&id=$thread[id]'>Edit</a> - <a href='forum_mod.php?page=sticky&id=$thread[id]'>Sticky</a>");
}
if ($thread[poster] == $logged[username])
{
echo ("<br><a href='?page=editthread&id=$thread[id]'>Edit Post</a>");
}
echo ("
</td><td id='mains' align='left' valign='top'>$bbctm</td></tr>");
$fetch2 = mysql_query("SELECT * FROM `forum_posts` WHERE `thr_id` = '$_GET[id]'");
while ($posts = mysql_fetch_array($fetch2))
{
$postsmessage = "$posts[message]";
$bbcpm = BBCODE($postsmessage);
$fetch4 = mysql_query("SELECT * FROM `members` WHERE `username` = '$posts[poster]'");
$postsavatar = mysql_fetch_array($fetch4);
echo ("<tr>
<td id='fields' align='center'>$posts[poster]
<br>
<img src='$postsavatar[avatar]'>
");
if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
{
echo ("<br><a href='forum_mod.php?page=delete&id=$posts[id]'>Delete</a> - <a href='?page=editpost&id=$posts[id]'>Edit</a>");
}
if ($logged[username] == $posts[poster])
{
echo ("<br><a href='?page=editpost&id=$posts[id]'>Edit Post</a>");
}
echo ("
</td>
<td id='fields' align='left' valign='top'>$bbcpm</td>
</tr>");
And replace with:
if($thread[sticky] == Yes)
{
echo ("<td id='mains'><b>Sticky:</b> $bbctt2</td></tr>");
}
else
{
echo ("<td id='mains'><b>$bbctt2</b></td></tr>");
}
echo ("<tr>
<td id='mains' align='center' width='120' rowspan='2'><a href=javascript:void(window.open('members.php?user=$thread[poster]','client','status=1,width=400,height=250,top=60,left=60'))>$thread[poster]</a><br>
<img src='$threadavatar[avatar]'>
");
if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
{
echo ("<br><a href='forum_mod.php?page=lock&id=$thread[id]'>Lock</a> - <a href='?page=editthread&id=$thread[id]'>Edit</a> - <a href='forum_mod.php?page=sticky&id=$thread[id]'>Sticky</a>");
}
if ($thread[poster] == $logged[username])
{
echo ("<br><a href='?page=editthread&id=$thread[id]'>Edit Post</a>");
}
echo ("
</td><td id='mains' align='left' valign='top'>$bbctm</td></tr>
<tr>
<td id='mains'>$threadavatar[sig]</td></tr>");
$fetch2 = mysql_query("SELECT * FROM `forum_posts` WHERE `thr_id` = '$_GET[id]'");
while ($posts = mysql_fetch_array($fetch2))
{
$postsmessage = "$posts[message]";
$bbcpm = BBCODE($postsmessage);
$fetch4 = mysql_query("SELECT * FROM `members` WHERE `username` = '$posts[poster]'");
$postsavatar = mysql_fetch_array($fetch4);
echo ("<tr>
<td id='fields' align='center' rowspan='2'>$posts[poster]
<br>
<img src='$postsavatar[avatar]'>
");
if ($logged[userlevel] == '4' || $logged[userlevel] == '6')
{
echo ("<br><a href='forum_mod.php?page=delete&id=$posts[id]'>Delete</a> - <a href='?page=editpost&id=$posts[id]'>Edit</a>");
}
if ($logged[username] == $posts[poster])
{
echo ("<br><a href='?page=editpost&id=$posts[id]'>Edit Post</a>");
}
echo ("
</td>
<td id='fields' align='left' valign='top'>$bbcpm</td>
</tr>
<tr><td id='fields'>$postsavatar[sig]</td></tr>");
Save and Close, all i did here was displayed the sig on the forum posts.
Now, open editprofile.php
find:
if($logged[id]) {
if(isset($_GET['update'])) {
$email = addslashes(htmlspecialchars($_POST[email]));
$location = addslashes(htmlspecialchars($_POST[location]));
$age = (int)addslashes(htmlspecialchars($_POST[age]));
$sex = addslashes(htmlspecialchars($_POST[sex]));
//checks the sex if its ok
if(($sex == "Male") || ($sex == "Female")) {
//updates there profile in the db
$update = mysql_query("UPDATE `members` SET `email` = '$email', `sex` = '$sex', `age` = '$age', `location` = '$location' WHERE `username` = '$logged[username]'");
echo "Profile updated!";
And change it to:
if($logged[id]) {
if(isset($_GET['update'])) {
$email = addslashes(htmlspecialchars($_POST[email]));
$sig = addslahes(htmlspecialchars($_POST[sig]));
$location = addslashes(htmlspecialchars($_POST[location]));
$age = (int)addslashes(htmlspecialchars($_POST[age]));
$sex = addslashes(htmlspecialchars($_POST[sex]));
//checks the sex if its ok
if(($sex == "Male") || ($sex == "Female")) {
//updates there profile in the db
$update = mysql_query("UPDATE `members` SET `email` = '$email', `sig` = '$sex', `sex` = '$sex', `age` = '$age', `location` = '$location' WHERE `username` = '$logged[username]'");
echo "Profile updated!";
Then find:
echo "<form action='editprofile.php?update' method='post'>
Email: <input type='text' name='email' size='30' maxlength='55' value='$user[email]'><br>
Location: <input type='text' name='location' size='30' maxlength='40' value='$user[location]'><br>
Age: <input type='text' name='age' size='3' maxlength='3' value='$user[age]'><br>
Sex: <select size='1' name='sex' value='$user[sex]'>
<option value='Male' "; if($user[sex] == Male) {
echo "selected"; }
echo ">Male</option>
<option value='Female' "; if($user[sex] == Female) {
echo "selected"; }
echo ">Female</option>
</select><br>
<input type='submit' value='Update'>
</form>";
And change it to:
echo "<form action='editprofile.php?update' method='post'>
Email: <input type='text' name='email' size='30' maxlength='55' value='$user[email]'><br>
Location: <input type='text' name='location' size='30' maxlength='40' value='$user[location]'><br>
Age: <input type='text' name='age' size='3' maxlength='3' value='$user[age]'><br>
Signature: <textarea name='sig'>$user[sig]</textarea>
Sex: <select size='1' name='sex' value='$user[sex]'>
<option value='Male' "; if($user[sex] == Male) {
echo "selected"; }
echo ">Male</option>
<option value='Female' "; if($user[sex] == Female) {
echo "selected"; }
echo ">Female</option>
</select><br>
<input type='submit' value='Update'>
</form>";
All i did here was add a field for you to edit the sig, and it to be submitted to the database..
Should work, un tested as the version i wrote for my forum was made with diffrent variables but any problems please post i'll be happy to help.