Thursday, August 30, 2007

When Oracle Going Down

So what? when you at the night found your Oracle was dead. Trying start Oracle but occuring the error messages:

Thu Aug 30 21:43:16 2007
Errors in file /data/oracle/home/admin/pep/bdump/pep_arc0_31074.trc:
ORA-16014: log 1 sequence# 56 not archived, no available destinations
ORA-00312: online log 1 thread 1: '/data/oracle/data/pep/redo01.log'

Thu Aug 30 21:44:16 2007

ARC1: Archiving not possible: No primary destinations
ARC1: Failed to archive thread 1 sequence 56 (4)

Thu Aug 30 21:48:17 2007

Errors in file /data/oracle/home/admin/pep/bdump/pep_arc1_31076.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 2147483648 bytes is 100.00% used, and has 0 remaining bytes available.

Thu Aug 30 21:48:17 2007


************************************************************************

You have following choices to free up space from flash recovery area:

1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
then consider changing RMAN ARCHIVELOG DELETION POLICY.

2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.

3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.

4. Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.

************************************************************************

Thu Aug 30 21:48:17 2007

Errors in file /data/oracle/home/admin/pep/bdump/pep_arc1_31076.trc:
ORA-19809: limit exceeded for recovery files
ORA-19804: cannot reclaim 48500736 bytes disk space from 2147483648 limit

ARC1: Error 19809 Creating archive log file to '/data/oracle/home/flash_recovery_area/PEP/archivelog/2007_08_30/o1_mf_1_56_1_.arc'


ARC1: Failed to archive thread 1 sequence 56 (19809)


ARCH: Archival stopped, error occurred. Will continue retrying


DONT WORRY

You just make Oracle can be startup and then rebuild your configuration by RESIZE your Archive Log file. The steps are :

[oracle@black]# sqlplus /nolog
SQL> conn / as sysdba
SQL> shutdown abort
ORACLE instance shut down.

SQL> startup nomount pfile="/data/oracle/home/admin/pep/pfile/init.ora.618200774625"
ORACLE instance started.

Total System Global Area 1002438656 bytes
Fixed Size 1223080 bytes
Variable Size 247465560 bytes
Database Buffers 746586112 bytes
Redo Buffers 7163904 bytes

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL> select * from tab;

Browse : http://your.oracle.web:1158/em/
Please resize your Archive log file and or the other configuraions.

Thursday, August 23, 2007

Mail Gateway - ClamAV & Spamassassin

Description
This system is already test and can receive mail traffic as mail gateway:

  • 200,000 mails/day for FreeBSD Box, default kernel
  • 125,000 mails/day for Linux Box, default kernel
Services
Service Postfix 2.3.4
ClamAV 0.88.6
Amavisd-New 2.4.4
Spamassassin 3.1.7

Download
http://www.postfix.org/download.html
http://www.clamav.net/
http://www.ijs.si/software/amavisd/
http://www.spamassassin.org/

Dependencies
CPAN – Perl Module
# cpan
cpan> install Archive::Tar Archive::Zip Compress::Zlib Convert::TNEF Convert::UUlib MIME::Base64 MIME::Parser Mail::Internet Net::Server Net::SMTP Digest::MD5 IO::Stringy Time::HiRes Unix::Syslog HTML::Parser
cpan> install MD5 LWP Mail::Internet Archive::Tar Archive::Zip IO::Wrap IO::Stringy Unix::Syslog MIME::Words MIME::Head MIME::Body MIME::Entity MIME::Parser Net::SMTP Net::DNS Net::Ping Net::Server Net::Server::PreForkSimple Convert::TNEF Convert::UUlib MIME::Decoder::Base64 MIME::Decoder::Binary MIME::Decoder::Gzip64 MIME::Decoder::NBit MIME::Decoder::QuotedPrint MIME::Decoder::UU Time::HiRes Digest::SHA1 Digest::Nilsimsa Getopt::Long File::Copy Bit::Vector Date::Calc
cpan> install IO::Socket IO::Socket::INET IO::Socket::UNIX
cpan> install Net::SMTP Net::Cmd Net::SMTP Net::Server Net::Server::PreForkSimple
cpan> install DB_File Unix::Syslog File::Tail Archive::Rar Archive::TarGzip Archive::Any
cpan> install Net::DNS Mail::SPF::Query IP::Country Net::Ident IO::Socket::INET6 IO::Socket::SSL
cpan> install Inline::C Mail::ClamAV Mail::SpamAssassin DBI Net::LDAP Authen::SASL SAVI Convert::UUlib Compress::Zlib

Configure
groupadd postdrop
useradd postfix -s /bin/false
groupadd clamav
useradd clamav -g clamav -s /bin/false
mkdir /home/clamav
mkdir -p /home/clamav/amavis
mkdir -p /home/clamav/virusmails
mkdir -p /home/clamav/db
mkdir -p /home/clamav/var
mkdir -p /home/clamav/tmp
mkdir -p /home/clamav/virusdb
chmod 750 /home/clamav/amavis
chown -R clamav.clamav /home/clamav
touch /var/log/clamd.log
touch /var/log/freshclam.log
touch /var/log/clam-update.log
chown clamav.clamav /var/log/clamd.log
chown clamav.clamav /var/log/freshclam.log
chown clamav.clamav /var/log/clam-update.log



Postfix
# tar –zxvf postfix-2.3.4.tar.gz
# make
# make install


ClamAV
# tar –zxvf clamav-0.88.6.tar.gz
# ./configure --sysconfdir=/usr/local/etc --with-dbdir=/home/clamav/virusdb --libdir=/usr --includedir=/usr
# make
# make check
# make install

Amavisd-New
# tar -zxvf amavisd-new-2.x.x.tar.gz
# cd amavisd-new-2.x.x
# cp amavisd /usr/local/sbin/
# chown root /usr/local/sbin/amavisd
# chmod 755 /usr/local/sbin/amavisd


Spamassassin
# tar –zxvf Mail-SpamAssassin-3.1.7.tar.gz
# ./configure
# make
# make install


Exec Path
/usr/local/sbin/amavisd
/usr/local/bin/freshclam -d -c 10 --datadir=/home/clamav/virusdb
/usr/local/sbin/clamd/usr/sbin/postfix start

Config File

/etc/clamd.conf
---------------
AlgorithmicDetection yes
ArchiveLimitMemoryUsage yes
ArchiveMaxCompressionRatio 300
ArchiveMaxFileSize 15M
ArchiveMaxFiles 1500
ArchiveMaxRecursion 10
DatabaseDirectory /home/clamav/virusdb
LeaveTemporaryFiles yes
LogClean yes
LogFile /var/log/clamd.log
LogFileMaxSize 1000M
LogTime yes
PidFile /home/clamav/var/clamd.pid
ScanArchive yes
ScanHTML yes
ScanMail yes
TCPAddr 127.0.0.1
TCPSocket 3310
TemporaryDirectory /var/tmp
User clamav



