SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Thu Mar 13, 2025 17:59
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
florit: Operating system name and version: opensuse 13.2 Version of smsd: unknow Smsd installed from: sources Interface: / USB I got a little eventhandler problem with MySQL And the output: GSM1: ! mysql: unknown option '--print-defaults' Every incoming SMS these msg ...... I do not gave this option in MySQL credentials Why this?
florit: For more funktionality replace: CMD=`echo "$TEXT" | cut -d " " -f8` With: CMD=`echo "$TEXT" | tr " " " " | cut -d " " -f8-16` The "16" can be a higher Number you like.
florit: Well Developing stop with this year when it ends ... ... So on here is my Last work ... for this year ... A sample bash Script for Linux developed on OpenSuSE 13.2 *) Check Admin Numbers *) Check Servers allowed *) Check cmd allowed *) log incoming sms on error *) send to admins sms *) answer to Admins is not a Server cmd if incoming not from admins *) ssh to Servers allowed cmd with User pwd and Root pwd *) Running ssh cmd as Nobody *) defined Users for ssh allowed for the SMS answer *) Script password Let the User Nobody Access /var/log/sms_incomming.log With "chown nobody:nogroup file" chmod +x smsd_notify.sh chmod +x event.sh event.sh #!/bin/bash #!/dev/tty1 NOW=$(date +"%m-%d-%y"); HOUR=$(date +"%T"); #run this script only when a message was received. #sms like: PASSWORD ACTION rootpwd userpwd user host port cmd #sms like: PASSWORD ACTION rootpwd userpwd user host@host port cmd #cmd like: reboot , or call a Script like: /usr/local/bin/script.sh what have no options ################################### EDIT THIS ########################################### # script PASSWORD PASSWORD="Password" # admin sms number ADMIN="43676xxxxxxx" ADMIN2="43676xxxxxxx" # hosts in chain # Nobody's Password NBPWD="Nobody" # host list for 2 accessable servers HOSTS2=('192.168.0.10' '192.168.0.11'); # end host list USER1="user1" USER2="user2" ################################### EDIT THIS ########################################### if [ "$1" = "RECEIVED" ]; then TEXT=`sed -e '1,/^$/ d' < $2` #Extract data from the SMS file SENDER=`grep "From: " $2 | cut -d " " -f2` RCVPASS=`echo "$TEXT" | cut -d " " -f1` ACTION=`echo "$TEXT" | tr "a-z" "A-Z" | cut -d " " -f2` ROOTPWD=`echo "$TEXT" | cut -d " " -f3` USERPWD=`echo "$TEXT" | cut -d " " -f4` USERNAME=`echo "$TEXT" | cut -d " " -f5` HOSTS=`echo "$TEXT" | tr "A-Z" "a-z" | cut -d " " -f6` PORTS=`echo "$TEXT" | cut -d " " -f7` CMD=`echo "$TEXT" | cut -d " " -f8` if [ -z "$PORTS" ]; then PORTS="22" else PORTS=`echo "$TEXT" | cut -d " " -f7` fi TARGET=(${HOSTS//@/ }); case "$SENDER" in "$ADMIN") /etc/smsd_notify.sh $ADMIN "Info: $ACTION@${HOSTNAME} Is accepted From User: ${USERNAME} $NOW $HOUR" ;; "$ADMIN2") /etc/smsd_notify.sh $ADMIN2 "Info: $ACTION@${HOSTNAME} Is accepted From User: ${USERNAME} $NOW $HOUR" ;; *) /etc/smsd_notify.sh $ADMIN "You have a new Message from $SENDER : $TEXT $NOW $HOUR" /etc/smsd_notify.sh $ADMIN2 "You have a new Message from $SENDER : $TEXT $NOW $HOUR" exit 0 ;; esac for G in ${TARGET[@]} ; do FOUND=`echo "${HOSTS2[*]}" | grep "$G"` if [ "${FOUND}" != "" ]; then if [ "$PASSWORD" = "$RCVPASS" ]; then case "${G}" in "${HOSTS2[0]}") echo $NBPWD | sudo -u nobody -S bash -c : && RUNAS="sudo -u nobody" $RUNAS bash<<_ #!/bin/bash #!/dev/tty0 case "$ACTION" in #ssh SSH) sshpass -p "$USERPWD" ssh -p $PORTS -t -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -E ~/ssh.log ${USERNAME}@${G} "bash -c 'echo $ROOTPWD | sudo -u root -S ${CMD} ; exit'"; ;; #else cmd *) echo Warning incomming sms for $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR >> /var/log/sms_incomming.log if [ "${USER1}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; elif [ "${USER2}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN2 "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; fi ;; esac _ ;; "${HOSTS2[1]}") echo $NBPWD | sudo -u nobody -S bash -c : && RUNAS="sudo -u nobody" $RUNAS bash<<_ #!/bin/bash #!/dev/tty0 case "$ACTION" in #ssh SSH) sshpass -p "$USERPWD" ssh -p $PORTS -t -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -E ~/ssh.log ${USERNAME}@${G} "bash -c 'echo $ROOTPWD | sudo -u root -S ${CMD} ; exit'"; ;; #else cmd *) echo Warning incomming sms for $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR >> /var/log/sms_incomming.log if [ "${USER1}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; elif [ "${USER2}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN2 "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; fi ;; esac _ ;; esac fi else echo Warning incomming sms for $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR >> /var/log/sms_incomming.log if [ "${USER1}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; elif [ "${USER2}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN2 "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; fi fi done fi exit 0 And the smsd_notify.sh #!/bin/bash # This script send a text sms at the command line by creating # a sms file in the outgoing queue. # $1 is the destination phone number. # $2 is the message text. # like: your_script.sh 436768889901 "long message text" ARGV=("$@") ARGC=("$#") #main - read incoming sms message and queue it to smsd msg_rcpt=$1 msg_body=$2 msg_body_160=${msg_body:0:160} # now send the sms's outgoing="/var/spool/sms/GSM/GSM1" file=`mktemp $outgoing/smsd_XXXXXX` echo "To: $msg_rcpt" >> $file echo "" >> $file echo "$msg_body_160" >> $file exit 0 Well know it has bugs :roll: ... but answers welcome ... Good day 8)
florit: Well Developing stop with this year when it ends ... ... So on here is my Last work ... for this year ... A sample bash Script for Linux developed on OpenSuSE 13.2 *) Check Admin Numbers *) Check Servers allowed *) Check cmd allowed *) log incoming sms on error *) send to admins sms *) answer to Admins is not a Server cmd if incoming not from admins *) ssh to Servers allowed cmd with User pwd and Root pwd *) Running ssh cmd as Nobody *) defined Users for ssh allowed for the SMS answer *) Script password Let the User Nobody Access /var/log/sms_incomming.log With "chown nobody:nogroup file" chmod +x smsd_notify.sh chmod +x event.sh event.sh #!/bin/bash #!/dev/tty1 NOW=$(date +"%m-%d-%y"); HOUR=$(date +"%T"); #run this script only when a message was received. #sms like: PASSWORD ACTION rootpwd userpwd user host port cmd #sms like: PASSWORD ACTION rootpwd userpwd user host@host port cmd #cmd like: reboot , or call a Script like: /usr/local/bin/script.sh what have no options ################################### EDIT THIS ########################################### # script PASSWORD PASSWORD="Password" # admin sms number ADMIN="43676xxxxxxx" ADMIN2="43676xxxxxxx" # hosts in chain # Nobody's Password NBPWD="Nobody" # host list for 2 accessable servers HOSTS2=('192.168.0.10' '192.168.0.11'); # end host list USER1="user1" USER2="user2" ################################### EDIT THIS ########################################### if [ "$1" = "RECEIVED" ]; then TEXT=`sed -e '1,/^$/ d' < $2` #Extract data from the SMS file SENDER=`grep "From: " $2 | cut -d " " -f2` RCVPASS=`echo "$TEXT" | cut -d " " -f1` ACTION=`echo "$TEXT" | tr "a-z" "A-Z" | cut -d " " -f2` ROOTPWD=`echo "$TEXT" | cut -d " " -f3` USERPWD=`echo "$TEXT" | cut -d " " -f4` USERNAME=`echo "$TEXT" | cut -d " " -f5` HOSTS=`echo "$TEXT" | tr "A-Z" "a-z" | cut -d " " -f6` PORTS=`echo "$TEXT" | cut -d " " -f7` CMD=`echo "$TEXT" | cut -d " " -f8` if [ -z "$PORTS" ]; then PORTS="22" else PORTS=`echo "$TEXT" | cut -d " " -f7` fi TARGET=(${HOSTS//@/ }); case "$SENDER" in "$ADMIN") /etc/smsd_notify.sh $ADMIN "Info: $ACTION@${HOSTNAME} Is accepted From User: ${USERNAME} $NOW $HOUR" ;; "$ADMIN2") /etc/smsd_notify.sh $ADMIN2 "Info: $ACTION@${HOSTNAME} Is accepted From User: ${USERNAME} $NOW $HOUR" ;; *) /etc/smsd_notify.sh $ADMIN "You have a new Message from $SENDER : $TEXT $NOW $HOUR" /etc/smsd_notify.sh $ADMIN2 "You have a new Message from $SENDER : $TEXT $NOW $HOUR" exit 0 ;; esac for G in ${TARGET[@]} ; do FOUND=`echo "${HOSTS2[*]}" | grep "$G"` if [ "${FOUND}" != "" ]; then if [ "$PASSWORD" = "$RCVPASS" ]; then case "${G}" in "${HOSTS2[0]}") echo $NBPWD | sudo -u nobody -S bash -c : && RUNAS="sudo -u nobody" $RUNAS bash<<_ #!/bin/bash #!/dev/tty0 case "$ACTION" in #ssh SSH) sshpass -p "$USERPWD" ssh -p $PORTS -t -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -E ~/ssh.log ${USERNAME}@${G} "bash -c 'echo $ROOTPWD | sudo -u root -S ${CMD} ; exit'"; ;; #else cmd *) echo Warning incomming sms for $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR >> /var/log/sms_incomming.log if [ "${USER1}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; elif [ "${USER2}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN2 "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; fi ;; esac _ ;; "${HOSTS2[1]}") echo $NBPWD | sudo -u nobody -S bash -c : && RUNAS="sudo -u nobody" $RUNAS bash<<_ #!/bin/bash #!/dev/tty0 case "$ACTION" in #ssh SSH) sshpass -p "$USERPWD" ssh -p $PORTS -t -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -E ~/ssh.log ${USERNAME}@${G} "bash -c 'echo $ROOTPWD | sudo -u root -S ${CMD} ; exit'"; ;; #else cmd *) echo Warning incomming sms for $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR >> /var/log/sms_incomming.log if [ "${USER1}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; elif [ "${USER2}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN2 "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; fi ;; esac _ ;; esac fi else echo Warning incomming sms for $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR >> /var/log/sms_incomming.log if [ "${USER1}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; elif [ "${USER2}" = "${USERNAME}" ];then /etc/smsd_notify.sh $ADMIN2 "Warning: $ACTION@${G} Port: ${PORTS} rootpwd: ${ROOTPWD} userpwd: ${USERPWD} from User: ${USERNAME} $NOW $HOUR"; fi fi done fi exit 0 And the smsd_notify.sh #!/bin/bash # This script send a text sms at the command line by creating # a sms file in the outgoing queue. # $1 is the destination phone number. # $2 is the message text. # like: your_script.sh 436768889901 "long message text" ARGV=("$@") ARGC=("$#") #main - read incoming sms message and queue it to smsd msg_rcpt=$1 msg_body=$2 msg_body_160=${msg_body:0:160} # now send the sms's outgoing="/var/spool/sms/GSM/GSM1" file=`mktemp $outgoing/smsd_XXXXXX` echo "To: $msg_rcpt" >> $file echo "" >> $file echo "$msg_body_160" >> $file exit 0 Well know it has bugs but answers welcome ... Good day 8)
florit: Modem was initialed By Kernel with a Desktop Service for gsm Modems No more Problem
florit: Operating system name and version: opensuse 13.2 Version of smsd: latest version Smsd installed from: sources . Name and model of a modem / phone: tplink ma260 Interface: USB / Hello back with working device ... But now i want to observe it with nagios Nagios version: 4.0.8 Plugin: check_sms3status.pl Ready configured but it Shows me a Warning Message without Output Status Information ( no stdoutput ) Did anyone know this nagios Plugin an work with it?
florit: got nobody some idea why the timeout rise after initialing and not going ready status GSM1: Modem is not ready to answer commands (Timeouts: 0)
florit: Operating system name and version: OPENSUSE 13.2 Version of smsd: latest Smsd installed from: sources Name and model of a modem / phone: MA260 TP-LINK Interface: serial / USB / some adapter... got problem with modem these days after : GSM1: Using check_memory_method 1: CPMS is used. GSM1: Modem is not ready to answer commands (Timeouts: 0) comes timeout ...modem not ready .... has anyone some idea still not sending and recieving :shock:
florit: For bash usage compile main-c.cc
florit: Take a Look @ https://github.com/Smiril/smstools/ No release but git working with mods
florit: just you forget the modem init queues = GSM1 init = AT+CPMS="SM","SM","SM" queues = modemname mode = new hangup_incoming_call = yes voicecall_hangup_ath = yes and some stuff more
florit: Operating system name and version: Centos 6.5 x86_64 Version of smsd: 3.1.15 Smsd installed from: sources / package repository / from elsewhere... : Repo Name and model of a modem / phone: doesnt matter Interface: serial / USB / some adapter... USB Hi, i tried to send messages like this: smssend +49blablabla 'text to show as sms' i only get: 'text' as message. same if i use "text to show as sms" if i use "text_to_show_as_sms" or similar, it works. it ends at the 'space' what do i do wrong? i tried this on a shell. would be nice to send more than one word in front of the space. whats going on? thanks. try this shell script: to use like: your_script.sh 496768889901 "long message text" #!/bin/bash ARGV=("$@") ARGC=("$#") #main - read incoming sms message and queue it to smsd msg_rcpt=$1 msg_body=$2 msg_body_160=${msg_body:0:160} # now send the sms's outgoing="/var/spool/sms/GSM/GSM1" file=`mktemp $outgoing/your_script_XXXXXX` echo "To: $msg_rcpt" >> $file echo "" >> $file echo "$msg_body_160" >> $file exit 0
florit: here is the Source of getsms: /* * Description: get and read or delete SMS in Incoming Folder */ #include <dirent.h> #include <cstdlib> #include <iostream> #include <fstream> std::string core1 = "."; std::string core2 = ".."; using namespace std; const char* Version() { #ifdef VERSION return VERSION; #else return ""; #endif } int main () { printf("%s\n",Version()); const char *TROZ = "/var/spool/sms/incoming/";; int len; struct dirent *pDirent; DIR *pDir; pDir = opendir (TROZ); if (pDir == NULL) { printf ("Cannot open directory '%s'\n", TROZ); return 1; } while ((pDirent = readdir(pDir)) != NULL){ if(pDirent->d_name != core1 && pDirent->d_name != core2) { printf ("%s\n", pDirent->d_name); char START[512]; snprintf(START,512,"%s%s",TROZ, pDirent->d_name); std::string STRING; ifstream myfile; myfile.open(START, ios::in); int a=0; string previousLine=""; while(a<1) // To get you all the lines. { for(int i = 0;i < 13;i++){ getline(myfile,STRING); // Saves the line in STRING. if (STRING != previousLine) { previousLine=STRING; cout<<STRING<<endl; // Prints our STRING. } } myfile.close(); string delx = ""; string delc = "y"; printf("\nDelete sms? (y/n): "); getline(cin,delx); if(delx.c_str() == delc){ std::remove(START); //DeleteFile(START); } else { printf("Leave in Inbox ...\n"); } break; } // } else { continue; } // else } closedir(pDir); return 0; } do not forget make a new group like: smsincoming and set folder /var/spool/sms/incoming to "chmod 777" compile with this line: g++ main.cc -o getsms -DVERSION="\"YOUR-Trademark-getsms 0.3 Public Desaster\"" install like this: sudo cp getsms /bin/ && sudo chmod +x /bin/getsms just run getsms that makes you happy :P
florit: 4G Modem: TP-Link MA260 OK
florit: sloved .... gave the folder /var/spool/sms/GSM/GSM1 enought rights to crate file like: chown -R root:wwwrun /var/spool/sms/GSM :P 8)
florit: 4G Modem: TP-Link MA260 not working :'( :roll: recive: OK send: ERROR
florit: with config it work only getting not sending devices = GSM1 logfile = /var/log/sms/smstools.log #loglevel = 6 loglevel = notice outgoing = /var/spool/sms/outgoing checked = /var/spool/sms/checked incoming = /var/spool/sms/incoming failed = /var/spool/sms/failed sent = /var/spool/sms/sent [queues] GSM1 = /var/spool/sms/GSM/GSM1 [GSM1] device = /dev/ttyUSB2 queues = GSM1 init = AT+CPMS="SM","SM","SM" queues = modemname #primary_memory = SM #secondary_memory = SR incoming = yes rtscts = no hangup_incoming_call = yes voicecall_hangup_ath = yes unexpected_input_is_trouble = no pin = 1111 comes with error: 2015-09-02 13:24:56,2, smsd: Smsd v3.1.14 started. 2015-09-02 13:24:56,2, smsd: Running as root:root. 2015-09-02 13:24:56,4, smsd: File mode creation mask: 022 (0644, rw-r--r--). 2015-09-02 13:24:56,5, smsd: Outgoing file checker has started. PID: 25437. 2015-09-02 13:24:56,5, GSM1: Modem handler 0 has started. PID: 25439. 2015-09-02 13:24:56,5, GSM1: Using check_memory_method 1: CPMS is used. 2015-09-02 13:24:57,3, GSM1: Unexpected input: +CREG: 1, E420, 20639B +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 20639B +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 20639B +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2 +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 20639B +CREG: 1, E420, 205930 +CREG: 1, E420, 205A12 +CREG: 1, E420, 206F11 +CREG: 1, E420, 205930 +CREG: 1, E420, 206F11 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2 +CREG: 1, E420, 202757 +CREG: 1, E420, 209EE2 +CREG: 1, E420, 209EEA +CREG: 1, E420, 209EE2
florit: 4G Modem: TP-Link MA260 not working :'( :roll:
florit: Operating system OpenSUSE 13.2 x64: Version of smsd smstools3-3.1.15.: Smsd installed from: sources tar.gz Name and model of a modem TP-Link MA260: Interface: USB how bring this combination to run ? 4G modem , Opensuse with webserver , php script <?php $to = "43676xxxxxxx"; $use_utf = true; if ($use_utf) echo "Raw header used to set charset to UTF-8 \n"; $charset = $_POST['charset']; $text = $_POST['text']; if ($charset != "" && $text != "") { echo " charset: $charset text: $text "; $filename = "/var/spool/sms/outgoing/smstest-" .date("siH"); if (($handle = fopen($filename .".LOCK", "w")) != false) { $l = strlen($st = "To: $to\n"); fwrite($handle, $st); if ($charset == "UNICODE") { $l += strlen($st = "Alphabet: UCS\n"); fwrite($handle, $st); $text = mb_convert_encoding($text, "UCS-2BE", "UTF-8"); } else if ($charset == "ISO") $text = mb_convert_encoding($text, "ISO-8859-15", "UTF-8"); if ($_POST['flash'] != "") { $l += strlen($st = "Flash: yes\n"); fwrite($handle, $st); } $l += strlen($st = "Adjustment: +"); fwrite($handle, $st); $pad = 14 - $l % 16 + 16; while ($pad-- > 0) fwrite($handle, "+"); fwrite($handle, "\n\n$text"); fclose($handle); if (($handle = fopen($filename .".LOCK", "r")) == false) echo "Unable to read message file. "; else { echo "\n"; while (!feof($handle)) echo fgets($handle, 1024); echo " \n"; fclose($handle); } $tmpfilename = tempnam("/tmp", "smstest-"); exec("/usr/bin/hexdump -C < $filename.LOCK > $tmpfilename"); if (($handle = fopen($tmpfilename, "r")) == false) echo "Unable to create dump. "; else { echo "\n"; while (!feof($handle)) echo fgets($handle, 1024); echo " \n"; fclose($handle); unlink($tmpfilename); } if ($_POST['showonly'] == "") { if (rename($filename .".LOCK", $filename) == true) echo "Message placed to the spooler, filename: $filename \n"; else echo "FAILED! \n"; } else unlink($filename .".LOCK"); } else echo "FAILED! \n"; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') $result = 'https://'; else $result = 'http://'; $result .= $_SERVER['HTTP_HOST'] .$_SERVER['PHP_SELF']; echo "<a href='sms3.php'>Back</a>\n"; } else { echo "<html> <head> <title>SMS Send</title> </head> <body> "; echo " <form name='test' id='test' method='post'>"; echo " Send a message using:<br> <input type='radio' name='charset' value='ISO' checked>ISO<br> <input type='radio' name='charset' value='UNICODE'>UNICODE<br> <input type='radio' name='charset' value='Unmodified'>No charset conversion here<br> <br> <input type='checkbox' name='flash' value='Y'>Flash<br> <input type='checkbox' name='showonly' value='Y' checked>Show only the message file dump<br> <br> Text:<br> <input type='text' name='text' maxlength='70' value='This is a test message.' size='40'> <br> <input type='submit' value='Submit'> </form> </body> </html> "; } echo " "; ?>

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.