this script only works for 012 and 019. you can see how it works at
http://kebunpakwa.netfirms.com.
this script uses a part of MOJO mailing list script located at
http://mojo.skazat.com. so, please install this script and make sure it is working before using the sms script.
content of the perl file ( eg. sms.cgi ) which located in the same folder with mojo files:
Code:
#!/usr/bin/perl -w
use CGI::Carp "fatalsToBrowser";
use lib './'; #look for the MOJO folder in the same directory as the script
use lib './MOJO';
$ENV{PATH} = "/bin:/usr/bin";
use MOJO::CONFIG;
use MOJO::GUTS;
use MOJO::HTML;
use CGI qw(:standard :html3);
use strict;
$|++;
my $q = new CGI;
my $flavor = $q->param('flavor');
$flavor = $q->param('f') unless($flavor);
my $smsaddress = $q->param('smsaddress');
my $nombor = $q->param('nombor');
my $operator = $q->param('operator');
my $nama = $q->param('nama');
my $mesej = $q->param('mesej');
my @inlines = ();
my %Mode = (
'default' => \&default, #user start page with all lists
'sms' => \&sms, #user send sms
);
if(exists($Mode{$flavor})) {
$Mode{$flavor}->(); #call the correct subroutine
}else{
&default
}
sub default {
print header();
print('default');
exit;
}
sub sms {
print(admin_html_header(
-Title => "SMS"
));
my ($sec, $min, $hour, $day, $month, $year) = (localtime)[0,1,2,3,4,5];
if ($operator eq "012") {$smsaddress = "6012".$nombor."\@sms.maxis.net.my"}
if ($operator eq "019") {$smsaddress = "019".$nombor."\@sms.celcom.com.my";}
$mesej = $mesej."free sms at http://www.yoursite.com";
require MOJO::MAIL;
my $mh = MOJO::MAIL -> new();
my %mailing = (
From => "\"$nama\"<$sec\@yoursite.com>",
'Return-Path' => "\"yoursite\"<$sec\@yoursite.com>",
'Errors-To' => "\"yoursite\"<$sec\@yoursite.com>",
'Content-Type' => "text/plain; charset=iso-8859-1",
List => "no list",
To => "$smsaddress",
Subject => "SMS dari $nama",
Body => "$mesej",
send_via_smtp => "0",
'Strip-Headers' => "0");
$mh -> send(%mailing);
print "sms sent";
print(admin_html_footer());
exit;
}
the content of the html form:
Code:
<html>
<head>
<title>SMS</title>
<SCRIPT language=JavaScript>
<!--
function countMsg(theForm) {
textMsg = theForm.mesej;
textCount = textMsg.value.length;
if (textCount > 120) {
textMsg.value = textMsg.value.substring(0,120);
textCount = 120;
}
theForm.char_count.value = textCount
}
//-->
</SCRIPT>
</head>
<body>
<FORM action=http://www.yoursite.com/cgi-bin/mojo/sms.cgi method=post>
<P>To: <SELECT name=operator size=1><OPTION selected
value=019>019</OPTION> <OPTION
value=012>012</OPTION></SELECT> <INPUT maxLength=8 name=nombor size=8>
<P>The SMS message:<BR><TEXTAREA cols=15 name=mesej onkeyup=countMsg(this.form) rows=6 wrap=virtual></TEXTAREA><BR><FONT
class=small size=-1>Total: <INPUT disabled name=char_count size=3 value=0>
chars. [Max:120]<BR><BR>Nama anda : <INPUT maxLength=8 name=nama size=8> <BR>
<font face=arial size=1>
<input type=hidden name=flavor value=sms>
<center>
<INPUT name=list type=hidden value=name_of_mojolist> <INPUT type=submit value=Submit> <INPUT type=reset value=Reset> </center> </FORM></font>
</body>
</html>
that's all.
good luck.
