51

(11 replies, posted in General discussion)

yup Connorhd is right, actually that's what I mean,
I would like to know how big is your site need space and bandwidth?
Btw how about your site Connorhd? you're recently running a host, does that consume your space/bandwidth?

supermod i thought it was = super model...  lol

53

(2 replies, posted in Programming)

which java you would like to learn? is it J2ME, J2EE, java script, java applet, or jsp decide it first
they have similar syntax but sometimes it can be totally different.
you can try search at google, or hotscripts.com for an example

54

(11 replies, posted in General discussion)

wooww that really fantastic and also cheap.. in my country hosting are really expensive sad
actually right now i don't need large capacity, but maybe in the future. i hope not.. lol

55

(11 replies, posted in General discussion)

thanks a lot middleground that article has lightening me smile
now i know what i've got here is too much for me, i'm so stupid sad
recently i buy host with 100mb space and 2GB bandwith but that wasn't sharedhost so i can't sell it, damm
now i'm confuse what should i do with all of this big_smile
nvm maybe i will think that later

56

(11 replies, posted in General discussion)

I've plan to buy a hosting but I confuse with space and bandwith I really need?
Let's say if you're gonna run a site that use for a lot of people in one country, people can write their own news, article, reviews, upload their photos, avatars, and give an attachment.
Do you think that would be need how many space and how many bandwidth per a month?
Please give me suggestions based on your experiences, thanks a lot... (sorry for my poor english)

57

(1,382 replies, posted in General discussion)

404

function pun_news($fid='', $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = 't.posted';
    $forum_sql = '';
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
    $show = intval($show);
    if ($show < 1 || $show > $show_max_topics)
    $show = 15;
    $saveddate="";
    // Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.num_replies, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else
            $subject_truncated = $cur_topic['subject'];

        $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($subject_truncated).'</a>';
        $newsfooter = 'Posted by '.$cur_topic['poster'].' | '.format_time($cur_topic['posted']).' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new">Comments ('.$cur_topic['num_replies'].')</a>';

        // Group posts by date
        $thisdate = date('l, d F Y', $cur_topic['posted']);
        if ($saveddate)
        {
            $temp .= "</div></div>";
        }
        $temp .= '<div class="block"><h2><span>'.$newsheading.'</span></h2><div class="box"><div class="inbox">';
        $saveddate = $thisdate;
        $id = $cur_topic['id'];
        $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
            if ( !$db->num_rows($msg) ) continue;
        $cur_post = $db->fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        //if ($truncate == 1)
        //{
        $paragraph = preg_split("/\s*\n+/", $cur_post['message']);
            if (isset($paragraph[1])) {
                $cur_post['message'] = $paragraph[0] . "...";
            }
        //}
        $cur_post['message'] = parse_message($cur_post['message'], 0);
        // Display 80 karakter only (comment out next 8 lines to turn off)
        while ($cur_posts = $db->fetch_assoc($msg))
        {
            if (pun_strlen($cur_posts['message']) >= 80)
            {
                $cur_posts['message'] = substr($cur_posts['message'], 0, 79);
                $cur_posts['message'] .= '…';
            }
        }

        // View avatar
        $user_avatar = '';

        if ($pun_config['o_avatars'] == '1')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' alt="" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' alt="" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt="" />';
        }
        else
            $user_avatar = '';

        $temp .= '<label class="conl">'.$user_avatar.'</label>';
        $temp .= '<div class="box" style="padding:5px; margin:4px;">'.$cur_post['message']."</div>";
        $temp .= '<p>'.$newsfooter.'</p>';
        $temp .= "</div>";
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= "</div></div>";
    return $output;
}

I've modified pun_news to show avatars & comments, not perfect but it's enough for me

59

(1,382 replies, posted in General discussion)

robots

60

(8 replies, posted in PunBB 1.2 modifications, plugins and integrations)

on my case yes it has an action and yes it update the list, sorry but i'm too lazy and too tired to describe it right now. Visit my site maybe it will self explain, btw thanks for the critics... smile

61

(1,382 replies, posted in General discussion)

cute

62

(8 replies, posted in PunBB 1.2 modifications, plugins and integrations)

