Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Online text messaging

    I found this neat script that allows you to send text (SMS) messages right from you're website provided that you have PHP.

    See example of what it looks like here >>>

    http://sms.eric1207.com/index.php

    I sent myself a message from the site above and I received it successfully in my cell phone. I saved and uploaded the code to my server from the link referenced at the bottom of the page to http://sms.eric1207.com/sms.phps . When I test the page, I keep getting the following script configuration error

    Parse error: parse error, unexpected T_STRING in /home/skatew/public_html/script_folder/celltext.php on line 82

    I am running on Apache version 1.3.33 (Unix) and PHP version 4.3.11. Only thing I can come up with that might pinpoint to the problem is the file extension ".phps" given. Does anyone know how to code this properly?

    celltext.php


    <?

    ########
    #*INFO***#
    ########

    /*


    Author:
    Eric*O'Callaghan*(eric1207@gmail.com)

    Date*Created:
    June*19,*2005*(Sunday)

    Notes:
    This*script*simply*takes*the*entered*values*and*send*an*email*to*<The-10-Digit-Number>@teleflip.com
    Also,*when*viewing*this*script,*you*will*see*at*the*bottom*that*message*must*be*limited*to*a*certain *number*of*characters
    and*also*Teleflip*wonderful*service*places*a*small*notification*at*the*bottom*of*each*message*saying *that*it*indeed*was*sent*with*their*service.

    You*MUST*have*an*SMTP*server*and*the*mail()*function*enabled*in*PHP*for*this*script*to*work.

    There*is*no*support*for*international*numbers.*Only*North*American*based*phone*numbers*work.

    */

    ?>
    <html>
    <head>
    <title>SMS/Text*Messenger</title>
    <script*type="text/javascript">

    var*ns6=document.getElementById&&!document.all

    function*restrictinput(maxlength,e,placeholder){
    ****if*(window.event&&event.srcElement.value.length>=maxlength)
    ********return*false
    ****else*if*(e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
    ********var*pressedkey=/[a-zA-Z0-9\.\,\/]/*//detect*alphanumeric*keys
    ********if*(pressedkey.test(String.fromCharCode(e.which)))
    ************e.stopPropagation()
    ********}
    ****}

    function*countlimit(maxlength,e,placeholder){
    ****var*theform=eval(placeholder)
    ****var*lengthleft=maxlength-theform.value.length
    ****var*placeholderobj=document.all?*document.all[placeholder]*:*document.getElementById(placeholder)
    ****if*(window.event||e.target&&e.target==eval(placeholder)){
    ********if*(lengthleft<0)
    ************theform.value=theform.value.substring(0,maxlength)
    ************placeholderobj.innerHTML=lengthleft
    ********}
    ****}


    function*displaylimit(thename,*theid,*thelimit){
    ****var*theform=theid!=""?*document.getElementById(theid)*:*thename
    ****var*limit_text='<b><span*id="'+theform.toString()+'">'+thelimit+'</span></b>'
    ****if*(document.all||ns6)
    ********document.write(limit_text)
    ********if*(document.all){
    ************eval(theform).onkeypress=function(){*return*restrictinput(thelimit,event,theform)}
    ************eval(theform).onkeyup=function(){*countlimit(thelimit,event,theform)}
    ********}
    ********else*if*(ns6){
    ************document.body.addEventListener('keypress',*function(event)*{*restrictinput(thelimit,even t,theform)*},*true);*
    ************document.body.addEventListener('keyup',*function(event)*{*countlimit(thelimit,event,thef orm)*},*true);*
    ********}
    ****}

    </script>
    </head>
    <body>
    <center>
    <big><u>SMS/Text*Messenger</u></big><p>
    <?

    //*Turn*off*all*error*reporting
    error_reporting(0);

    //*If*the*text*message*form*has*been*submitted,*process*it
    if*($_POST['do']*==*"Send")*{

    ****//*Parse*the*data*submitted*from*the*form
    ****$number*=*trim($_POST['number']);
    ****$subject*=*trim($_POST['subject']);
    ****$message*=*trim($_POST['message']);

    ****//*Clarify*that*the*phone*number*is*numeric*and*that*the*subject*and*message*have*values
    ****if*((is_numeric($number))*&&*($number*!=*"")*&&*($subject*!=*"")*&&*($message*!=*""))*{

    ********//*Send*the*text*message*(via*Teleflip's*service)
    ********if*(mail("$number@teleflip.com",*$subject,*$message))*{

    ************//*Give*a*success*notice
    ************echo*"Text*message*sent.";
    ********}*else*{
    ************//*Give*an*error*notice
    ************echo*"Error*while*sending*text*message.";
    ********}

    ****}*else*{
    ********//*Tell*the*user*to*enter*proper*values
    ********echo*"Please*fill*in*all*fields*and*make*sure*you*entered*the*10-digit*phone*number*with*no*spaces*or*hyphens*(-).";
    ****}
    }*else*{

    ****//*Show*the*form*to*send*messages
    ****echo*"<form*method=\"post\"*name=\"txtmsg\"*action=\"\">\n";
    ****echo*"<table*align=\"center\"*border=\"1\"*bordercolor=\"black\">\n";
    ****echo*"<tr>\n";
    ****echo*"<td*align=\"left\">\n";
    ****echo*"Recipients*Number<br>\n";
    ****echo*"<input*type=\"text\"*name=\"number\"*maxlength=\"10\">\n";
    ****echo*"</td>\n";
    ****echo*"<td*align=\"right\">\n";
    ****echo*"Enter*the*recipient's*10-digit*phone*number.<br>(For*example:*8001234567)\n";
    ****echo*"</td>\n";
    ****echo*"</tr>\n";
    ****echo*"<tr>\n";
    ****echo*"<td*align=\"left\">\n";
    ****echo*"Subject<br>\n";
    ****echo*"<input*type=\"text\"*name=\"subject\"*maxlength=\"20\">\n";
    ****echo*"</td>\n";
    ****echo*"<td*align=\"right\">\n";
    ****echo*"Enter*a*short,*brief*word*or*two*for*the*subject*of*the*message.<br>You*are*limited*to*<sc ript>displaylimit(\"document.txtmsg.subject\",\"\",20)</script>*characters\n";
    ****echo*"</td>\n";
    ****echo*"</tr>\n";
    ****echo*"<tr>\n";
    ****echo*"<td*align=\"left\">\n";
    ****echo*"<textarea*name=\"message\"*rows=\"5\"*cols=\"25\"*onFocus=\"if(this.value=='Body')this.val ue=''\">Body</textarea><br>\n";
    ****echo*"</td>\n";
    ****echo*"<td*align=\"right\">\n";
    ****echo*"Enter*your*message.<br>You*are*limited*to*<script>displaylimit(\"document.txtmsg.message\" ,\"\",100)</script>*characters.\n";
    ****echo*"</td>\n";
    ****echo*"</tr>\n";
    ****echo*"<tr>\n";
    ****echo*"<td*align=\"center\"*colspan=\"2\">\n";
    ****echo*"<input*type=\"submit\"*name=\"do\"*value=\"Send\">\n";
    ****echo*"</td>\n";
    ****echo*"</tr>\n";
    ****echo*"</table>\n";
    ****echo*"</form>\n";

    ****echo*"<p><br>Notice:*<i>Due*to*telephone*companies*restrictions,*the*message*(including*subject) *must*be*under*160*characters*(including*spaces),*hence*SMS*means*Short*Message*Service.\n";
    ****echo*"Also,*since*this*script's*using*Teleflip's*service,*the*bottom*of*each*and*every*message*s ent*will*have*a*small*notice*saying*that*it*was*indeed*sent*from*their*service.</i>\n";
    ****echo*"<p>Message*sending*provided*by*<a*href=\"http://teleflip.com\">Teleflip</a>.\n";
    ****echo*"<br>This*script*was*created*by*<a*href=\"mailto:eric1207@gmail.com\">Eric*O'Callaghan</a>.\n";
    }

    ?>
    </center>
    </body>
    </html>
    Last edited by johnnybananas; 09-08-2005 at 09:22 AM.

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    for some reason all your spaces have been converted to *... is that in the file or just when pasted here?

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    put it in php tags

    [ php ]
    Last edited by shinko_metsuo; 09-09-2005 at 02:09 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •