九王爷

九王爷的府邸


  • 首页

  • 分类

  • 归档

  • 标签

CentOS 5.1 Server Setup: LAMP, Email, DNS, FTP, ISPConfig (a.k.a. The Perfect Server)

发表于 2008-01-09 | 分类于 Server

官方网站实在是太慢了,弄到这里来加快点浏览速度

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 12/04/2007

This tutorial shows how to set up a CentOS 5.1 based server that offers all services needed by ISPs and web hosters: Apache web server (SSL-capable), Postfix mail server with SMTP-AUTH and TLS, BIND DNS server, Proftpd FTP server, MySQL server, Dovecot POP3/IMAP, Quota, Firewall, etc. This tutorial is written for the 32-bit version of CentOS 5.1, but should apply to the 64-bit version with very little modifications as well.

I will use the following software:

  • Web Server: Apache 2.2 with PHP 5.1.6
  • Database Server: MySQL 5.0
  • Mail Server: Postfix
  • DNS Server: BIND9 (chrooted)
  • FTP Server: Proftpd
  • POP3/IMAP server: Dovecot
  • Webalizer for web site statistics
    In the end you should have a system that works reliably, and if you like you can install the free webhosting control panel ISPConfig (i.e., ISPConfig runs on it out of the box).

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Requirements