upss.. it was edit from my index.php which is has login box infront off it, if i'm not wrong the purpose off it is to affect the online list and the users last visit data. I notice if i don't put if (isset($_GET['action'])) then that page won't change the online list until we move to other page. But what I want is that page has affect before he/she moved tp other page. I'm newbie Connorhd, so if i've mistakes you're welcome to correct it wink

63

(8 replies, posted in PunBB 1.2 modifications, plugins and integrations)

Rewozz try this one, is this what you want?

<?php

define('PUN_ROOT', './');
define('PUN_ALLOW_INDEX', 1);

if (isset($_GET['action']))
    define('PUN_QUIET_VISIT', 1);

require PUN_ROOT.'include/common.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);

require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';

function pun_news($fid='', $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = 't.posted';
    $forum_sql = '';
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
    $show = intval($show);
    if ($show < 1 || $show > $show_max_topics)
    $show = 15;
    $saveddate="";
    // Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else
            $subject_truncated = $cur_topic['subject'];

        $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a>';

        // Group posts by date    
        $thisdate = date('l, d F Y', $cur_topic['posted']);
        if ($thisdate != $saveddate) 
        {
            if ($saveddate)
            {
                $temp .= "</div></div>";
            }
            $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>';
            $saveddate = $thisdate;
        }
        else {
            $temp .= '<div class="inbox"><p>';
        }
        $temp .= $newsheading.'</p>';
        $id = $cur_topic['id'];
        $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
        if ( !$db->num_rows($msg) ) continue;
        $cur_post = $db->fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        /*if ($truncate == 1)
        {*/
        $paragraph = preg_split("/\s*\n+/", $cur_post['message']);
            if (isset($paragraph[1])) {
                $cur_post['message'] = $paragraph[0] . "...";
            }
        //}
        $cur_post['message'] = parse_message($cur_post['message'], 0);
        // Display 80 karakter only (comment out next 8 lines to turn off)
        while ($cur_posts = $db->fetch_assoc($msg))
        {
            if (pun_strlen($cur_posts['message']) >= 80)
            {
                $cur_posts['message'] = substr($cur_posts['message'], 0, 79);
                $cur_posts['message'] .= '…';
            }
        }
        $num_comments = $db->result($db->query('SELECT COUNT(id)-1 AS num FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id']));
        $temp .= '<div class=box style="padding:5px; margin:4px;">'.$cur_post['message'].'</div>Posted by '.pun_htmlspecialchars($cur_post['poster']).' '.date('Y-m-d H:i', $cur_post['posted']).' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'">Comments ('.$num_comments.')</a>';
        $temp .= "</p>";
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= "</div></div>";
    return $output;
}

//syntax: pun_news(forum id, number of news to display, truncate news);
echo pun_news(1, 5, 0);

require PUN_ROOT.'footer.php';

64

(36 replies, posted in General discussion)

hi all, I see that everyone like to have chatmod. I really like to re-write ChatBox, it will still using PHP and JavaScript. Plan features are:

- low bandwidth required
- No MySQL database required
- Smilies, bb codes
- Sound alert on new messages
- Admin plugin
- integrated with PunBB

What do you think?
(I still busy at this time with my final exam at college, so maybe it will delay on release)

65

(13 replies, posted in General discussion)

yag maybe you could try Ubuntu Linux, it's new distro which is based on debian i think. At this time they still on promotion so if you lucky maybe you'll get free CD from them.

66

(8 replies, posted in PunBB 1.2 discussion)

nothing wrong just give a comments, is that wrong too?

67

(8 replies, posted in PunBB 1.2 discussion)

ehem.. the style looks similar for me smile

68

(13 replies, posted in General discussion)

i think woody is the new name for their new version? nvm it's just a name.
great idea hcgtv, thanks for the hints. atm i'm still on learning it by now. maybe i just need to wait for couple years till can fully understand linux

69

(13 replies, posted in General discussion)

hcgtv i've been waiting for you to join this topic, i notice from your site that you run debian too so i decided to talk about it at here. btw I've already had 9 cd of woody r4, and also has tried to install it, sigh debian has really bad interface for the installation. Now i think the main problem is what should i do then? I don't know anything about linux command line, maybe i should just follow yag by using windows but this will make Bill gates happy then big_smile

