Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 399
0 Users 6 Guests Online

Signature Addon to forum

First add this in PHPmyAdmin

SQL:
Code

ALTER TABLE `members` ADD `sig` BLOB(100000000) NOT NULL


Now open forum.php and find

PHP Code
1
2
case 'forumdisplay':


We will be working in this section first off

Now find in forumdisplay

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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:
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
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:
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
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:
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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.
new2old
Author:
Views:
2396
Rating:
Posted on Sunday 20th April 2008 at 12:45 AM
cyruswu
cyruswu
Darklight for some reason the exact same description is in my php and mysql book.
Posted on Sunday 20th April 2008 at 12:41 AM
cyruswu
cyruswu
Darklight for some reason the exact same description is in my php and mysql book.
Posted on Sunday 24th February 2008 at 10:11 PM
darklight19
darklight19
I copied it from the mySQL site lol
Posted on Sunday 24th February 2008 at 10:04 PM
Zegzeima
Zegzeima
Ah ok thanks :)
Posted on Sunday 24th February 2008 at 10:00 PM
darklight19
darklight19
A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. These differ only in the maximum length of the values they can hold. The four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These correspond to the four BLOB types and have the same maximum lengths and storage requirements.
Posted on Sunday 24th February 2008 at 09:55 PM
Zegzeima
Zegzeima
Whats different between TEXT and BLOB?
Posted on Saturday 16th February 2008 at 11:31 AM
new2old
new2old
No problem ;)
Posted on Friday 15th February 2008 at 11:55 PM
zackcez
zackcez
thank you very much :)
Posted on Friday 15th February 2008 at 10:35 PM
ShadowMage
ShadowMage
thanks :P This helps me out cause i've got a big list of things to do :x