Okay, I'll try something for this when I get home later today.

Okay, tell me some details about this now though.

How would you like it done? Something like this:

(new) Topic Title
(answer expected) Topic Title
(discussion in progress) Topic Title
(resolved) Topic Title

So, that when you open up a forum, there will be text next to the title of a topic with the current status (which is set by the author of the topic) can be shown. Tell me if I'm in the ball park.

3

(16 replies, posted in General discussion)

I play PS2 and Xbox 360. For the PS2, I'm playing Guitar Hero (love this game). For the 360, I'm playing Gears of War, Quake 4, and Halo 2 (waiting for Halo 3 to come out in November).

I've grown bored of PC games at the moment, and the fact that I have a Mac doesn't help. Although I didn't play them much anyway, which is the reason I bought a Mac in the first place smile

If there isn't something like this made already, I think I could make this into a smallproject for me to try and do.

When I get home from school today, I'll see what I can do with this.

I have this following code for a query on a page I am making:

$from = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id='.$senderid) or error('Cannot find user', __FILE__, __LINE__, $db->error());

Let me explain it a little bit:
- I have a user's ID sent to a database. The ID saves correctly, and I've checked that. But, when I use this query to select a username from the database by the ID all I get is the result "Resource id #17". Is there something that I am doing wrong that I should edit the code by?

Thanks!

6

(12 replies, posted in PunBB 1.2 discussion)

Frank H wrote:

hmm ... are you relying on cookie id to enter information into the database? (if so a security risk, as ppl can make their own cookies)

(it's much better to use PunBB's own variables, as those has been checked so that the user is who he says he is)

Hmm, could you explain more about these variables? Can I contact you in another form, such as an IM client? I want to talk to someone personally who knows PunBB very well so I can better understand it.

7

(12 replies, posted in PunBB 1.2 discussion)

This is something that I will be using a lot in my next mod to PunBB. I hope all goes well, and I can do something good this time smile

Ah, I see. Looks as though I have a lot of work to do on this stuff smile

I hope to get up there, and understand the PunBB structure more thoroughly. If you wouldn't mind, would I be able to contact you in any other way besides on the forums?

9

(12 replies, posted in PunBB 1.2 discussion)

Smartys wrote:

This is code taken directly from PunBB wink

    // If a cookie is set, we get the user_id and password hash from it
    if (isset($_COOKIE[$cookie_name]))
        list($cookie['user_id'], $cookie['password_hash']) = @unserialize($_COOKIE[$cookie_name]);

I saw that, I swear, but I did not know if that was the right thing to look at. Wow, now I look totally stupid. Thank you.

Something I made for users to have to make it easily accessible on the forums to contact the administrator (or set user). This is my first mod, so tell me if there is something that I left out in this post. I am almost 100% positive that I have everything correct.

Step 1:
Copy the following code and save as "contactform.php" in your forum folder. Edit line #34 and enter you email address to be sent to.

<?php

##
##
##        Mod title:  Contact Form
##
##      Mod version:  1.0
##   Works on PunBB:  1.2.15
##     Release date:  2005-04-28
##           Author:  Sam Rusch (pghmyn@gmail.com)
##
##      Description:  Gives users a chance to have a simple and easy contact form on their
##                      forums for all their users.
##
##   Affected files:  functions.php
##
##       Affects DB:  No
##
##            Notes:  Easy to edit yourself, and feel free to edit this. If you would like
##                      to spice up the look of the form, it's up to you. The form is not the
##                      best, but it will do for what it is made for.


define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

//** What EMail should the message be sent to?
$sendto = "youremailhere";


//** Do not edit below this line, unless you know what you are doing.
if ($_POST['send']) {
    $name = trim($_POST['Name']);
    $email = trim($_POST['email']);
    $topic = trim($_POST['topic']);
    $details = trim($_POST['details']);
    
    $headers = "From: ".$name." at ".$email." \r\n"; 
    $headers.= "Content-Type: text/html; charset=ISO-8859-1 "; 
    $headers .= "MIME-Version: 1.0 "; 

    mail($sendto, "Suggestion/Concern (".$topic.")", $details, $headers);
    
    $confirm = "Your message has been successfully sent! If you entered an email, you may have a reply shortly.<br /><br />";
}

?>

<form method="post" action="">
<div class="blocktable">
    <h2><span>Contact Form</span></h2>
    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
                <tr>
                    <th class="tcl" scope="col">Please fill out the form below to send it in an EMail message:</th>
                </tr>
                <tr>
                    <td>
                        <div class="infldset">
                            <?php
                            if (isset($confirm)) {
                                echo $confirm;
                            }                        
                            ?>
                            <b>Your Name</b> (required) <input type="text" name="Name" size="30" /><br />
                            <b>Your EMail</b> <input type="text" name="email" size="30" /><br />
                            <b>Suggestion/Concern</b> (required) <input type="text" name="topic" size="35" /><br /><br />
                            <b>Details</b> (required)<br /><textarea rows="4" cols="60" name="details"></textarea><br />
                            <input type="submit" name="send" value="Send Now!" />
                        </div
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>
</form>

<?php

$footer_style = 'index';
require PUN_ROOT.'footer.php';

Step 2:
Look for the functions.php file in the include folder. Search for the function "function generate_navlinks()" on line 291. The first few lines are what you edit, and they should like like this when you are done:

function generate_navlinks()
{
    global $pun_config, $lang_common, $pun_user;

    // Index and Userlist should always be displayed
    $links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>';
    $links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>';
    $links[] = '<li id="navlogin"><a href="contactform.php">Contact Form</a>';

Step 3:
You are finished and ready to have the contact form working!

11

(12 replies, posted in PunBB 1.2 discussion)

Smartys wrote:
Sam Rusch wrote:

Hello, I'm making additions to my copy of PunBB, and I wanted to know how the read the cookie that is set. I've read the code in the functions.php file numerous times, but I can't figure out how the cookie is actually read. I know that the "userid" is set in the cookie, but how would I go about extracting that value?

Thank you.

The cookie is a serialized string which contains an array with 2 elements: the user_id and the password_hash

I know that, but how would I be able to extract those values seperately? Or, actually, what I want to do is just take out the user_id value so I can add some things to the forums. Begin to make my own mods.

12

(12 replies, posted in PunBB 1.2 discussion)

MattF wrote:
Sam Rusch wrote:

This is what I am currently using and all it does is show the error message.

$result = $db->query('SELECT contactban FROM '.$db->prefix.'users WHERE id='.$cur_user['user_id']) or error('Unable to select from database', __FILE__, __LINE__, $db->error());

There is no contactban value in the database:

http://punbb.org/docs/dev.html

I know, it is something that I added in myself already.

13

(12 replies, posted in PunBB 1.2 discussion)

This is what I am currently using and all it does is show the error message.

$result = $db->query('SELECT contactban FROM '.$db->prefix.'users WHERE id='.$cur_user['user_id']) or error('Unable to select from database', __FILE__, __LINE__, $db->error());

14

(12 replies, posted in PunBB 1.2 discussion)

Hello, I'm making additions to my copy of PunBB, and I wanted to know how the read the cookie that is set. I've read the code in the functions.php file numerous times, but I can't figure out how the cookie is actually read. I know that the "userid" is set in the cookie, but how would I go about extracting that value?

Thank you.