70

(13 replies, posted in General discussion)

is it safe to run server for public with winXP? i also run winxp on pentium 2,4 Ghz, ram 512mb DDR, 40GB HDD but i place it on computer which is just for testing, do you think that spesification can also to run a server for public?

71

(13 replies, posted in General discussion)

Does anyone in here has ever make your own server using Debian Linux, I've installed it a few months a go into my laptop just for testing out but it seems that debian doesn't support all hardware. So I decided to uninstall it, I'm so desperate about this distro, anyone could share what the most requirements I should have to make my own server? especially using this linux, I'm newbie so any hints are welcome.

72

(36 replies, posted in General discussion)

erissiva if the chat saved in database i'm affraid it might not good method but still possible, cause it will make the database server busy, just thingking when 50 people join the room at one time. While java is working as client side which is connect to chat server at irc it will look likes mirc. The problem is only the client computer has to be installed first with JRE(java runtime environment) or other component should be there, but java automatically detects that so it will install by itself.

miowpro the width is follow the width of your forum, but I have made a new one which is only modified the look of it. The idea is put all the box inside table(at left is the room and the right is where users write a messages) plus added whos online at the bottom. But now it can't restrict guest for only looking at the room.

Replace all inside chatbox.php with this

<?php

$pun_root = './';

if (!defined('PUN_ROOT')) define('PUN_ROOT','./');

require $pun_root.'include/common.php';

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

//Hide ChatBox from Guest
if ($pun_user['is_guest'])
   message($lang_common['No permission']);

$page_title=pun_htmlspecialchars($pun_config['o_board_title']).' / ChatBox';
require $pun_root.'lang/'.$pun_user['language'].'/'.'chatbox.php';
require $pun_root.'lang/'.$pun_user['language'].'/'.'index.php';

define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

###################### Configuration of ChatBox ########################

$hide_smilies = 0;            // 1 = hide smilies, 0 = show smilies
$msg_max = 50;                // max. messages in chatbox
$file_name = 'chatbox.txt'; // file where there are all messages
$box_height = '217px';        // height of chatbox

########################################################################

require PUN_ROOT.'include/parser.php';

$tpl_room = file_get_contents(PUN_ROOT.$file_name);

$messages = explode("</MESSAGE>", $tpl_room);

$nb_messages = count($messages);

$room = '';
$room_txt = '';
$anti_flood = 0;

if (isset($_GET['action']) && isset($_POST['req_message']))
  $room_tmp_flood = '<MESSAGE><ID>'.$pun_user['id'].'</ID><TEXT>'.$_POST['req_message'].'</TEXT>';
else
  $room_tmp_flood = '<no_post>';

  
for($i=0;$i<$nb_messages - 1;$i++)
{
  $grab = ereg("<ID>(.*)</ID>", $messages[$i], $mess_id);
  $grab = ereg("<PSEUDO>(.*)</PSEUDO>", $messages[$i], $mess_pseudo);
  $grab = ereg("<DATE>(.*)</DATE>", $messages[$i], $mess_date);
  $grab = ereg("<TEXT>(.*)</TEXT>", $messages[$i], $mess_text);

  $room .= '[<a href="profile.php?id='.$mess_id[1].'"><strong>'.pun_htmlspecialchars($mess_pseudo[1]).'</strong></a> - '.format_time($mess_date[1])."]".parse_message($mess_text[1], $hide_smilies)."\n".'<br />'."\n";
  if ($i+1 < $msg_max)
  {

  $room_txt_flood = '<MESSAGE><ID>'.$mess_id[1].'</ID><TEXT>'.$mess_text[1].'</TEXT>';

   if ($room_tmp_flood == $room_txt_flood)
    $anti_flood = 1;

    $room_txt .= '<MESSAGE>'."\r".' <ID>'.$mess_id[1].'</ID>'."\r".' <PSEUDO>'.$mess_pseudo[1].'</PSEUDO>'."\r".' <DATE>'.$mess_date[1].'</DATE>'."\r".' <TEXT>'.$mess_text[1].'</TEXT>'."\r".'</MESSAGE>'."\n\n";

  }
}