/etc/amavisd.conf
-----------------
KEY POINT:
$max_servers = 3; # number of pre-forked children (2..15 is common)
$max_requests = 10;
$child_timeout=5*60;
$daemon_user = 'clamav'; # (no default; customary: vscan or amavis)
$daemon_group = 'clamav'; # (no default; customary: vscan or amavis)
$mydomain = 'mydomain.com'; # a convenient default for other settings
$MYHOME = '/home/clamav'; # a convenient default for other settings
$TEMPBASE = "$MYHOME/tmp"; # working directory, needs to be created manually
$ENV{TMPDIR} = $TEMPBASE; # environment variable TMPDIR
$QUARANTINEDIR = "$MYHOME/virusmails";
# $daemon_chroot_dir = $MYHOME; # chroot directory or undef
$db_home = "$MYHOME/db";
$helpers_home = "$MYHOME/var"; # prefer $MYHOME clean and owned by root?
$pid_file = "$MYHOME/var/amavisd.pid";
$lock_file = "$MYHOME/var/amavisd.lock";
#NOTE: create directories $MYHOME/tmp, $MYHOME/var, $MYHOME/db manually
@local_domains_maps = ( [".$mydomain"] );
@mynetworks = qw( 127.0.0.0/8 ::1 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 );
$log_level = 0; # verbosity 0..5
$log_recip_templ = undef; # disable by-recipient level-0 log entries
$DO_SYSLOG = 1; # log via syslogd (preferred)
$SYSLOG_LEVEL = 'mail.debug';
#$enable_db = 1; # enable use of BerkeleyDB/libdb (SNMP and nanny)
#$enable_global_cache = 1; # enable use of libdb-based cache if $enable_db=1
$inet_socket_port = 10024; # listen on this local TCP port(s) (see $protocol)
$inet_socket_bind = '127.0.0.1';
@inet_acl = qw( 127.0.0.1 );
#$unix_socketname = "$MYHOME/amavisd.sock"; # when using sendmail milter
$sa_tag_level_deflt = -6.0; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.0; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 6.0; # triggers spam evasive actions
$sa_dsn_cutoff_level = 10; # spam level beyond which a DSN is not sent
$sa_mail_body_size_limit = 200*1024; # don't waste time on SA if mail is larger
$sa_local_tests_only = 0; # only tests which do not require internet access?
$sa_auto_whitelist = 1; # turn on AWL in SA 2.63 or older (irrelevant
$sa_spam_subject_tag = '***SPAM*** ';
$defang_virus = 1; # MIME-wrap passed infected mail
$defang_banned = 1; # MIME-wrap passed mail containing banned name
# for defanging bad headers only turn on certain minor contents categories:
$defang_by_ccat{+CC_BADH.",3"} = 1; # NUL or CR character in header
$defang_by_ccat{+CC_BADH.",5"} = 1; # header line longer than 998 characters
$defang_by_ccat{+CC_BADH.",6"} = 1; # header field syntax error
# OTHER MORE COMMON SETTINGS (defaults may suffice):
#$myhostname = 'mydomain.com'; # must be a fully-qualified domain name!
$notify_method = 'smtp:[127.0.0.1]:10025';
$forward_method = 'smtp:[10.1.1.1]:25'; # Destination Mailserver
$final_virus_destiny = D_DISCARD;
$final_banned_destiny = D_BOUNCE;
$final_spam_destiny = D_PASS;
$final_bad_header_destiny = D_PASS;

# ### http://www.clamav.net/
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "127.0.0.1:3310"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],




/etc/freshclam.conf
-------------------
Checks 24
DatabaseDirectory /home/clamav/virusdb
DatabaseMirror database.clamav.net
PidFile /home/clamav/var/freshclam.pid
UpdateLogFile /var/log/freshclam.log



/etc/mail/spamassassin/local.cf
--------------------------------
add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_
auto_learn 1
bayes_path /home/clamav/amavis/.spamassassin/bayes
dns_available yes
report_safe 0
required_hits 6.0
rewrite_subject 1
skip_rbl_checks 1
subject_tag *** Spam ***
use_bayes 1


/etc/postfix/main.cf
--------------------
KEY POINT:
header_checks = regexp:/etc/postfix/header_checks
relay_domains = hash:/etc/postfix/relay_domains
smtpd_client_restrictions = hash:/etc/postfix/access
smtpd_delay_reject=no
smtpd_helo_restrictions = hash:/etc/postfix/access
relay_domains = hash:/etc/postfix/relay_domains
smtpd_recipient_restrictions =
#permit_mynetworks,
#reject_non_fqdn_sender,
#reject_non_fqdn_recipient,
#reject_unknown_sender_domain,
#reject_unknown_recipient_domain,
reject_unauth_destination,
reject_rbl_client list.dsbl.org,
permit


/etc/postfix/master.cf
----------------------
KEY POINT:
smtp inet n - n - - smtpd
-o content_filter=smtp-amavis:[127.0.0.1]:10024

smtp-amavis unix - - n - 3 lmtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes

127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes



/etc/postfix/access
-------------------
194.67.23.20 REJECT -- MAIL BOMBING --
84.58.99.89 REJECT -- MAIL BOMBING --


/etc/postfix/relay_domains
--------------------------
mydomain.com RELAY


/etc/postfix/header_checks
--------------------------
/^(.*)name\=\"(.*)\.(hta|com|pif|vbs|vbe|js|jse|bat|cmd|vxd|scr|shm|hlp|spl|swf)\"$/ DISCARD ---- File attachment yang akan anda kirim ditolak untuk alasan keamanan - Your attachment file(s) rejected for security reason ----


/etc/postfix/body_checks
------------------------
/^(.*)V I R U S A L E R T/ DISCARD virus
/^(.*)VIRUS NOTIFICATION/ DISCARD virus
/^(.*)Virus Warning Message/ DISCARD virus

Data
/usr/spool/postfix/
/home/clamav/virusdb
/home/clamav/virusmails


Startup
/usr/local/sbin/amavisd
/usr/local/bin/freshclam -d -c 10 --datadir=/home/clamav/virusdb
/usr/local/sbin/clamd/usr/sbin/postfix start

Crontab
# crontab –l
####CLAMD####
0 0 * * * /bin/rm -rf /var/tmp/clamav-*
0 0 * * * /bin/rm /home/clamav/virusmails/*
0 0 * * * /bin/rm -r /home/clamav/tmp/amavis-*

Top Command
Bash# postfix start|stop|restart
Bash# tail –f /var/log/maillog
Bash# telnet localhost 10024 | 3310 | 25

Tuesday, August 21, 2007

Create Drupal Module

Drupal I think is the best CMS to develop a custom applications. Drupal's engine gives you more than you expected. The API and library will reduce your time to develop applications and gears up your business. This below is example to building modules on drupal engine.

Drupal modules at least need 3 files :

  • yourmodule.info
    Contains module descriptions
  • yourmodule.install
    Contains module database structure (depend on you need database or not)
  • yourmodule.module
    The core of your program. Functions and algorithm write down here.
For example your PATH for drupal is :
/usr/local/apache/htdocs/drupal

In this case, your module name is 'phonedir', so ...your own modules should be :
/usr/local/apache/htdocs/drupal/sites/all/modules/phonedir
All of your module's files must be prefix 'phonedir'.

Your drupal configuration file must be placed at:
/usr/local/apache/htdocs/drupal/sites/default/settings.php

Please edit settings.php to add MySQL connection to the another database:

Origin:
$db_url = 'mysql://drupal:passwd_drupal_db@localhost/drupal';
$db_prefix = '';

To :

## Drupal's db
$db_url['default'] = 'mysql://drupal:passwd_drupal_db@localhost/drupal';

## phonedir's db
$db_url['phonedir'] = 'mysql://phonedir:kunamjaya@localhost/phonedir';
$db_prefix = '';



--------------------------------------------
Run the shell scripts:
============================
# mkdir -p /usr/local/apache/htdocs/drupal/sites/all/modules/phonedir
# cd /usr/local/apache/htdocs/drupal/sites/all/modules/phonedir
Create files : phonedir.info, phonedir.install, phonedir.module, phonedir.mysql
# touch phonedir.info
# touch phonedir.install
# touch phonedir.module
# touch phonedir.mysql
phonedir.info
; $Id$
name = Phonedir
description = Phone Directory
package = PEP
project = "drupal"
version = "5.x-1.0"

phonedir.install
<?
// $Id: phonedir.install,v MDGTI PEP 2007/08/01 13:44:08 drumm Exp $

##########################################
# Konang Supian #
# konangsupian@gmail.com #
# 02 Agustus 2007 #
##########################################

/*
Jalankan perintah shell sbb:
============================
mysql -u root -p -e "create database phonedir"
mysql -u root -p phonedir < phonedir.mysql
echo "\$db_url['phonedir'] = 'mysql://phonedir:kunamjaya@localhost/phonedir';" >> ../../../default/settings.php

*/
###################################################
/*

Tambahkan baris berikut (silakan disesuaikan dengan login password MySQL) di file :
/path/to/drupal/sites/default/settings.php

$db_url['default'] = 'mysql://drupal:kunamjaya@localhost/drupal';
$db_url['helpdesk'] = 'mysql://helpdesk:kunamjaya@localhost/helpdesk';
$db_url['phonedir'] = 'mysql://phonedir:kunamjaya@localhost/phonedir';

*/

