Sometimes older is better... wink

2nd one...

1.1.5

it's $cur_user instead of $pun_user

sorry...here's the complete code...and I do believe it is...

<?php
$pun_root = '../../';
require $pun_root.'include/common.php';

$_GET['id'] = $id;
    if (empty($id) || $id < 2) {
        message('Bad request.');
    }    

    if ($cookie['is_guest'] || $cur_user['id'] != $id && $cur_user['status'] < PUN_MOD) {
        message('You are not allowed to access this page.');
    }
    
    if (isset($_POST['form_sent']))
    {
        $uploaded_file = $_FILES['image'];
        
        // Make sure the upload went smooth
        switch ($_FILE['image']['error'])
        {
            case 1:    // UPLOAD_ERR_INI_SIZE
            case 2:    // UPLOAD_ERR_FORM_SIZE
                message('Too large.');
                break;

            case 3:    // UPLOAD_ERR_PARTIAL
                message('Partial upload.');
                break;

            case 4:    // UPLOAD_ERR_NO_FILE
                message('No file.');
                break;

            default:
                // No error occured, but was something actually uploaded?
                if ($_FILE['image']['size'] == 0)
                    message('No file');
                break;
        }
        
        if (is_uploaded_file($uploaded_file['tmp_name']))
        {
    
        $ok_filetypes = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png');
        if (!$_FILES['image']['error'] && $_FILES['image']['size'] > $pun_config['o_avatars_size'] * 1024) {
            message('Sorry, but the attached file is too large. Please reduce the size of it\'s contents.'); // #err
        }
        
        $filename = (!$_FILES['image']['error'] ? substr(basename($_FILES['image']['name']), -30 ) : '');
        $x = strtolower(substr($_FILES['image']['name'], -3));
        if ($filename && !in_array($x, $ok_filetypes)) {
            message('Sorry, the filetype you have tried to upload is not allowed.');
        }

            $uniq = $id.'_'.substr(md5(uniqid(rand())), 0, 10);
            // This is line is commented for a reason 
            // $ext = strtolower( substr($_FILES['attached']['name'], -3));
            move_uploaded_file($_FILES['image']['tmp_name'], $pun_config['o_base_url'].'/members/images/'.$uniq);

            // Put the stuff in the db
            $db->query('INSERT INTO '.$db->prefix.'gallery (user_id, url, caption) VALUES(
            \''.addslashes($id).'\',
            \''.addslashes($uniq).'\',
            \''.addslashes($_POST['caption']).'\'
            )') or error('Unable to insert picture into db', __FILE__, __LINE__, $db->_error());
                                        
            redirect('profile.php?id='.$id, 'Your Picture has been added! Redirecting...');
            }
            
            } else {
            
require $pun_root.'header.php';
?>
    <form action="<?php echo $pun_root ?>members/images/upload.php?id=<?php echo $id ?>" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="form_sent" value="1" />
    <input type='hidden' name='MAX_FILE_SIZE' value='614400' />
    <table cellpadding="4" cellspacing="1" class="main" width="420">
        <tr class="head">
            <td class="head"><b>Upload Image</b></td>
        </tr>
        <tr class="con1">
            <td style="padding-bottom:0px;">Upload an Image<br /><span class="small"><i>Images must be in JPEG, BMP, or GIF format and less than 512kb in size.</i></span></td>
        </tr>
        <tr class="con1">
            <td><input type="file" name="image" size="50" /></td>
        <tr class="con1">
            <td>
                <table cellspacing="0" cellpadding="0" width="100%">
                    <tr>
                        <td>
                            Add a Caption:
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" name="caption" style="width:400px;" maxlength="216" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr class="con1">
            <td align='right'><input type="submit" name="submit" class="button" value="Submit" /></td>
        </tr>
    </table>
    </form>
<?php 
require $pun_root.'footer.php';
}
?>
$_GET['id'] = $id;
    if (empty($id) || $id < 2) {
        message('Bad request.');
    }    

    if ($cookie['is_guest'] || $cur_user['id'] != $id && $cur_user['status'] < PUN_MOD) {
        message('You are not allowed to access this page.');
    }
    
    if (isset($_POST['form_sent']))
    {
        $uploaded_file = $_FILES['image'];
        
        // Make sure the upload went smooth
        switch ($_FILE['image']['error'])
        {
            case 1:    // UPLOAD_ERR_INI_SIZE
            case 2:    // UPLOAD_ERR_FORM_SIZE
                message('Too large.');
                break;

            case 3:    // UPLOAD_ERR_PARTIAL
                message('Partial upload.');
                break;

            case 4:    // UPLOAD_ERR_NO_FILE
                message('No file.');
                break;

            default:
                // No error occured, but was something actually uploaded?
                if ($_FILE['image']['size'] == 0)
                    message('No file');
                break;
        }
        
        if (is_uploaded_file($uploaded_file['tmp_name']))
        {
    
        $ok_filetypes = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png');
        if (!$_FILES['image']['error'] && $_FILES['image']['size'] > $pun_config['o_avatars_size'] * 1024) {
            message('Sorry, but the attached file is too large. Please reduce the size of it\'s contents.'); // #err
        }
        
        $filename = (!$_FILES['image']['error'] ? substr(basename($_FILES['image']['name']), -30 ) : '');
        $x = strtolower(substr($_FILES['image']['name'], -3));
        if ($filename && !in_array($x, $ok_filetypes)) {
            message('Sorry, the filetype you have tried to upload is not allowed.');
        }

            $uniq = $id.'_'.substr(md5(uniqid(rand())), 0, 10);
            // This is line is commented for a reason 
            // $ext = strtolower( substr($_FILES['attached']['name'], -3));
            move_uploaded_file($_FILES['image']['tmp_name'], $pun_config['o_base_url'].'/members/images/'.$uniq);

            // Put the stuff in the db
            $db->query('INSERT INTO '.$db->prefix.'gallery (user_id, url, caption) VALUES(
            \''.addslashes($id).'\',
            \''.addslashes($uniq).'\',
            \''.addslashes($_POST['caption']).'\'
            )') or error('Unable to insert picture into db', __FILE__, __LINE__, $db->_error());
                                        
            redirect('profile.php?id='.$id, 'Your Picture has been added! Redirecting...');
            }

I get the message: "No File" whenever I try to upload an image but the problem is is that there is a file...Does anyone see an error in my syntax?

6

(5 replies, posted in PunBB 1.2 show off)

Interesting program. I like it! smile I think I will implement it next time I update Urban Idiots. I'll be sure to tell you how it works out and are you affiliated with that website/script? If so tell them that's what I've been looking for. big_smile

JohnS wrote:

Nice layout but none of your images show up.

I wonder why that could be. For me, it shows up fine in Firefox, IE, and Netscape. Any suggestions for fixing this?

7

(5 replies, posted in PunBB 1.2 show off)

Hey guys, this is just something I've been working on in my spare time.

http://urbanidiots.awardspace.com/forums.php

It currently runs punbb version 1.2.11. It looks like the design from the 1.1 series. That is because I really liked the style of the older version. big_smile Yes, it is heavily modded which is exactly why I like punbb, because it is easy to modify! smile

Constructive criticism is appreciated. Thanks...

KOVA, if you are willing to give out that kind of trust to some random person, I'd be glad to help you. tongue I've integrated many websites and forums together. I do website programming and design in my spare time. Since this is only for free, I'd only do the basics. Nothing special...but I'm willing to offer my services...

Here is my website: http://vganda.com

I used the very basics of punbb version 1.1.5 and modded it and made a homemade CMS...I started this project off and on since about May of 2005...so I've been working on it for quite awhile now...

10

(5 replies, posted in PunBB 1.2 show off)

You're about the 999th person who asks me this. I only used the basic features of punbb, no templates or language files or anything like that. I grabbed the code I needed. You have to be into PHP and MYSQL if you want to make that work. There's a lot to be modified, and its impossible to give you a step by step how-to.

You can use the extern.php file of punbb to get the active topics list, but if you just know the very basics of PHP and MYSQL, you should be able to easily do it yourself.

Don't be discouraged though; when I started out with all this php stuff I was messing around with a very simple script not knowing anything about php and mysql (I did know about HTML), and learned along the way. I suggest you try the same thing. Get a simple messageboard( punbb of course wink ) - or similar script, and start messing with it. However, if you don't know the basics of HTML I suggest you start with that first.

You can check www.hotscripts.com for scripts, but there are more sites out there of course.

Im not sure what you already know, but if you are a total beginner I'd suggest this:

1. Do a HTML tutorial. And do it all in NOTEPAD, not dreamweaver. You'll become a 1337 HTML'er who knows what he's doing. It'll save you a LOT of time to fix errors and stuff. There have been quite some dreamweaver-fella's who needed help with the most simple errors on their websites. Start using dreamweaver when you can write all the basic html in notepad.

2. Find a nice PHP+MYSQL script with something like a message submit into a database. Whatever you don't understand you will find in any basic PHP/MYSQL tutorial. Mess with it, change stuff, see what happens. If you're at this point and get stuck, you can ask me for help if you want.

3. Try to recreate stuff.

Trial and error will make you good, no matter how much tutorials you read. But you already know that of course.

Good luck,

Goober

11

(5 replies, posted in PunBB 1.2 show off)

Thanks, I fixed it...

12

(5 replies, posted in PunBB 1.2 show off)

Hey, this is what I've been working on for the past few months or so on. I didn't want to use verison 1.2 because I thought it was to complicated for my needs. I didn't want user groups or anything like that so I stuck with good old verison 1.1.5... tongue Tell me what you think. Oh I had to remove the copyright because I don't use the footer.php file anymore.  I relocated the copyright to the links page. So any criticism whether good or bad is wanted. I still am working out the bugs so please bear with me...

Here's the link:
http://vganda.com/forums.php


~Goober

Sweet I do have access to punbb's global variables...

I replaced require with require_once and I stopped getting the error message, although I'm going to run some tests to see if works properly...

Hmmm...I commented everything in my script with extern.php and it still displays the same error message.

yes, I am including extern.php but not functions.php...

I know that punbb is made up of multipurpose pages and what I plan on doing is add an additional multipurpose page. Whenever I try to include the common.php file I get this fatal error:

Fatal error: Cannot redeclare check_cookie() (previously declared in /var/www/html/include/functions.php:29) in /var/www/html/include/functions.php on line 29

Is there anyway I that I can fix this while still having access to punbb's global variables?
Thanks,
~Goober

Sorry, I meant to say post count... tongue  Silly me...

Connorhd, I think she is asking for a mod or a feature that allows post count to be disabled in certain parts of the forum...

Lol, nevermind, I figured out the problem...

The variables on line 70 in post.php are listed from the query on line 58. They were already listed on line 62. The listing is incomplete since there are more values fetched in the query then there are listed so both vars were empty. The function on line 75 sends the empty var $forum_id to the function, but since its empty it can't complete the query on line 252 in functions.php.

It was just a matter of effort on my part. wink But thanks for taking interest in my post... tongue
~Goober

I seem to get an error message when I try to make replys to topics but not when I post a new topic. Here is the error message:

An error was encountered
File: /var/www/html/include/functions.php
Line: 252

PunBB reported: Unable to fetch forum info
Database reported: You have an error in your SQL syntax near '' at line 1 (Errno: 1064)

Here is line 252:

$result = $db->query('SELECT moderators, admmod_only, closed FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());

I also ran dump() and here is what I got when I tried to post using the quick post:

SELECT moderators, admmod_only, closed FROM pun_forums WHERE id=

Here is what i got using post.php:

SELECT moderators, admmod_only, closed FROM pun_forums WHERE id=6

PS: I've using version 1.1.5
Any ideas what is wrong? Thanks,
~Goober

Ok, the programming part is solved...now we just need some good rank images... wink

If anyone has any good likes, please share them... big_smile

This image is from Proboards -> http://4d5.net/boardimages/star.gif

What's the error message you get?

24

(4 replies, posted in PunBB 1.2 show off)

I know, but he has the maintenance message up right because he is doing something to it... sad but when you guys get a chance, check it out! smile

They're in the php files, (edit header.php if you want to edit the header) but like Connorhd said, you could just use main.tpl but it also depends on what your trying to do...