if (isset($_GET['action']) && isset($_POST['req_message']))
{
    if ($anti_flood == 0 && $_POST['req_message'] != '')
    {
      $fp = fopen(PUN_ROOT.$file_name, "w");
      if ($fp)
      {
        $room_txt = '<MESSAGE>'."\r".' <ID>'.$pun_user['id'].'</ID>'."\r".' <PSEUDO>'.$pun_user['username'].'</PSEUDO>'."\r".' <DATE>'.time().'</DATE>'."\r".' <TEXT>'.$_POST['req_message'].'</TEXT>'."\r".'</MESSAGE>'."\n\n".$room_txt;
        $r = fwrite($fp, $room_txt);
      }
      fclose($fp); 
      $room = '[<a href="profile.php?id='.$pun_user['id'].'"><strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></a> - '.format_time(time())."]".parse_message($_POST['req_message'], $hide_smilies)."\n".'<br />'."\n".$room;
    }
    elseif ($anti_flood == 1)
    {
      $room = '<strong><font color=red>'.$lang_chatbox['Anti flood'].'</font></strong>'."\n".'<br />'."\n".'<br />'."\n".$room;
    }
    else
    {
      $room = '<strong><font color=red>'.$lang_chatbox['Anti blank'].'</font></strong>'."\n".'<br />'."\n".'<br />'."\n".$room;
    }
}
?>

<h2><span><?php echo $lang_chatbox['Chatbox']; ?></span></h2>
<div class="box">
<table cellspacing="0">
<thead>
    <tr>
        <th><?php echo $lang_chatbox['Room']; ?></th>
        <th><?php echo $lang_chatbox['Messages']; ?></th>
    </tr>
</thead>
<tbody>
    <tr>
    <td valign="top" style="padding:0; margin:0">    
        <div style="padding:5px;margin:0;overflow:auto;height:<?php echo $box_height; ?>;">
            <?php echo $room; ?>
        </div>
    </td>

    <script type="text/javascript">
    <!--
    function refreshRoom()
    {
        window.location="<?php echo $pun_root.'chatbox.php' ?>";
    }
    // -->
    </script>

    <td valign="top" style="border:none; padding:0; margin:0">
    <div class="inbox">
        <fieldset>
        <form id="post" method="post" name="form_room" action="?action=send" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
            <?php require PUN_ROOT.'mod_easy_bbcode.php'; ?>
            <label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
            <ul class="bblinks">
                <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
                <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
                <li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
            </ul>
        <p align="right"><input type="submit" name="send" tabindex="2" value="  <?php echo $lang_chatbox['Btn Send']; ?>  " /> <input type="button" name="refresh" tabindex="3" value=" <?php echo $lang_chatbox['Btn Refresh']; ?> " onClick="refreshRoom()"></p>
        </fieldset>        
        </form>        
    </div>
    </td>
</tr></table></div>

<div class="box">
    <div class="inbox">
    <?php

    if ($pun_config['o_users_online'] == '1')
    {
        // Fetch users online info and generate strings for output
        $users = array();
        $result = $db->query('SELECT user_id, ident, color FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

        while ($pun_user_online = $db->fetch_assoc($result))
        {
            if ($pun_user_online['user_id'] > 1)
            $users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'"><span style="color: '.$pun_user_online['color'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</span></a>';
        }

        $num_users = count($users);

        if ($num_users > 0)
            echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
        else
            echo "\t\t\t".'<div class="clearer"></div>'."\n";
    }
    else
        echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";
    ?>
        </div>
    </div>
<br />

<?php

require PUN_ROOT.'footer.php';

and then add at lang/LANGUAGE/chatbox.php

'Room'  =>  'Room',

Enjoy wink

I suggest that you use editor which is can do find/replace with huge text, because commonly instructions in the mod is told you to replace or find a code. My favourite is Editplus, it's free download.

Is it possible that the answers in the chat will appera without refreshing the window?

It can be done by using auto refresh on the page, but I don't like it so I don't write it. It should be easy maybe someone has already written that.

Is there posiibility to make this chat to work like that: whem a person enters the chat he does not see what was written before?

If you mean in here that user can have chat likes on instant messaging, if using this code I'm affraid it can't be done but I think ConnorHd is working on other Chatmod too which is using java.