function phonedir_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
//db_query("");
break;
}
}

function phonedir_uninstall() {
db_query('DROP TABLE {belomperlu}');
}





phonedir.mysql



/*
Akses command dibawah ini untuk create database dan grant bila belum ada:
#########################################################################
*/

/*
use mysql;
CREATE DATABASE phonedir;
*/

GRANT USAGE ON phonedir.* TO phonedir@localhost;
GRANT ALL ON phonedir.* to phonedir@localhost identified by 'kunamjaya';
flush privileges;

/*
##########################################################################
*/

USE phonedir;

create table ext (
ext_id int auto_increment,
ext_name varchar(40),
ext_jobdesc varchar(30),
ext_div tinyint(3) unsigned,
ext_ext varchar(5),
ext_fax varchar(15),
ext_phone varchar(15),
ext_floor varchar(10),
ext_mail varchar(30),
ext_company tinyint(3) unsigned,
ext_region tinyint(3) unsigned,
PRIMARY KEY (`ext_id`)
) ENGINE=MyISAM;

create table region (
reg_id int auto_increment,
reg_name varchar(30) not null,
reg_status tinyint(3) unsigned default 1,
PRIMARY KEY (`reg_id`),
UNIQUE KEY `reg_name`(`reg_name`)
)ENGINE=MyISAM;

create table prsh (
prsh_id int auto_increment,
prsh_name varchar(30) not null,
prsh_status tinyint(3) unsigned default 1,
PRIMARY KEY (`prsh_id`),
UNIQUE KEY `prsh_name`(`prsh_name`)
)ENGINE=MyISAM;

create table divs (
divs_id int auto_increment,
divs_name varchar(30) not null,
divs_status tinyint(3) unsigned default 1,
PRIMARY KEY (`divs_id`),
UNIQUE KEY `divs_name`(`divs_name`)
)ENGINE=MyISAM;

create table fl (
fl_id int auto_increment,
fl_name varchar(3) not null,
fl_status tinyint(3) unsigned default 1,
PRIMARY KEY (`fl_id`),
UNIQUE KEY `fl_name`(`fl_name`)
)ENGINE=MyISAM;


/*
Dumping data
*/

INSERT INTO `divs` (`divs_id`, `divs_name`, `divs_status`) VALUES (1, 'Kwarnas', 1);
INSERT INTO `divs` (`divs_id`, `divs_name`, `divs_status`) VALUES (2, 'SC', 1);
INSERT INTO `divs` (`divs_id`, `divs_name`, `divs_status`) VALUES (3, 'Keuangan', 1);
INSERT INTO `divs` (`divs_id`, `divs_name`, `divs_status`) VALUES (4, 'Dir Hulu', 1);
INSERT INTO `divs` (`divs_id`, `divs_name`, `divs_status`) VALUES (5, 'PWP', 1);

INSERT INTO `ext` (`ext_name`, `ext_jobdesc`, `ext_div`, `ext_ext`, `ext_fax`, `ext_mail`, `ext_phone`, `ext_floor`) VALUES ('Security lt G', 'Security lt G', '1', '1332', '', '', '', 'G');
INSERT INTO `ext` (`ext_name`, `ext_jobdesc`, `ext_div`, `ext_ext`, `ext_fax`, `ext_mail`, `ext_phone`, `ext_floor`) VALUES ('Pos Depan', 'Pos Depan', '1', '1964', '', '', '', 'G');
INSERT INTO `ext` (`ext_name`, `ext_jobdesc`, `ext_div`, `ext_ext`, `ext_fax`, `ext_mail`, `ext_phone`, `ext_floor`) VALUES ('Storing Listrik', 'Storing Listrik', '1', '1369', ' ', '', '', 'G');
INSERT INTO `ext` (`ext_name`, `ext_jobdesc`, `ext_div`, `ext_ext`, `ext_fax`, `ext_mail`, `ext_phone`, `ext_floor`) VALUES ('Storing AC', 'Storing AC', '1', '1965', '', '', '', 'G');
INSERT INTO `ext` (`ext_name`, `ext_jobdesc`, `ext_div`, `ext_ext`, `ext_fax`, `ext_mail`, `ext_phone`, `ext_floor`) VALUES ('Rec14ionist lt. G', 'Rec14ionist lt. G', '1', '1444', '', '', '', 'G');


INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (1, 'B3', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (2, 'B2', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (3, 'B1', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (4, 'G', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (5, '1', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (6, '2', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (7, '3', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (8, '4', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (9, '5', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (10, '6', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (11, '7', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (12, '8', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (13, '9', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (14, '10', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (15, '11', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (16, '12', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (17, '13', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (18, '14', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (19, '15', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (20, '16', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (21, '17', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (22, '18', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (23, '19', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (24, '21', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (25, '22', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (26, '23', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (27, '24', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (28, '25', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (29, '26', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (30, '27', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (31, '28', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (32, '29', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (33, '30', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (34, '31', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (35, '32', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (36, '33', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (37, '34', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (38, '35', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (39, '36', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (40, '37', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (41, '38', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (42, '39', 1);
INSERT INTO `fl` (`fl_id`, `fl_name`, `fl_status`) VALUES (43, '40', 1);


INSERT INTO `prsh` (`prsh_id`, `prsh_name`, `prsh_status`) VALUES (1, 'MYCOMPANY', 1);
INSERT INTO `prsh` (`prsh_id`, `prsh_name`, `prsh_status`) VALUES (2, 'MYCOMPANY PERSERO', 1);
INSERT INTO `prsh` (`prsh_id`, `prsh_name`, `prsh_status`) VALUES (3, 'PERTAGAS', 1);
INSERT INTO `prsh` (`prsh_id`, `prsh_name`, `prsh_status`) VALUES (4, 'MYCOMPANY PELUMAS', 1);
INSERT INTO `prsh` (`prsh_id`, `prsh_name`, `prsh_status`) VALUES (5, 'REKANAN', 1);


INSERT INTO `region` (`reg_id`, `reg_name`, `reg_status`) VALUES (1, 'Pusat', 1);
INSERT INTO `region` (`reg_id`, `reg_name`, `reg_status`) VALUES (2, 'Sumatera', 1);
INSERT INTO `region` (`reg_id`, `reg_name`, `reg_status`) VALUES (3, 'Jawa', 1);
INSERT INTO `region` (`reg_id`, `reg_name`, `reg_status`) VALUES (4, 'KTI', 1);
INSERT INTO `region` (`reg_id`, `reg_name`, `reg_status`) VALUES (5, 'MYCOMPANY Pusat', 1);




phonedir.module

<?
##########################################
# Konang Supian #
# konangsupian@gmail.com #
# 02 Agustus 2007 #
##########################################

function phonedir_help($section='') {
$output = '';
switch ($section) {
case "admin/help#phonedir":
$output = '<p>'. t("Test buat module"). '</p>';
break;
}
return $output;
}

/*function phonedir_perm() {
return array('PT MYCOMPANY phonedir permission');
}*/

function phonedir_block($op='list', $delta=0) {
if ($op == "list") {
$block[0]["info"] = t("Phonedir");
return $block;
} else if ($op == 'view') {
$block_content = l('Phone Directory', 'phonedir/show') . '<br />';
if ($block_content == '') {
return;
}
$block['subject'] = 'Phonedir';
$block['content'] = $block_content;
return $block;
}
}

/*function phonedir_admin() {
$form['phonedir_maxdisp'] = array(
'#type' => 'textfield',
'#title' => t('Maximum number of links'),
'#default_value' => variable_get('phonedir_maxdisp', 3),
'#size' => 2,
'#maxlength' => 2,
'#description' => t("The maximum number of links to display in the block.")
);
return system_settings_form($form);
}*/

function phonedir_menu() {
$items = array();
/*$items[] = array(
'path' => 'admin/settings/phonedir',
'title' => t('Phonedir module settings'),
'description' => t('Description of your phonedir settings control'),
'callback' => 'drupal_get_form',
'callback arguments' => 'phonedir_admin',
'access' => user_access('access administration pages'),
'type' => MENU_NORMAL_ITEM,
);*/
############ PARENT #########
$items[] = array(
'path' => 'phonedir',
'title' => t('Phone Directory'),
'callback' => 'phonedir_load_search',
'access' => user_access('access phonedir content'),
'type' => MENU_NORMAL_ITEM,
);
########### CHILD ##########
$items[] = array(
'path' => 'phonedir/new',
'title' => t('New Entry'),
'callback' => 'phonedir_load_insert',
'access' => user_access('access phonedir content'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'phonedir/list',
'title' => t('Search'),
'callback' => 'phonedir_load_search',
'access' => user_access('access phonedir content'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'phonedir/show',
'title' => t('Pencarian'),
'callback' => 'phonedir_load_search',
'access' => user_access('content'),
'type' => MENU_HIDDEN,
);
$items[] = array(
'path' => 'phonedir/profile',
'title' => t('Profile'),
'callback' => 'phonedir_load_profile',
'access' => user_access('content'),
'type' => MENU_HIDDEN,
);

return $items;
}



############ GLOBAL FUNCTIONS ##############

function phonedir_sql_array($query,$key,$key_index=null) {
db_set_active('phonedir');
$queryResult = db_query($query);
while ($links = db_fetch_object($queryResult)) {
if ($key_index!=null) {
$myarray[$links->$key_index] = $links -> $key;
} else {
$myarray[] = $links -> $key;
}
}
db_set_active('default');
return $myarray;
}

function phonedir_printfield($table,$field,$field_,$syarat) {
db_set_active('phonedir');
$query_ = "select ".$field." from ".$table." where ".$field_."='".$syarat."'";
$admin_ = mysql_query($query_);
$row_ = mysql_fetch_array($admin_);
if (!$admin_) {
echo mysql_error();
}
db_set_active('default');
return $row_[0];
}

function phonedir_list_data($caption,$table,$field,$syarat,$start,$script,$isnew,$href,$target,$q) {
$content = '';
if ($start > 0) { $anyar = $isnew;}
$show_per_page = 30;
$list_page = 11;
if ($start < $show_per_page) $start = 0;
if ($syarat != "") {
$mynewquery = "select ".$field." from ".$table." ".$syarat." limit $start,$show_per_page";
$mynewquery1 = "select count(*) from ".$table." ".$syarat;
} else {
$mynewquery = "select ".$field." from ".$table." limit $start,$show_per_page";
$mynewquery1 = "select count(*) from ".$table;
}
$result = mysql_query($mynewquery);

#print $mynewquery;

if (!$result) {
print mysql_error();
}
$hasil = mysql_query($mynewquery1);
$hasil = mysql_fetch_row($hasil);
$hasil = $hasil[0];

$content .= '
<table id="tbl-phonedir" width="100%" border="1" cellspacing="1" cellpadding="2">
<tr class="thead"><td colspan="'.mysql_num_fields($result).'">
&nbsp;<b>'.$caption.'</b> <i>('.$hasil.')</i>
</td>
</tr>
<tr class="tcol">';
for ($i = 0; $i< mysql_num_fields($result); $i++) {
$head = mysql_field_name( $result,$i);
$content .= "<td><b>$head</b></td>";
}
$content .= "</tr>";
$myrow = 1;
for ($i=0; $i < $show_per_page; $i++) {
if ($result <> 0 ) { $row_array = mysql_fetch_row($result);}
if ($row_array=="") { break; }
if ($i % 2 == 0) {
$warna = "teven";
} else {
$warna = "todd";
}
$content .= "\r\n<tr class=\"$warna\">\r\n";
for ($j=0; $j<mysql_num_fields($result); $j++) {
if (eregi("accessed",mysql_field_name($result,$j))) {
$row_array[$j] = tanggalan($row_array[$j]);
}
if ($j==0) {
$content .= "<td align=\"center\">";
$content .= ($myrow+$start);
} else {
$content .= "<td align=\"left\">";
if ($href==$j) {
$content .= '<a href="'.$target.'&id='.$row_array[$q].'">'.$row_array[$j].'</a>';
} else {
if (!eregi("STATUS",mysql_field_name($result,$j))) {
$tulis = eregi_replace("\n","<br>",$row_array[$j]);
$content .= $tulis;
}
}
}
$content .= "</td>";
}
$myrow++;
$content .= "</tr>";
}
$content .= phonedir_idx_page($hasil, $show_per_page, $list_page, $start, $script, $anyar, mysql_num_fields($result) , "#dddddd");
$content .= "
</table>";

return $content;
}


function phonedir_idx_page($hasil, $show_per_page, $list_page, $start, $url, $isnew, $colspan, $warna) {
$content = '';
$content .= '
<tr class="tfoot"><td colspan="'.$colspan.'">
';

if ($hasil > 0) {
$counter = 1;
$tmp_start = $start;
$start = 0;
$first = 0;
$last = floor($hasil/$show_per_page)*$show_per_page;
$next = $tmp_start+$show_per_page;
$pembagi = ($next-($show_per_page * ($list_page-1) ));
$pembagi = floor($pembagi / $show_per_page);
if ($pembagi>0) {
$prev=$next-(2*$show_per_page);
$content .= "<a href='$url&start=$first'>&laquo; first</a> <a href='$url&start=$prev'>prev</a> ";
}
if ($hasil <> 0 ) { $content .= "";}
for ($i=0; $i < $hasil; $i++) {
if (($i % $show_per_page) == 0) {
if (($counter % $list_page)==0) {
if ($next>$last) {$next=$last;}
$content .= " <a href='$url&start=$next'>next</a>";
$content .= " <a href='$url&start=$last'>last &raquo;</a>";
break;
}
if ($isnew=="") {
if ($counter>1) {
if ($pembagi>0) {
$list=$counter+$pembagi;
$urllist=($list-1)*$show_per_page;
$content .= "&nbsp;<a href='$url&start=$urllist'>$list</a>&nbsp;";

} else {
$content .= "&nbsp;<a href='$url&start=$start'>$counter</a>&nbsp;";
}
} else {
if ($pembagi>0) {
$list=$counter+$pembagi;
$content .= $list . "&nbsp;";
} else {
$content .= $counter . "&nbsp;";
}
}

} else {
if ($i == $tmp_start ) {
if ($pembagi>0) {
$list=$counter+$pembagi;
$content .= $list . "&nbsp;";
} else {
$content .= $counter . "&nbsp;";
}
} else {
if ($pembagi>0) {
$list=$counter+$pembagi;
$urllist=($list-1)*$show_per_page;
$content .= "&nbsp;<a href='$url&start=$urllist'>$list</a>&nbsp;";
} else {
$content .= "&nbsp;<a href='$url&start=$start'>$counter</a>&nbsp;";
}
}
}
$start= $start + $show_per_page;
$counter = $counter + 1;
}
}
}
$content .= '
</td>
';
return $content;
}


############### INSERT DATA ################

function phonedir_insert_form() {
$divisi_ = phonedir_sql_array('select * from divs','divs_name','divs_id');
$pt_ = phonedir_sql_array('select * from prsh','prsh_name','prsh_id');
$region_ = phonedir_sql_array('select * from region','reg_name','reg_id');
$lantai_ = phonedir_sql_array('select * from fl','fl_name','fl_name');

//$options = array('1' => t('Enabled'), '0' => t('Disabled'));
$form['user'] = array(
'#type' => 'fieldset',
'#title' => t('Data Ekstensi Telepon'),
'#tree' => TRUE,
);
$form['user']['name'] = array(
'#type' => 'textfield',
'#title' => t('Nama Karyawan'),
'#size' => 30,
'#maxlength' => 64,
);
$form['user']['ext'] = array(
'#type' => 'textfield',
'#title' => t('Ext'),
'#size' => 5,
'#maxlength' => 5,
);
$form['user']['jobdesc'] = array(
'#type' => 'textfield',
'#title' => t('Jabatan'),
'#size' => 30,
'#maxlength' => 30,
);
$form['user']['mail'] = array(
'#type' => 'textfield',
'#title' => t('Email'),
'#size' => 30,
'#maxlength' => 30,
);
$form['user']['fax'] = array(
'#type' => 'textfield',
'#title' => t('Fax'),
'#size' => 15,
'#maxlength' => 15,
);
$form['user']['phone'] = array(
'#type' => 'textfield',
'#title' => t('Telepon'),
'#size' => 15,
'#maxlength' => 15,
);
$form['user']['floor'] = array(
'#type' => 'select',
'#title' => t('Lantai'),
'#options' => $lantai_,
);
$form['user']['div'] = array(
'#type' => 'select',
'#title' => t('Divisi'),
'#options' => $divisi_,
);
$form['user']['company'] = array(
'#type' => 'select',
'#title' => t('Nama Perusahaan'),
'#options' => $pt_,
);
$form['user']['region'] = array(
'#type' => 'select',
'#title' => t('Region'),
'#options' => $region_,
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
return $form;
}

function phonedir_load_insert() {
return drupal_get_form('phonedir_insert_form');
}

function phonedir_insert_form_validate($form_id, $form_values) {
if ($form_values['user']['name'] == '') {
form_set_error('', t('Nama karyawan tidak boleh kosong!'));
}
if ($form_values['user']['ext'] == '') {
form_set_error('', t('Ekstension telpon tidak boleh kosong!'));
}
}

function phonedir_insert_form_submit($form_id, $form_values) {
db_set_active('phonedir');
$result = db_query("INSERT INTO ext (ext_name,ext_jobdesc,ext_div,ext_ext,ext_fax,ext_floor,ext_mail,ext_company,ext_region)
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')",
$form_values['user']['name'], $form_values['user']['jobdesc'], $form_values['user']['div'],$form_values['user']['ext'],$form_values['user']['fax'],$form_values['user']['floor'],$form_values['user']['mail'],$form_values['user']['company'],$form_values['user']['region']);
if (!$result) {
drupal_set_message(t('Bermasalah dalam memasukkan data : DUPLIKASI'));
} else {
drupal_set_message(t('Data ekstension telepon karyawan telah berhasil disimpan.'));
}
db_set_active('default');
}


############# SEARCH ##############

function phonedir_search_form() {
$divs__ = array("0"=>'ALL');
$divs___ = phonedir_sql_array('select * from divs','divs_name','divs_id');
$divs_ = array_merge($divs__,$divs___); ## pulldown content
$search = $_GET['search'];
$divs = $_GET['divs']; ## current divs from GET
if (!$qq) $qq = $_GET['qq'];
if (!$start) $start = $_GET['start'];

if ($divs) {
$caption_divs = strtoupper(phonedir_printfield("divs","divs_name","divs_id",$divs));
}

$form['user'] = array(
'#type' => 'fieldset',
'#title' => t('Cari Ekstensi Telepon'),
'#tree' => TRUE,
);
$form['user']['qq'] = array(
'#type' => 'textfield',
'#title' => t('Nama Karyawan'),
'#default_value' => $qq,
'#size' => 30,
'#maxlength' => 64,
'#description' => 'Boleh nama depan, nama tengah atau belakang.',
);
$form['user']['fungsi'] = array(
'#type' => 'select',
'#title' => t('Nama Fungsi'),
'#options' => $divs_,
);

$form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
$form['#redirect']=FALSE;

$form['spacer'] = array(
'#type' => 'item',
'#size' => 0,
'#maxlength' => 0,
'#value' => t('')
);

$form ['hasil'] = array(
'#type' => 'fieldset',
'#title' => 'Hasil Pencarian1',
'#tree' => TRUE,
);

if ($divs) {
$add_query = ' and ext_div='.$divs;
}

if ($qq && $start>=0) {
db_set_active('phonedir');
$content = phonedir_list_data("EKSTENSI TELEPON ".$caption_divs,"ext",
"ext_id as NO,ext_name as NAMA,ext_ext as EXT,ext_floor as LT,divs_name as FUNGSI, ext_jobdesc as JABATAN, ext_phone as TLP", "left join divs on (ext_div=divs_id) left join region on (ext_region=reg_id) left join prsh on (ext_company=prsh_id) where ext_name like '%".$qq."%'".$add_query,
$start,"?q=phonedir/show&qq=".$qq."&divs=".$divs,$start,1,"profile",0);
db_set_active('default');
} elseif (!$qq && $start>0) {
db_set_active('phonedir');
$content = phonedir_list_data("EKSTENSI TELEPON ".$caption_divs,"ext",
"ext_id as NO,ext_name as NAMA,ext_ext as EXT,ext_floor as LT,divs_name as FUNGSI,ext_jobdesc as JABATAN, ext_phone as TLP", "left join divs on (ext_div=divs_id) left join region on (ext_region=reg_id) left join prsh on (ext_company=prsh_id) where ext_name like '%".$qq."%'".$add_query,
$start,"?q=phonedir/show&qq=".$qq."&divs=".$divs,$start,1,"profile",0);
db_set_active('default');
} elseif (!$qq && $start=='0') {
if ($search) {
db_set_active('phonedir');
$content = phonedir_list_data("EKSTENSI TELEPON ".$caption_divs,"ext",
"ext_id as NO,ext_name as NAMA,ext_ext as EXT,ext_floor as LT,divs_name as FUNGSI,ext_jobdesc as JABATAN, ext_phone as TLP", "left join divs on (ext_div=divs_id) left join region on (ext_region=reg_id) left join prsh on (ext_company=prsh_id) where 1".$add_query,
$start,"?q=phonedir/show&qq=".$qq."&divs=".$divs,$start,1,"profile",0);
db_set_active('default');
} elseif (!$search) {
header("Location: ?q=phonedir/show&qq=$qq&divs=$divs&start=0&search=Search");
}
}

$form ['hasil']['test'] = array(
'#type' => 'item',
'#size' => 0,
'#maxlength' => 0,
'#description' => $content,
);

return $form;
}

function phonedir_load_search() {
return drupal_get_form('phonedir_search_form');
}

function phonedir_search_form_submit($form_id, $form_values) {
db_set_active('phonedir');
$qq = eregi_replace("'","`",$form_values['user']['qq']);
$divs = $form_values['user']['fungsi'];
$search = $form_values['submit'];
header("Location: ?q=phonedir/show&qq=$qq&divs=$divs&start=0&search=$search");
db_set_active('default');
}



############## Profile ###############

function phonedir_profile_form() {
$divs__ = array("0"=>'ALL');
$divs___ = phonedir_sql_array('select * from divs','divs_name','divs_id');
$divs_ = array_merge($divs__,$divs___); ## pulldown content
$search = $_GET['search'];
$divs = $_GET['divs'];
$id = $_GET['id']; # profile's id
if (!$id) $id = $_GET['id'];

db_set_active('phonedir');
$query = "select ext_id as NO,ext_name as NAMA,ext_ext as EXT,ext_floor as LT,divs_name as FUNGSI,ext_jobdesc as JABATAN, ext_phone as TLP, prsh_name as PRSH, reg_name as REGION from ext left join divs on (ext_div=divs_id) left join region on (ext_region=reg_id) left join prsh on (ext_company=prsh_id) where ext_id=".$id;
$result = mysql_query($query);
if ($result)
$row_array = mysql_fetch_array($result);
db_set_active('default');

if ($divs) {
$caption_divs = strtoupper(phonedir_printfield("divs","divs_name","divs_id",$divs));
}

$form['pro'] = array(
'#type' => 'fieldset',
'#title' => t('Cari Ekstensi Telepon'),
'#tree' => TRUE,
);
$form['pro']['qq'] = array(
'#type' => 'textfield',
'#title' => t('Nama Karyawan'),
'#default_value' => $row_array["NAMA"],
'#size' => 30,
'#maxlength' => 64,
'#description' => 'Boleh nama depan, nama tengah atau belakang.',
);
$form['pro']['fungsi'] = array(
'#type' => 'select',
'#title' => t('Nama Fungsi'),
'#options' => $divs_,
);

$form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
$form['#redirect']=FALSE;

$form['spacer'] = array(
'#type' => 'item',
'#size' => 0,
'#maxlength' => 0,
'#value' => t('')
);

$form ['mypro'] = array(
'#type' => 'fieldset',
'#title' => 'Lihat Profile',
'#tree' => TRUE,
);

$content = "<h3><font color='#444444'><label for='edit-pro-qq'>";
$content .= $row_array["NAMA"] . "<br />";
$content .= $row_array["JABATAN"] . "<br />";
$content .= $row_array["FUNGSI"] . "<br />";
$content .= $row_array["PRSH"] . " " . $row_array["REGION"];
$content .= "Ext : " . $row_array["EXT"] . "<br />";
$content .= "Lantai : " . $row_array["LT"] . "<br />";
$content .= "Telepon : " . $row_array["TLP"] . "<br />";
$content .= "</label></font></h3>";

$form ['mypro']['view'] = array(
'#type' => 'item',
'#size' => 0,
'#maxlength' => 0,
'#description' => $content,
);

return $form;
}

function phonedir_load_profile() {
return drupal_get_form('phonedir_profile_form');
}

function phonedir_profile_form_submit($form_id, $form_values) {
db_set_active('phonedir');
$qq = eregi_replace("'","`",$form_values['pro']['qq']);
$divs = $form_values['pro']['fungsi'];
$search = $form_values['submit'];
header("Location: ?q=phonedir/show&qq=$qq&divs=$divs&start=0&search=$search");
db_set_active('default');
}

db_set_active('default');
?>



Gammu SMS Gateway

Source:
Please download : http://www.gammu.org/

Dependencies
Driver USB "usbserial pl2303"

Please check /var/log/messages when your modem plugged:
May 2 07:43:08 localhost kernel: usb 4-2: new full speed USB device using
uhci_hcd and address 3
May 2 07:43:08 localhost kernel: usb 4-2: configuration #1 chosen from 1
choice
May 2 07:43:08 localhost kernel: pl2303 4-2:1.0: pl2303 converter detected
May 2 07:43:08 localhost kernel: usb 4-2: pl2303 converter now attached
to ttyUSB0

If you see your LOG contain text above so the driver pl2303 has been load and ready to use.
If something problem and you can't find anything in your LOG please try :


# /sbin/modprobe -l grep serial
# /sbin/lspci grep USB
# /sbin/lsmod grep usb


Configure GAMMU
# tar -zxvf gammu-1.10.3.tar.gz
# make
# make install

Please read README first for details information. Please create MySQL account, create GRANT and load gammu mysql structure to gammu's mysql user.


Startup file for GAMMU

startgammu.sh
#!/bin/sh
export LANG=en_US.UTF-8
killall -9 gammu
/usr/local/bin/gammu --smsd MYSQL /etc/smsdrc &
echo 'Gammu SMS GTW Starting ...' /usr/local/bin/gammu --sendsmsdsms TEXT
081112223333 MYSQL /etc/smsdrc

Exec Path:
/usr/local/bin/gammu

Config File:
# /etc/gammurc
[gammu]
port = /dev/ttyUSB0
connection = at115200
logfile = /var/log/gammulog
logformat = textall
startinfo = yes
gammucoding = utf8

# /etc/smsdrc
[smsd]
PIN = 1234
logfile = /var/log/smsdlog
commtimeout = 1
sendtimeout = 10
deliveryreport = log
phoneid = PEP-SMS-GTW
# MYSQL
user = smsd
password = kunamjaya
pc = localhost
database = smsd

Startup:
/usr/local/bin/startgammu.sh

Links:
http://linux2.arinet.org/index.php?option=com_content&task=view&id=121&Itemid=2
http://aswandi.or.id/2006/09/28/sms-gateway-di-windows/#comments
http://wammu.eu/



send.php

<?
### konangsupian@gmail.com ###
### 01 Mei 2007 ###

$conn = mysql_connect("10.10.123.252","gammu","kunamjaya");
if (!$conn) {
echo mysql_error();
}
mysql_select_db("gammu");

function hexsms($kata) {
$tmp = "";
for ($i=0; $i<strlen($kata);$i++) {
$tmp_ = bin2hex($kata[$i]);
$tmp .= str_pad($tmp_, 4, "00", STR_PAD_LEFT);
}
return strtoupper($tmp);
}

function aman($myvar) {
return eregi_replace("'","`",$myvar);
}

$waktu = date("Y-m-d G:i:s");
#$Text=hexsms(aman($_POST["sms"]));
$DestinationNumber=aman($_POST["to"]);
$Coding="Default_No_Compression";
$UDH="";
$Class="-1";
$TextDecoded=aman($_POST["sms"]);
$MultiPart="false";
$RelativeValidity="255";
$SenderID="";
$SendingTimeOut="0000-00-00 00:00:00";
$DeliveryReport="default";
$CreatorID="Gammu 1.10.3";

$result = mysql_query("insert into outbox (UpdatedInDB,InsertIntoDB,SendingDateTime,Text,DestinationNumber,Coding,UDH,Class,TextDecoded,MultiPart,RelativeValidity,SenderID,
SendingTimeOut,DeliveryReport,CreatorID)
values
('now()','now()','now()','$Text','$DestinationNumber','$Coding','$UDH','$Class','$TextDecoded','$MultiPart','$RelativeValidity','$SenderID','$SendingTimeOut','$Deli
veryReport','$CreatorID')");

if (!$result) {
print mysql_error();
}

header('Location: index.html');

?>


index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MYCOMPANY - SMS Gateway Interface</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT language="JavaScript">

function rand()
{
randomku = Math.random(1234567890);
strku = String(randomku);
strku = strku.replace('0.0','');
strku = strku.replace('0.','');
return document.form1.code.value = strku;
}

</SCRIPT>
</head>

<body onLoad="JavaScript:rand()">
<br>
<br>
<form action="http://localhost/sms/send.php" method="post" name="form1">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#000000"><table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr bgcolor="#FF9933">
<td colspan="2" align="left"><font size="2" face="Arial, Helvetica, sans-serif"><strong>::: MYCOMPANY - SMS GTW
</strong></font></td>
</tr>
<tr align="left" valign="middle" bgcolor="#FFFFFF">
<td width="80" nowrap><strong><font size="2" face="Arial, Helvetica, sans-serif">To</font></strong></td>
<td width="100%"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="to" type="text" value="0812">
</font></td>
</tr>

<tr align="left" valign="middle" bgcolor="#FFFFFF">
<td width="80" nowrap><strong><font size="2" face="Arial, Helvetica, sans-serif">ID</font></strong></td>
<td width="100%"> <font size="2" face="Arial, Helvetica, sans-serif">
<input name="idserver" type="text" value="PEP-SMS-GTW" readonly style="border=0;">
</font></td>
</tr>
<tr align="left" valign="middle" bgcolor="#FFFFFF">
<td width="80" nowrap><strong><font size="2" face="Arial, Helvetica, sans-serif">Code</font></strong></td>
<td width="100%"><font size="2" face="Arial, Helvetica, sans-serif">
<input type="text" name="code" readonly style="border=0;">
</font></td>
</tr>
<tr align="left" valign="middle" bgcolor="#FFFFFF">
<td width="80" nowrap><font size="2" face="Arial, Helvetica, sans-serif"><strong>Length</strong></font></td>
<td width="100%"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="len" type="text" size="3" maxlength="3" readonly style="border=0; font-family:; color=#ff0000;">
</font></td>
</tr>
<tr valign="top" bgcolor="#FFFFFF">
<td width="80" nowrap><strong><font size="2" face="Arial, Helvetica, sans-serif">SMS</font></strong></td>
<td width="100%"><font size="2" face="Arial, Helvetica, sans-serif">
<textarea name="sms" cols="40" rows="5" id="sms" onKeyUp="form1.len.value=this.value.length"></textarea>
</font></td>
</tr>
<tr bgcolor="#dddddd">
<td width="80" nowrap><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
<td width="100%"><font size="2" face="Arial, Helvetica, sans-serif">
<input type="submit" name="Submit" value="Submit">
</font></td>
</tr>

</table></td>
</tr>
</table>
</form>
</body>
</html>


Qmail Footer : HTML & Attachment Support

Qmail version : 1.03

Please download QMAIL Source from
http://www.qmail.org/
http://cr.yp.to/qmail.html
http://www.qmailrocks.com/
http://www.tnpi.biz/internet/mail/toaster/

FOOTER:
http://untroubled.org/bglibs/
http://www.pldaniels.com/altermime/
http://untroubled.org/qmail-qfilter/

Configure BGLIBS – For qmail-qfilter
http://untroubled.org/bglibs/docs/modules.html

# tar –zxvf bglibs-1.102.tar.gz
# cd bglibs-1.102
# make
# make install


Don't forget to copy share library libbg-sysdeps.so.1 to /usr/lib, this one need by qmail-qfilter.

ALTERMIME – Program to add mail footer
# tar –zxvf altermime-0.3.7.tar.gz
# cd altermime-0.3.7


Hack source program mime_alter.c (remove char "=")

Origin:

if (dd->disclaimer_text_HTML == NULL) {

fprintf(newf,"=\r\n");
AM_ntorn(qp_data, newf);
fprintf(newf,"=\r\n");
} else {
fprintf(newf,"=\r\n");
AM_ntorn(qp_data, newf);
fprintf(newf,"=\r\n");
}


To:

if (dd->disclaimer_text_HTML == NULL) {

fprintf(newf,"\r\n");
AM_ntorn(qp_data, newf);
fprintf(newf,"\r\n");
} else {
fprintf(newf,"\r\n");
AM_ntorn(qp_data, newf);
fprintf(newf,"\r\n");
}

Hack source qpe.c (remove char "=" and length of str)

Origin:

if (current_line_length +charout_size >= 76) {
snprintf(op, out_remaining, "%s=\r\n", paragraph);
op+= strlen(paragraph) +3; /** jump the output + =\r\n **/
out_remaining-= (strlen(paragraph) +3);


To:

if (current_line_length +charout_size >= 76) {
snprintf(op, out_remaining, "%s\r\n", paragraph);
op+= strlen(paragraph); /** jump the output + =\r\n **/
out_remaining-= (strlen(paragraph));

# make
# make install

QMAIL-QFILTER – Filtering mail and then forward to qmail-queue
# tar –zxvf qmail-qfilter-2.1.tar.gz

Edit file qmail-qfilter.c, Cumtom as you need:

#define TMPDIR "/var/tmp/qmail-qfilter"
#define QMAIL_QUEUE "/var/qmail/bin/qmail-queue"

# make
# make install

# mkdir –p /var/tmp/qmail-qfilter
# chmod 777 /var/tmp/qmail-qfilter
# mkdir –p /var/qmail/control/disclaimer
# touch /var/qmail/control/disclaimer/mydomain.com.txt
# touch /var/qmail/control/disclaimer/mydomain.com.html

Type your disclaimer or footer :

Example:

-------------------------------------
NOTE: The information contained in this e-mail is intended only for the use of the individual or entity named above and may contain information that is privi
leged, confidential and exempt from disclosure under applicable law. If you are not the intended party to receive the message and its attachment(s), you are
hereby notified that any dissemination, distribution or copy of the message is strictly prohibited. Please immediately notify the sender and delete the messa
ge as soon as possible. Thank you for kind attention.


Create file:
# touch /var/qmail/bin/qmail-disclaimer

Copy the text below and paste to /var/qmail/bin/qmail-disclaimer :

#!/bin/sh
QMAILHOST=mydomain.com
INSPECT_DIR=/var/tmp/qmail-qfilter
if [ ! -f /var/qmail/control/disclaimer/$QMAILHOST.txt ]
then
cat
exit 0
fi
EX_TEMPFAIL=31
EX_UNAVAILABLE=31
trap "rm -f /var/tmp/qmail-qfilter/in.$$" 0 1 2 3 15
cd $INSPECT_DIR { echo Error: $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
cat >$INSPECT_DIR/in.$$ { echo $QMAILHOST - Error: Cannot write to disk; exit $EX_TEMPFAIL; }
/usr/local/bin/altermime --input=$INSPECT_DIR/in.$$ \
--htmltoo \
--disclaimer=/var/qmail/control/disclaimer/$QMAILHOST.txt \
--disclaimer-html=/var/qmail/control/disclaimer/$QMAILHOST.html { echo Error: message rejected; exit $EX_UNAVAILABLE; }
cat $INSPECT_DIR/in.$$
rm in.$$
exit $?

Create file:
# touch /var/qmail/bin/qmail-tail

Copy the text below and paste to /var/qmail/bin/qmail-tail:

#!/bin/sh
exec /usr/bin/qmail-qfilter /var/qmail/bin/qmail-disclaimer /var/qmail/bin/qmail-inject -n

Edit file /etc/smtpd:

127.:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
10.80.120.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
10.80.121.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail "
10.80.122.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
#10.80.123.:allow,RELAYCLIENT="",RBLSMTPD=""
10.80.123.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
10.11.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
10.3.4.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
192.168..:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-tail"
#:allow
:allow,HELODNSCHECK="",MFDNSCHECK=""


# /var/qmail/bin/qmailctl cdb
# /var/qmail/bin/qmailctl restart

Exec Path :

/usr/bin/qmail-qfilter
/usr/local/bin/altermime
/usr/local/bglibs/lib

Config file can be found at source tree before compilation.
Links :
http://forum.qmailrocks.org/showthread.php?t=2412


Oracle Instant Client for PHP & Linux

Service
instantclient-basic-linux32-10.2.0.2-20060331
instantclient-sdk-linux32-10.2.0.2-20060331


Download
http://www.oracle.com/technology/software/tech/oci/instantclient/index.htm
http://www.oracle.com/technology/software/htdocs/client_lic.html?url=http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.h

http://download.oracle.com/otn/linux/instantclient/10202/instantclient-basic-linux32-10.2.0.2-20060331.zip
http://download.oracle.com/otn/linux/instantclient/10202/instantclient-sdk-linux32-10.2.0.2-20060331.zip


Links
http://us3.php.net/oci8


Configure Oracle Client
Install Oracle instant client

# mkdir -p /usr/lib/oracle/10.2.0.2/client
# unzip -jd /usr/lib/oracle/10.2.0.2/client \
instantclient-basic-linux-x86-32-10.2.0.2-20060331.zip
# mkdir -p /usr/include/oracle/10.2.0.2/client
# unzip -jd /usr/include/oracle/10.2.0.2/client \
instantclient-sdk-linux-x86-32-10.2.0.2-20060331.zip
# ln -s /usr/lib/oracle/10.2.0.2/client/libclntsh.so.10.1 \
/usr/lib/oracle/10.2.0.2/client/libclntsh.so
# cp /usr/include/oracle/10.2.0.2/client/* /usr/lib/oracle/10.2.0.2/client/


Configure Apache
# ./configure --prefix=/usr/local/apache \
--enable-shared=max --enable-module=vhost_alias
Alternate compile to another directory
## ./configure --prefix=/usr/local/apache4 \
--enable-shared=max --enable-module=so \
--enable-module=vhost_alias
## Reconfigure PHP 4.x.x
# ./configure --with-mysql \
--with-ldap \
--with-gettext \
--with-apxs=/usr/sbin/apxs \
--with-oci8-instant-client=/usr/lib/orale/10.2.0.2/client
## Reconfigure PHP 5.x.x
# ./configure --with-mysql=/usr --with-ldap \
--with-gettext --enable-versioning \
--enable-memory-limit --enable-zend-multibyte \
--enable-zip --enable-track-vars \
--with-apxs=/usr/local/apache/bin/apxs \
--with-calendar \
--with-oci8=instantclient,/usr/lib/oracle/10.2.0.2/client
# export LD_LIBRARY_PATH=\
/usr/lib/oracle/10.2.0.2/client:$LD_LIBRARY_PATH
# make
# make install


Please restart apache and test connection with source code below :

### Test your PHP Oracle connection ####

### oci.php ###

<?

define("_USER","ora");

define("_PASSWD","ora");

define("_DB","10.8.8.8/ORA");

$conn = OCILogon(_USER,_PASSWD,_DB) or die(OCIError());


if ($conn){

print "Terkoneksi ke database ". _DB . " sebagai user "
. _USER."<BR>";

echo "CONN=".$conn."<br>";

} else {

exit;

}


$cmdstr = "select * from TB_VENDOR";

$parsed = ociparse($conn, $cmdstr);

ociexecute($parsed);

$nrows = ocifetchstatement($parsed, $results);


echo "<html><head><title>Oracle PHP Test</title></head><body>";

echo "<center><h2>Oracle PHP Test for <i><u>Obsolete</u></i>
Command</h2></center>";

echo "<center><h2>Connecting & Accessing Oracle Database</h2><br>";

echo "<table border=1 cellspacing='0' width='50%'>\n<tr>\n";

echo "<td><b>NAMA PT</b></td>\n<td><b>ALAMAT</b></td>\n</tr>\n";


for ($i = 0; $i < $nrows; $i++ )

{

echo "<tr>\n";

echo "<td>" . $results["NM_VENDOR"][$i] . "</td>";

echo "<td> " . $results["ALAMAT"][$i] . "</td>";

echo "</tr>\n";

}


echo "<tr><td colspan='2'> Number of Rows:
$nrows</td></tr></table>";

echo "<br><em>If you see data, then it works!</em><br></center></body></html>\n";


print "<hr>";

echo "<center><h2>Oracle PHP Test for <i><u>Newest</u></i>
Command</h2></center>";

echo "<center><h2>Connecting & Accessing Oracle Database</h2><br>";


$conn = OCILogon(_USER,_PASSWD,_DB) or die(OCIError());

if (!$conn) {

$e = oci_error();

print htmlentities($e['message']);

exit;

}


$query = 'SELECT * FROM TB_SOLUSI';


$stid = oci_parse($conn, $query);

if (!$stid) {

$e = oci_error($conn);

print htmlentities($e['message']);

exit;

}


$r = oci_execute($stid, OCI_DEFAULT);

if (!$r) {

$e = oci_error($stid);

echo htmlentities($e['message']);

exit;

}


print '<table border="1">';

while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {

print '<tr>';

foreach ($row as $item) {

print '<td>'.($item?htmlentities($item):' ').'</td>';

}

print '</tr>';

}

print '</table>';

echo "<center><br><em>If you see data, then it works!</em><br></center>";

oci_close($conn);



?>

Proftpd MySQL Authentication

Description
Building FTP server based on ProFTPD and support by MySQL authentication.
User separate by 2 groups, user full access and user readonly.


Download

ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0a.tar.gz
http://dev.mysql.com/downloads/


Configure [Configure ProFTPD]

# ./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
--with-includes=/usr/include/mysql/ --with-libraries=/usr/lib/mysql/
# make
# make install

[Login To MySQL]
# mysql -u root -p
mysql> create database ftp;
mysql> use mysql;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON ftp.* TO 'proftp'@'localhost'
IDENTIFIED BY 'kunam';

mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON ftp.* TO 'proftp'@'localhost.localdomain'
IDENTIFIED BY 'kunam';

mysql> FLUSH PRIVILEGES;
mysql> USE ftp;


CREATE TABLE ftpgroup (
groupname varchar(16) NOT NULL default '',
gid smallint(6) NOT NULL default '5500',
members varchar(16) NOT NULL default '',
KEY groupname (groupname)
) TYPE=MyISAM COMMENT='ProFTP group table';


CREATE TABLE ftpquotalimits (
name varchar(30) default NULL,
quota_type enum('user','group','class','all') NOT NULL default 'user',
per_session enum('false','true') NOT NULL default 'false',
limit_type enum('soft','hard') NOT NULL default 'soft',
bytes_in_avail int(10) unsigned NOT NULL default '0',
bytes_out_avail int(10) unsigned NOT NULL default '0',
bytes_xfer_avail int(10) unsigned NOT NULL default '0',
files_in_avail int(10) unsigned NOT NULL default '0',
files_out_avail int(10) unsigned NOT NULL default '0',
files_xfer_avail int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;

CREATE TABLE ftpquotatallies (
name varchar(30) NOT NULL default '',
quota_type enum('user','group','class','all') NOT NULL default 'user',
bytes_in_used int(10) unsigned NOT NULL default '0',
bytes_out_used int(10) unsigned NOT NULL default '0',
bytes_xfer_used int(10) unsigned NOT NULL default '0',
files_in_used int(10) unsigned NOT NULL default '0',
files_out_used int(10) unsigned NOT NULL default '0',
files_xfer_used int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;

CREATE TABLE ftpuser (
id int(10) unsigned NOT NULL auto_increment,
userid varchar(32) NOT NULL default '',
passwd varchar(32) NOT NULL default '',
uid smallint(6) NOT NULL default '5500',
gid smallint(6) NOT NULL default '5500',
homedir varchar(255) NOT NULL default '',
shell varchar(16) NOT NULL default '/sbin/nologin',
count int(11) NOT NULL default '0',
accessed datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
UNIQUE KEY userid (userid)
) TYPE=MyISAM COMMENT='ProFTP user table';


##### Create Group Full Access #####
INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES ('ftpgroup', 2001,
'ftpuser');

##### Create Group Read Only #####
INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES ('readftpgroup',
2002, 'readftpuser');

##### Create Test User Full Access #####
INSERT INTO `ftpquotalimits` (`name`, `quota_type`, `per_session`, `limit_type`,
`bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`,
`files_xfer_avail`) VALUES ('demouser', 'user', 'true', 'hard', 157286400, 0,
0, 0, 0, 0);

INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`,
`count`, `accessed`, `modified`) VALUES (1, 'demouser', 'secret', 2001, 2001,
'/data/ftp/demouser', '/sbin/nologin', 0, '', '');


##### Create Test User Readonly #####

INSERT INTO `ftpquotalimits` (`name`, `quota_type`, `per_session`, `limit_type`,
`bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`,
`files_xfer_avail`) VALUES ('userdemo', 'user', 'true', 'hard', 157286400, 0,
0, 0, 0, 0);

INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`,
`count`, `accessed`, `modified`) VALUES (2, 'userdemo', 'wedhus', 2002, 2002,
'/data/ftp/demouser', '/sbin/nologin', 0, '', '');

mysql> quit


##### Linux Shell ###############
##### Add Group Full Access #####
groupadd -g 2001 ftpgroup

##### Add User Full Access #####
useradd -u 2001 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup
ftpuser

##### Add Group Read Only #####
groupadd -g 2002 readftpgroup


Exec Path:
/usr/local/sbin/proftpd

Config File:
/usr/local/etc/proftpd.conf

Data:
/data/ftp/


# Basic ProFTPD Configuration
ServerName "FTP Server"
ServerType standalone
DefaultServer on
ServerAdmin admin@localhost.com


# Port 21 is the standard
FTP port.

Port 21


# Umask 022 is a good standard
umask to prevent new dirs and files

# from being group and world writable.

Umask 022

MaxInstances 30


# Set the user and group under
which the server will run.

User ftpuser
Group ftpgroup

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.

DefaultRoot ~

# Normally, we want files
to be overwriteable.

AllowOverwrite on


# Bar use of SITE CHMOD by default



DenyAll

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

TransferLog /var/log/proftpd.xferlog
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
LogFormat write "%h %l %u %t \"%r\" %s %b"

# Log file/dir access
ExtendedLog /var/log/proftpd.access_log WRITE,READ write

# Record all logins
ExtendedLog /var/log/proftpd.auth_log AUTH auth


# Paranoia logging level....
ExtendedLog /var/log/proftpd.paranoid_log ALL default

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


# The passwords in MySQL are encrypted using CRYPT

SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*


# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo ftp@localhost proftpd kunam

# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db

SQLUserInfo ftpuser userid passwd uid gid homedir shell

# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db

SQLGroupInfo ftpgroup groupname gid members

# set min UID and GID - otherwise these are 999 each
SQLMinID 500

# create a user's home directory on demand if it doesn't exist
SQLHomedirOnDemand on

# Update count every time
user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'"
ftpuser

# Update modified everytime
user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on

SQLNamedQuery get-quota-limit
SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail,
bytes_xfer_avail, files_in_avail, files_out

_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type
= '%{1}'"

SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used,
bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used
FROM f

tpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used
+ %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used
+ %{

2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used +
%{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type
= '%{7}'" ftpquotatallies

SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4},
%{5}, %{6}, %{7}" ftpquotatallies

QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

RootLogin off
RequireValidShell off

######### end of proftpd.conf #########


[Start proftpd]
/usr/local/sbin/proftpd

Search Linux Resources