To install such a system you will need the following:

  • Download the CentOS 5.1 DVD or the six CentOS 5.1 CDs from a mirror next to you (the list of mirrors can be found here: http://isoredirect.centos.org/centos/5/isos/i386/).
  • a fast internet connection.

2 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.

3 Install The Base System

Boot from your first CentOS 5.1 CD (CD 1) or the CentOS 5.1 DVD. Press <ENTER> at the boot prompt:

Click to enlarge

It can take a long time to test the installation media so we skip this test here:

The welcome screen of the CentOS installer appears. Click on Next:

Choose your language next:

Select your keyboard layout:

I’m installing CentOS 5.1 on a fresh system, so I answer Yes to the question Would you like to initialize this drive, erasing ALL DATA?

Now we must select a partitioning scheme for our installation. For simplicity’s sake I select Remove linux partitions on selected drives and create default layout. This will result in a small /boot and a large / partition as well as a swap partition. Of course, you’re free to partition your hard drive however you like it. Then I hit Next:

Answer the following question (Are you sure you want to do this?) with Yes:

On to the network settings. The default setting here is to configure the network interfaces with DHCP, but we are installing a server, so static IP addresses are not a bad idea… Click on the Edit button at the top right.

In the window that pops up uncheck Use dynamic IP configuration (DHCP) and Enable IPv6 support and give your network card a static IP address (in this tutorial I’m using the IP address 192.168.0.100 for demonstration purposes) and a suitable netmask (e.g. 255.255.255.0; if you are not sure about the right values, http://www.subnetmask.info might help you):

Set the hostname manually, e.g. server1.example.com, and enter a gateway (e.g. 192.168.0.1) and up to two DNS servers (e.g. 145.253.2.75 and 193.174.32.18):

Choose your time zone:

Give root a password:

Now we select the software we want to install. Select nothing but Server (uncheck everything else). Also don’t check Packages from CentOS Extras. Then check Customize now, and click on Next:

Now we must select the package groups we want to install. Select Editors, Text-based Internet, Development Libraries, Development Tools, DNS Name Server, FTP Server, Mail Server, MySQL Database, Server Configuration Tools, Web Server, Administration Tools, Base, and System Tools (unselect all other package groups) and click on Next:

The installer checks the dependencies of the selected packages:

Click on Next to start the installation:

The hard drive is being formatted:

The installation begins. This will take a few minutes:

Finally, the installation is complete, and you can remove your CD or DVD from the computer and reboot it:

After the reboot, you will see this screen. Select Firewall configuration and hit Run Tool:

I want to install ISPConfig at the end of this tutorial which comes with its own firewall. That’s why I disable the default CentOS firewall now. Of course, you are free to leave it on and configure it to your needs (but then you shouldn’t use any other firewall later on as it will most probably interfere with the CentOS firewall).

SELinux is a security extension of CentOS that should provide extended security. In my opinion you don’t need it to configure a secure system, and it usually causes more problems than advantages (think of it after you have done a week of trouble-shooting because some service wasn’t working as expected, and then you find out that everything was ok, only SELinux was causing the problem). Therefore I disable it, too (this is a must if you want to install ISPConfig later on). Hit OK afterwards:

Then leave the Setup Agent by selecting Exit:

Then log in as root and reboot the system so that your changes can be applied:

shutdown -r now

Now, on to the configuration…

user names as subdomains - HOWTO

发表于 2008-01-08 | 分类于 Server

user names as subdomains - HOWTO

I think this can interrest someone:

It used to drive me crazy have user names in format
http://www.domain.tld/users/webXX_user
wanted them as http://user.domain.tld (third level domain)

so here is how to do it

1. in Ispconfig go to Management->System Config->Settings->ISP manager
change User Prefix to [DOMAIN]_
then user dirs will lok like http://www.domain.tld/users/domain.tld_user

2. Create file /etc/httpd/user_rewrite.conf which includes

RewriteCond %{SERVER_NAME} !^www.
RewriteCond %{SERVER_NAME} !^mail. ( not neccessary see bellow)
RewriteCond %{SERVERNAME} ^([^.]).(...)$
RewriteRule ^/(.
)$ /var/www/www.%2/user/%2
%1/web/$1 [L]

You can create as many lines like “RewriteCond %{SERVER_NAME} !^www.” as you want
^www. here means that www.domain.tld will not rewrite (will not be looking for directory http://www.domain.tld/users/domain.tld_www, but show www.domain.tld) In my case i’m using also rewrite to show webmail as mail.domain.tld for each domain so i also have
RewriteCond %{SERVER_NAME} !^mail.

3. In ISP manager->sites click on your site, then go to “Co-domains” and add
yourIP * domain.tld

6 In ISPmanger->sites-> www.domain.tld ->Basic put “Include user_rewrite.conf” into Apache Directives (Optional):

If you have more domains and don’t want to forget do this for each domain, change:
Management->Form Designer->Edit Form->isp - ISP Web:->edit->web_httpd_include->Edit and put Include user_rewrite.conf into Default: window

5. In DNS manager ->domain.tld-> records you must create
CNAME * domain.tld

6. probably not necessary, but you can restart apache “apachectl restart”

and you are done

=============
If you want to have mail.domain.tld for each domain showing your default webmail
must have in DNS for your site
CNAME mail yourwebmail.yourdomain.tld
and your /etc/httpd/user_rewrite.conf should look like this

RewriteEngine on
RewriteCond %{SERVER_NAME} ^mail..$
RewriteRule . /var/www/path_to_your_webmail_site/web$0 [L]
RewriteCond %{SERVER_NAME} !^www.
RewriteCond %{SERVER_NAME} !^www2.
RewriteCond %{SERVER_NAME} !^mysql2.
RewriteCond %{SERVER_NAME} ^([^.]
).(...)$
RewriteRule ^/(.*)$ /var/www/www.%2/user/%2_%1/web/$1 [L]

It works for me, i have configured webmail outside ISPconfig apache, if you use some webmail inside ispconfig in /home/admispconfig/ispconfig/web/yourwebmail it may not work (haven’t tried)

Just have 2 questions for Falco or some other developer here .)

1. is there more ellegant way how to include user_rewrite.conf for all domains?
It didnt work for me to include in httpd.conf for all domains at once, its working just when included for each Virtual Host separatelly

2. Can i change default DNS entry for domains without editing code?
In my case i like to have DNS for all domains by default like this:

A Record
empty (domain.tld is already included in zone file but not showed in DNS manager)

CNAME
Hostname Target

  • mydomain.tld
    mail mail.myhosting.tld

MX
Mailserver Hostname
mail.myhosting.tld
mailbackup.myhosting.tld

(by default it shows MX admin.myhosting.tld which is wrong for me i have admin on different ip adress then users webs)

from(http://www.howtoforge.com/forums/showthread.php?t=12383)

在WordPress首页和目录页显示摘要的方法

发表于 2008-01-08 | 分类于 Site

在WordPress系统中,默认的首页和目录页使用的书全文输出,这对于文章内容较长的博客来说很不方面,下面我介绍一个方法,可以简单的实现在WordPress首页和目录页显示摘要而非全文。
  进入你安装的WP后台,选择外观—>主题编辑器—->选择你使用的模板(英文)选择index.php文件,没有的话就修改home.php,找到<?php the_content(); ?>这一行,将其修改为以下代码:
<?php if (function_exists(‘the_excerpt_reloaded’)) { ?>
<?php the_excerpt_reloaded(120, ‘<p><a><ul><ol><li><img><br /><blockquote><em><strong><div>’, ‘content’, FALSE, ‘’, FALSE, 1, TRUE); ?>
<?php } else { ?>
<?php the_excerpt(); ?>
<?php } ?>
<div class=”details”><div class=”inside”><?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?> so far | <a href=”<?php the_permalink() ?>”>Read On »</a></div></div>
  这时,你的WordPress首页和分类就显示为摘要信息而不是全文信息了,演示界面请参见Simon的博客

VHCS install @ CentOS 4.2

发表于 2007-12-11 | 分类于 Server
空闲的时间安装VHCS,这个是用来做虚拟主机管理的,和CPANEL相比,VHCS是开源的,阿建用得着。

根据VHCS的安装文档重写如下,以方便安装

1\. 安装OS

choose "server" option during install
firewall: open ssh/http/https/ftp/smtp ports
selinux: disable (warn still generates errors in VHCS)
select minimum install

安装类型选“自定义”
手动分区(4G虚拟硬盘)
/ ext3 2000M
 swap 2*mem
/var ext3 剩余空间(用户数据在此分区上)
eth0 关闭DHCP,10.10.10.180/255.255.255.0
hostname: srv180.capno.com
gateway: 10.10.10.1
dns: 202.106.0.20/202.106.196.115
Enable firewall,默认的四个服务全允许(SSH/HTTP,HTTPS/FTP/SMTP)
SELinux: Disable
安装包选择:Minimal最小化安装(676M)

2\. 基本配置
# useradd admin;passwd admin(以下操作凡未说明的都以root身份执行)
使用ssh客户端连接server
# vi /etc/fstab
LABEL=/var              /var                    ext3    defaults,usrquota        1 2
# touch /var/aquota.user;
  chmod 600 /var/aquota.user;
  mount -o remount /var;
  quotacheck -avugm
# server iptables stop;
mv /etc/rc.d/rc3.d/S08iptables /etc/rc.d/rc3.d/K08iptables
# vi /etc/grub.conf timeout=1

删除以下无用的软件包(iiimf-server,iiimf-csconv,iiimf-docs,iiimf-libs,xorg-x11-xfs并未安装)
# yum remove apmd autofs bluez-utils cups irda-utils
isdn4k-utils pcmcia-cs sendmail
ypbind xinetd

上传需要的软件包VHCS至/home/admin/
包含vhcs安装包,yum安装和升级包(节约yum升级时间),编译好的包(节约编译时间,第一次需要按官方文档自行编译)
# cd /home/admin/VHCS/;
cp -p yum_base/* /var/cache/yum/base/packages/;
cp -p yum_update/* /var/cache/yum/update/packages/

# rpm --import [http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt](http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt)
# vi /etc/yum.repos.d/CentOS-Base.repo的[base]和[update]项,设置为较快的镜象,如:

baseurl=http://mirror.secuidc.com/centos/$releasever/os/$basearch/
baseurl=http://mirror.secuidc.com/centos/$releasever/update/$basearch/

# cat <<EOF > /etc/yum.repos.d/dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
exclude=proftpd*
EOF

# yum install perl-libwww-perl perl-HTML-Parser perl-HTML-Tagset perl-URI
perl-Crypt-Blowfish perl-Crypt-CBC perl-Date-Calc perl-MIME-tools
perl-Convert-BinHex perl-IO-stringy perl-MailTools perl-TimeDate

# yum install rpm-build bind

# rpm -Uvh cpan2rpm-2.028-1.noarch.rpm

# tar vxfz Crypt-PasswdMD5-1.3.tgz; cd Crypt-PasswdMD5-1.3;
perl Makefile.PL; make; make install; cd ..

# tar vxfz Term-ReadPassword-0.07.tgz; cd Term-ReadPassword-0.07;
perl Makefile.PL; make; make install; cd ..

# rpm --import [http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4](http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4)
# yum install
bison bzip2-devel cyrus-sasl cyrus-sasl-plain
expect fam-devel flex freetype-devel
gcc gcc-c++ gdbm-devel httpd httpd-devel
iptables libc-client-devel libjpeg-devel
libmcrypt libmcrypt-devel libpng-devel libtool
libxslt-devel make mod_ssl
mysql mysql-devel mysql-server
ncurses-devel net-snmp-devel
openssl openssl-devel openssl-perl
pam-devel php php-imap php-gd
php-mysql php-pgsql php-snmp
pkgconfig postgresql-devel zlib-devel
(删掉了mysql-admin这个包,不存在。)
# ln -s /usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE/libperl.so /lib/
# rpm -Uvh proftpd-1.2.10-8_mysql.dag.i386.rpm;
rpm -Uvh postfix-2.2.5-1.mysql.sasl2.vda.rhel4.i386.rpm;
rpm -Uvh courier-authlib-*.rpm;
rpm -Uvh courier-mysql-0*.rpm courier-0*.rpm courier-imapd-0*.rpm courier-pop3d-0*.rpm;
rpm -Uvh php-mcrypt-4.3.9-3.1.1.i386.rpm
# vi /etc/postfix/main.cf
myhostname = srv180.capno.com
# vi /etc/httpd/conf/httpd.conf
ServerName srv180.capno.com:80

# chkconfig --add courier;
service courier start;
chkconfig proftpd on;
service proftpd start;
service mysqld start;
service httpd start;
service named start

# mysql
mysql> create database vhcs2;use mysql;
mysql> update user set password=password('DB_PASSWORD') where User='root';
mysql> flush privileges;

# cd /home/admin/VHCS/;
tar -xjpvf vhcs2-2.4.7.1.tar.bz2;
cd vhcs2-2.4.7.1/configs/vhcs2.conf

SERVER_HOSTNAME = srv180
BASE_SERVER_IP = 10.10.10.180
MR_LOCK_FILE = /var/run/vhcs2.lock
DATABASE_NAME = vhcs2
DATABASE_PASSWORD = ****
BIND_CONF_FILE = /etc/named.conf
BIND_DB_DIR = /var/named/chroot/var/named
APACHE_CMD = /etc/init.d/httpd
APACHE_NAME = httpd
APACHE_LOG_DIR = /var/log/httpd
APACHE_USERS_LOG_DIR = /var/log/httpd/users
APACHE_BACKUP_LOG_DIR = /var/log/httpd/backup
APACHE_CONF_FILE = /etc/httpd/conf.d/vhcs2.conf
APACHE_USER = apache
APACHE_GROUP = apache
MTA_SASLDB_FILE = /etc/sasldb2
CMD_NAMED = /etc/init.d/named
CMD_HTTPD = /etc/init.d/httpd
CMD_AUTHD = /etc/init.d/courier-authlib
CMD_IMAP = /etc/init.d/courier
CMD_POP = /etc/init.d/courier
CMD_VHCS2D = /etc/init.d/vhcs2
MAIL_TRAFF_LOG = maillog

# sed -i "s#/usr/lib/postfix#/usr/libexec/postfix#g" /home/admin/VHCS/vhcs2-2.4.7.1/configs/postfix/main.cf
# cd /home/admin/VHCS/vhcs2-2.4.7.1; make install

# mkdir /var/named/chroot;
mkdir /var/named/chroot/var;
mkdir /var/named/chroot/var/named;
chown -R named:named /var/named/chroot

# cp --reply=yes -R /tmp/vhcs-2.4.7.1/* /;
cp -pR /tmp/vhcs-2.4.7.1/var/mail/* /var/mail/;
cp -pR /tmp/vhcs-2.4.7.1/etc/init.d/vhcs2_* /etc/init.d/;
rmdir /etc/courier/userdb;
touch /etc/courier/userdb;chmod 600 /etc/courier/userdb;
cp -p /etc/courier/userdb /etc/authlib/userdb
makeuserdb

# cd /var/www/vhcs2/engine/setup/
# ./vhcs2-setup
hostname: srv180
system network address: 10.10.10.180
SQL server host: localhost
SQL database: vhcs2
SQL user: root
SQL password: *******
VHCS ftp SQL user: vftp
admin name: admin
admin password: *******
admin e-mail: [[email protected]](mailto:[email protected])

# sed -i "s/nogroup/nobody/" /etc/proftpd.conf
# chmod u+w -R /var/www/vhcs2/gui/tools/webmail/
# cd /etc/vhcs2/bind/parts/
# cp -p cfg_entry.tpl cfg_entry.tpl.bak
# vi cfg_entry.tpl
original line: file "{DB_DIR}/{DMN_NAME}.db";
replacement line: file "{DMN_NAME}.db";
# sed -i "s/0700/0755/" /var/www/vhcs2/engine/vhcs2-*
# touch /etc/sasldb2
(test with /usr/sbin/sasldblistusers2)

# vi /etc/init.d/vhcs2

#!/bin/sh
#
# vhcs2           Start or stop the vhcs2 daemon
#
# chkconfig: - 95 5
# processname: vhcs2
# description: Start or stop the vhcs2 daemon
#

name='vhcs2'
lockfile=/var/lock/subsys/vhcs2
confFile=/etc/vhcs2/vhcs2.conf
pidFile=/var/log/vhcs2/vhcs2.pid
daemon=/var/www/vhcs2/daemon/vhcs2_daemon
name=vhcs2_daemon

case "$1" in
    'start')
    $daemon >/dev/null 2>&1 </dev/null
    RETVAL=$?
    if [ "$RETVAL" = "0" ]; then
        touch $lockfile >/dev/null 2>&1
    fi
;;
'stop')
pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'`
kill `cat $pidfile`
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
    rm -f $lockfile
fi
;;
'status')
pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'`
if [ "$pidfile" = "" ]; then
    pidfile=$pidFile
fi
if [ -s $pidfile ]; then
    pid=`cat $pidfile`
    kill -0 $pid >/dev/null 2>&1
    if [ "$?" = "0" ]; then
        echo "$name (pid $pid) is running"
        RETVAL=0
    else
        echo "$name is stopped"
        RETVAL=1
    fi
else
    echo "$name is stopped"
    RETVAL=1
fi
;;
'restart')
$stop && $start
RETVAL=$?
;;
*)
echo "Usage: $0 { start | stop | restart }"
RETVAL=1
;;
esac
exit $RETVAL

# chmod +x /etc/init.d/vhcs2
# chkconfig --add vhcs2

# cd /etc/rc.d/rc3.d
# mv S35courier K35courier;
mv S13portmap K13portmap;
mv S14nfslock K14nfslock;
mv S18rpcidmapd K18rpcidmapd;
mv S19rpcgssd K19rpcgssd;
mv S25netfs K25netfs;
mv S40smartd K40smartd;
mv S44acpid K44acpid;
mv S80proftpd K80proftpd;
mv S85gpm K85gpm;
mv S95anacron K95anacron;
mv S95atd K95atd;
mv S97messagebus K97messagebus;
mv S98haldaemon K98haldaemon

# service httpd stop;
service mysqld stop;
service proftpd stop;
service courier stop;
service named stop;

# service named start;
service courier start;
service proftpd start;
service mysqld start;
service httpd start;
service vhcs2 start

访问[http://10.10.10.180/vhcs2](http://10.10.10.180/vhcs2) admin登录后修改默认语言
Genaral -> Muiltlanguage -> Chinese, Save
修改/etc/php.ini, defaultcharset = "gb2312", 重启httpd

PW6.0中增加评分字数0

发表于 2007-11-16 | 分类于 Site

研究了好久,终于找到修改的方法了,5.3的时候是修改jop.php文件,6.0中需要修改的是pw_ajax.php文件, 修改方法: 1、修改根目录下的pw_ajax.php中($atc_content,24)的24改为100 2、修改templatewind下的read.htm文件中头部 .tips li{list-style:none;width:30%……. 把30%改为100%

首页幻灯图+主题排行+会员排行 美观简化版 for pw6.0

发表于 2007-11-16 | 分类于 Site

要打开插件里的文字广告功能…

打开你的风格模板的index.htm文件(默认:论坛根目录\template\wind\index.htm)
在第一行找到
<!–<?php print <<<EOT
–>
替换为下面的代码

Quote:

<!–<?php
//首页调用开始
//默认只显示开放板块,不显示正规、隐藏、投票、认证板块

//幻灯图开始
$cachepics=R_P.”data/bbscache/index_toppics.php”;//幻灯图片缓存文件
$cachepicstime=60;//幻灯图片缓存自动更新时间,单位秒
//下一句设置要显示的板块类型,forum开放板块,former正规板块,hidden隐藏板块
$showforum=”(pf.f_type = ‘forum’ or pf.f_type = ‘former’)”;
if (($timestamp-@filemtime($cachepics)>=$cachepicstime)){
$query=$db->query(“SELECT pt.tid,pt.fid,pt.subject,pa.attachurl FROM pw_threads pt
,pw_attachs pa,pw_forums pf where pt.tid = pa.tid and pt.fid = pf.fid and pa.type=’img’ and pt.ifcheck=’1’ and “.$showforum.” and pf.password = ‘’
ORDER BY pt.postdate DESC
LIMIT 60
“); //可以根据需要调整,我这里是估算每个主题有10张图片的情况下。

$imgcontent=”<?php\n”;
$pics=$links=$texts=””;
$rs_i=0;
while ($imginfo = $db->fetch_array($query) and $rs_i<6) {//只调用6个主题的图片
if(($rs_tid!=$imginfo[tid])&&(eregi(“.(jpg)$”,$imginfo[attachurl]))){
$pics.=$db_bbsurl.”/“.$attachpath.”/“.$imginfo[attachurl].”|”;
$links.=$db_bbsurl.”/read.php?tid=”.$imginfo[tid].”|”;
$texts.=$imginfo[subject].”|”;
$rs_i++;//同一主题的只要最后上传的那张图片
}
$rs_tid=$imginfo[tid];
}

$pics=substr($pics,0,-1);
$links=substr($links,0,-1);
$texts=substr($texts,0,-1);

$pics=’$pics=”‘.$pics.’”;’;
$links=’$links=”‘.$links.’”;’;
$texts=’$texts=”‘.$texts.’”;’;

$imgcontent = $imgcontent.$pics.”\n”.$links.”\n”.$texts.”\n?>”;
writeover($cachepics,$imgcontent);
}
@require_once($cachepics);
//幻灯图结束

//会员排行+主题排行开始
$cachelist=R_P.”data/bbscache/index_toplist.php”;//主题排行缓存文件
$cachelisttime=60;//主题排行自动更新时间,单位秒
//下一句设置要显示的板块类型,forum开放板块,former正规板块,hidden隐藏板块
$showforum=”(pf.f_type = ‘forum’ or pf.f_type = ‘former’)”;
if(($timestamp-@filemtime($cachelist)>=$cachelisttime)){
$listnum=10;//主题显示个数
$listlength=26;//主题标题长度
$listnum1=6;//会员在线时间排行显示个数
$memberonline=$memberposttoday=$newthreads=$digestthreads=$replythreads=””;

//会员在线时间排行开始
$query = $db->query(“SELECT m.uid,m.username,md.onlinetime FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) WHERE md.onlinetime order by md.onlinetime desc limit 0,$listnum1”);
$c_i=1;//初始化图片序号
while($members=$db->fetcharray($query)){
$members[onlinetime]=(int)($members[onlinetime]/3600);
$i=0;
while((5$i$i+15$i)<=$members[onlinetime]){
$i++;
$C=5
$i$i+15$i;
$N=$i;
}
$more=$C-$members[onlinetime];
$lv=$N;
if($lv > 48) $lv = 48;
$memberonline.=”<img src=’$imgpath/top/c
“.$c_i.”.gif’ align=’absmiddle’ width=’11’ height=’11’> <a href=’profile.php?action=show&uid=$members[uid]’ title=’在线等级:{$lv} 级\n在线时长:{$members[onlinetime]} 小时\n升级剩余:{$more} 小时’>$members[username]</a> <img src=’$imgpath/top/{$lv}.gif’><br />”;
$c_i++;
}
unset($members);
unset($c_i);
//会员在线时间排行结束

//会员当日发帖排行开始
$query=$db->query(“SELECT m.uid,m.username,md.todaypost FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) WHERE md.lastpost>’$tdtime’ ORDER BY md.todaypost DESC limit 0,$listnum”);
$c_i=1;//初始化图片序号
while($members=$db->fetcharray($query)){
$memberposttoday.=”<img src=’$imgpath/top/c
“.$c_i.”.gif’ align=’absmiddle’ width=’11’ height=’11’> <a href=’profile.php?action=show&uid=$members[uid]’>$members[username]</a> $members[todaypost]<br />”;
$c_i++;
}
unset($members);
unset($c_i);
//会员当日发帖排行结束

//最新发表主题开始
$query = $db->query(“SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.hits FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck=’1’ and “.$showforum.” and pf.password = ‘’ order by pt.postdate desc limit 0,$listnum”);
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads[postdate]=getdate($threads[postdate]);
$subject=substrs($threads[subject],$listlength);
$newthreads.=”<img src=’$imgpath/top/c
“.$c_i.”.gif’ align=’absmiddle’ width=’11’ height=’11’> <a href=’read.php?tid=$threads[tid]’ title=’主题:$threads[subject]\n作者:$threads[author]\n时间:$threads[postdate]\n浏览:$threads[hits] 次’>$subject</a><br />”;
$c_i++;
}
unset($threads);
unset($c_i);
//最新发表主题结束

//社区精华主题开始
$query = $db->query(“SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.lastpost,pt.lastposter,pt.hits,pt.replies FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck=’1’ and pt.digest > 0 and “.$showforum.” and pf.password = ‘’ order by pt.postdate desc limit 0,$listnum”);
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads[postdate]=get_date($threads[postdate]);
$threads[lastpost]=getdate($threads[lastpost]);
$subject=substrs($threads[subject],$listlength);
$digestthreads.=”<img src=’$imgpath/top/c
“.$c_i.”.gif’ align=’absmiddle’ width=’11’ height=’11’> <a href=’read.php?tid=$threads[tid]’ title=’主题标题:$threads[subject]\n主题作者:$threads[author]\n发表时间:$threads[postdate]\n浏览次数:$threads[hits] 次\n最新回复:$threads[lastposter]\n回复时间:$threads[lastpost]\n回复次数:$threads[replies] 次’>$subject</a><br />”;
$c_i++;
}
unset($threads);
unset($c_i);
//社区精华主题结束

//最新回复主题开始
$query = $db->query(“SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.lastpost,pt.lastposter,pt.hits,pt.replies FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck = ‘1’ and pt.replies > 0 and “.$showforum.” and pf.password = ‘’ order by lastpost desc limit 0,$listnum”);
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads[postdate]=get_date($threads[postdate]);
$threads[lastpost]=getdate($threads[lastpost]);
$subject=substrs($threads[subject],$listlength);
$replythreads.=”<img src=’$imgpath/top/c
“.$c_i.”.gif’ align=’absmiddle’ width=’11’ height=’11’> <a href=’read.php?tid=$threads[tid]’ title=’主题标题:$threads[subject]\n主题作者:$threads[author]\n发表时间:$threads[postdate]\n浏览次数:$threads[hits] 次\n最新回复:$threads[lastposter]\n回复时间:$threads[lastpost]\n回复次数:$threads[replies] 次’>$subject</a><br />”;
$c_i++;
}
unset($threads);
unset($c_i);
//最新回复主题结束

@writeover($cachelist,”<?php\n\$memberonline=\”$memberonline\”;\n\$memberposttoday=\”$memberposttoday\”;\n\$newthreads=\”$newthreads\”;\n\$digestthreads=\”$digestthreads\”;\n\$replythreads=\”$replythreads\”;\n?>”);
}
@require_once($cachelist);
//会员排行+主题排行结束

//首页调用结束

print <<<EOT

–>

再找到如下的代码 :

Copy code
<!–
EOT;
}}
if($advertdb[text] && $id && $id<4){
for($i=$id;$i<4;$i++){print <<<EOT
–>
<td class=”f_one” width=”25%”><br /></td>
<!–
EOT;
}print <<<EOT
–>
</tr>
<!–
EOT;
}print <<<EOT
–>
</table></div>

下面加:

Quote:

<!– 主题排行开始 –>
<div class=”t”>
<table cellspacing=”0” cellpadding=”0” width=”100%”>
<tr class=”tr3 tac”>
<td width=”18%”><span class=”b” style=”color:#FF6699”>社区最新图片</span></td>
<td width=”22%”><span class=”b” style=”color:#669900”>最新发表主题</span></td>
<td width=”22%”><span class=”b” style=”color:#0066FF”>最新回复主题</span></td>
<td width=”22%”><span class=”b” style=”color:#FF9933”>社区精华主题</span></td>
<td width=”16%”><span class=”b” style=”color:#FF3300”>今日发贴排行</span></td>
</tr>
<tr class=”tr3”>
<td align=”center”>
<script type=”text/javascript”>
<!–
var focus_width=165
var focus_height=140
var swf_width = focus_width
var swf_height = focus_height

  var pics="$pics"
  var links="$links"

  document.write('&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'"&gt;');
  document.write('&lt;param name="allowScriptAccess" value="sameDomain"&gt;&lt;param name="movie" value="{$imgpath}/pixviewer.swf"&gt;&lt;param name="quality" value="high"&gt;&lt;param name="bgcolor" value="#F4FBFF"&gt;');
  document.write('&lt;param name="menu" value="false"&gt;&lt;param name=wmode value="opaque"&gt;');
  document.write('&lt;param name="FlashVars" value="pics='+pics+'&amp;links='+links+'&amp;borderwidth='+focus_width+'&amp;borderheight='+focus_height+'"&gt;');
  document.write('&lt;embed src="{$imgpath}/pixviewer.swf" mce_src="{$imgpath}/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&amp;links='+links+'&amp;borderwidth='+focus_width+'&amp;borderheight='+focus_height+'" menu="false" bgcolor="#F4FBFF" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /&gt;');
  document.write('&lt;/object&gt;');
//--&gt;
&lt;/script&gt;
&lt;/td&gt;
&lt;td class="f_two" style="vertical-align:top;"&gt;$newthreads&lt;/td&gt;
&lt;td style="vertical-align:top;"&gt;$replythreads&lt;/td&gt;
&lt;td class="f_two" style="vertical-align:top;"&gt;$digestthreads&lt;/td&gt;
&lt;td style="vertical-align:top;"&gt;$memberposttoday&lt;/td&gt;

</tr>
</table>
</div>
<!– 主题排行结束 –>

Linux下tar排除指定目录

发表于 2007-11-15 | 分类于 Linux

今天解决了这个问题,备忘一下
假设 test目录下有 1 2 3 4 5 这5个目录
现在要将 3 4 5目录tar打包,1和2目录不要
命令如下

tar -zcvf test.tar.gz –exclude=1 –exclude=2 test

或

tar -zcvf test.tar.gz –exclude=test/1 –exclude=test/2 test

看man tar帮助,–exclude后面跟的好像是正则

注意: 要打包的test必须在命令最后,不然没有效果.刚才郁闷了半天

Cygwin 的一些配置

发表于 2007-11-15 | 分类于 Uncategorized

1. 中文输入 在 .inputrc 加入 set convert-meta off set input-meta on set output-meta on 2. 显示中文文件名 把 ls alias 成 ls –show-control-chars 3. vi 中文支持 在 .vimrc 中加入 set encoding=cp936 4. 终端模式 默认终端模式与很多程序不兼容,如 scsh, emasc 等(前者不能编辑,后者不能退出)。把终端设置为 binmode 可以解决这个问题。 CYGWIN=binmode tty 这个似乎要写到 cygwin.bat 里,若写在 .bashrc 中,运行起来不是很正常(退出 emacs 后光标会消失)。 5. locale 设置 在中文 windows 上, 默认是 zh_CN.gbk,但 /usr/share/locale 下只有 zh_CN 而没有 zh_CN.gbk. zh_CN/LC_MESSAGE 里的 mo 都是 utf-8 的。我自己建了 zh_CN.gbk 的目录,编了若干 gbk 的 mo 放在里头,不过跟 zh_CN 下的比,还是太少。 LC_ALL=zh_CN.gbk LANG=C 6. openssl server ssh-host-config cygrunserv –start sshd 若以后增加了用户,cygwin 不会自动更新用户信息,所以新用户无法自动登录。解决方法为手动更新。 mkpasswd –local >/etc/passwd mkgroup –local >/etc/group 7. X server 若装了 X server,则可以运行依赖 X 的应用程序,如 XEmacs 什么的。新版的 X 是作为一个服务在后台运行的(X Desktop 可以隐藏起来)。可以从 cygwin 的 consol 下启动 X 客户, 但要把 DISPLAY 变量设置一下。一般就是: export DISPLAY=127.0.0.1:0.0 X 服务器运行时,在系统托盘里有一个 X 图标,用右键单击这个图标,可以看到序号(0.0). 8 ftp: ftp/tcp: unknown service 把注册表中 HKLMSYSTEMCurrentControlSetServicesTcpipParameters下的 DataBasePath 类型从 REG_SZ 改回 REG_EXPAND_SZ我还不清楚是哪个软件干的好事,但我已经碰到过多次了。我碰到这个问题的时候,机器上都装有 cygwin 或 uwin. ——————————————————————————– 通过右键菜单启动 bash 很多时候,在 Explorer 中看到某个文件夹,想通过 cygwin 去管理之。但启动一个 bash,再转到这个目录是很麻烦的。最好能右键点击之,运行 bash,而且 bash 自动转到这个目录中。 HKEY_CLASSES_ROOT /Directory/shell 中有一个 find,在 shell 处添加一个与之平行的 CLI,其值设为 Go Unix''. 在 CLI 下建一个项 command,其值为: cmd.exe /k c:cygwinunix.bat %1 unix.bat 的内容为: @c:cygwinbinbash --login -c "cd '%1'; exec bash --rcfile ~/.bashrc" 现在在某个目录上点击右键就会有Go Unix’’ 的选项了。 [注] 这里使用 unix.bat 实在是不得以的。在我的机器上,如果不运行 cmd,而直接使用 bash。虽然也能出来一个窗口,但一运行 ls 机器就会重新启动。 我在完全安装 cygwin (CYGWIN_NT 5.1)的过程中,也重启了好几次,而且是断电然后再接通的感觉。后来只能装个最小集,然后以按需要安装的方式来扩充。网上也有一些安装 cygwin 重启的报告。 ——————————————————————————– 链接: [1] cygwin [2] MinGW [3] GnuW32 [4] U/Win ——————————————————————————– Changes Log: (2006-05-29 15:43) 加入 ftp/tcp: unknow service 条目。 (2006-12-17 ) 加入 “通过右键菜单启动 bash” 条目。 ——————————————————————————–

评分字数过少问题

发表于 2007-10-29 | 分类于 Site

5.3 修改方法:
修改job.php中($atc_content,24)的24改为100或更多
修改read.htm中头部
.tips li{list-style:none;width:30%…….
把30%改为80%或更多

调整评分时「威望,财富==」的默认选项为财富 for PW5.30 /6.0

发表于 2007-10-29 | 分类于 Site

首先。。。打开/job.php *6.0的为PW_ajax.php
查找

$creditselect .= ‘<option value=”‘.$cid.’”>’.${‘db_’.$cid.’name’}.’</option>’;

修改为:
if($cid == ‘money’){$cid = ‘money selected’;${‘db_’.$cid.’name’} = $dbmoneyname;}
$creditselect .= ‘<option value=’.$cid.’>’.${‘db
‘.$cid.’name’}.’</option>’;

1…212223…27
九王爷

九王爷

这里是外宅,备份用的

269 日志
19 分类
41 标签
© 2017 九王爷
由 Hexo 强力驱动
主题 - NexT.Pisces