...

View Full Version : PHP Online text messaging



johnnybananas
09-08-2005, 09:19 AM
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*<script>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.value=''\">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*character s*(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*sent*will*h ave*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>

NancyJ
09-08-2005, 10:09 AM
for some reason all your spaces have been converted to *... is that in the file or just when pasted here?

shinko_metsuo
09-09-2005, 02:07 AM
put it in php tags

[ php ]



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum