Jump to content
php.lv forumi

sms skripts


bergs

Recommended Posts

Mans murgs par sho teemu, kursh straadaa :)

 

 

 

<?php

$lmt=array(
'61','62','63','64','65','91','92','93','94'
);

//maileriz
class DMailer {

var $to;
var $body;
var $subject;
var $headers;
var $mustsend=true; //vai jaasuuta

       function Send(){

               if ($this->mustsend){
                       foreach ($this->to as $to_val){
                               $subject=$this->subject;
                               //if ($to_val['mobile']){
                               //        $subject='';
                               //}
                               mail($to_val,$subject,$this->body,$this->headers);
                               print $to_val.'<br>';
                       }
               }
       }

       //adds another recipient
       function AddTo($to){
               $to[]=$to;
       }

}

//gets the addresses
function GetAddrs($addrs){

       GLOBAL $lmt;
       //eliminating spaces
       
       $addrs=preg_replace("'([\r\n\s,])[\s]+'",',',$addrs);
       $addrs=str_replace(' ',',',$addrs);

       
       print '<br><br>'.$addrs.'<br><br>';
       $res=explode(',',$addrs);
       foreach ($res as $k=>$v){
               //if it's not an email address, interpret it as mobile number...
               if (strpos($v,'@')===false){
                       print substr($v,0,2).'<br>';
                       $res[$k]=( (in_array(substr($v,0,2),$lmt))? $res[$k].'@smsmail.lmt.lv':$res[$k].'@sms.tele2.lv' );
                       //$res[$k]['mobile']=true;
               }
       }
       return $res;

}


print "
 <html>
  <body bgcolor=#FFAAFF>
   <form action='?mailem=aye' method=post>
     No (vaards):<br>
     <input type=text size=30 name=fromname><br>
     No (emails):<br>
     <input type=text size=30 name=fromaddr><br>
     Temats:<br>
     <input type=text size=30 name=subjekts><br>
     Adreses:<br>
     <textarea rows=5 cols=50 name=adrz></textarea><br>
     Texts:<br>
     <textarea rows=5 cols=50 name=dath></textarea><br>
     <input type=submit value=Suutiit>
   </form>
  </body>
 </html>   ";



if ($mailem=='aye')
{
  $headers='';
  //$headers.= "Content-type: text/html; charset=windows-1257\r\n";
  $headers .= "From: ".$fromname."<".$fromaddr.">\r\n";
  $m=new DMailer();
  $m->mustsend=true;
  $m->subject=$subjekts;
  $m->headers=$headers;
  $m->to=GetAddrs($adrz);
  $m->body=$dath;
  print $dath;
  $m->send();
}

 




?>

Link to comment
Share on other sites

  • 2 weeks later...

Nea. Darbojas arii uz tele2 juuzeriem :)

Man atdaliiti ir tikai LMT prefixi - paareejos automaatiski pienjemu par tele2. Te gan jaasaka, ka, ja gribas, lai tas viss straadaatu arii prieksh teroristiskiem juuzeriem (kuri vienmeer ievadiis kaut ko nepareizu), ir krietni veel jaapastraadaa.

Link to comment
Share on other sites

lūgtum no šejienes:

<html>
<head>
<title>Īsziņu sūtīšana</title>
<META http-equiv="Content-Type" content="text/html; charset=windows-1257">
<script language='javascript' type='text/javascript'>
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}
</script>
</head>
<body>
<? 
if (ISSET($_POST['send'])){
$sms_numurs = $_POST['sms_numurs'];
$sms_teksts = $_POST['sms_teksts'];
if ($sms_teksts == '' || sms_numurs == '') {die ("Dodies atpakaļ un aizpildi abus laukus!");}
$kjeburi = array("ā", "č", "ē", "ģ", "ī", "ķ", "ļ", "ņ", "š", "ū", "ž");
$normali  = array("a", "c", "e", "g", "i", "k", "l", "n", "s", "u", "z");
$sms_teksts = str_replace($kjeburi, $normali, $sms_teksts);
$div = substr($sms_numurs,0,2); 
if ($div == '91' || $div == '92' || $div == '93' || $div == '94' || $div == '61' || 
$div == '63' ||  $div == '64' || $div == '65') {$sms_prov = '@smsmail.lmt.lv';} else {$sms_prov = '@sms.tele2.lv';}
if ($sms_prov == '@smsmail.lmt.lv') {$kam = "371".$sms_numurs.$sms_prov;} else {$kam = $sms_numurs.$sms_prov;}
$no = "from: aa@be.ce";
mail($kam,NULL,$sms_teksts,$no) or die ('īsziņa netika nosūtīta');
echo "Īsziņa veiksmīgi nosūtīta!<meta http-equiv='refresh' content='2;URL='>"; 
} else {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <form method="post" action="">
   <tr> 
     <td width="16%">Numurs:</td>
     <td width="84%"> <input name="sms_numurs" type="text" size="12" maxlength="7"> 
     </td>
   </tr>
   <tr> 
     <td>Teksts:</td>
     <td>
<textarea name=sms_teksts wrap=physical cols=50 rows=4 onKeyDown="textCounter(this.form.sms_teksts,this.form.remLen,125);" onKeyUp="textCounter(this.form.sms_teksts,this.form.remLen,125);"></textarea>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"></td>
   </tr>
   <tr align="center">
     <td colspan="2"><input type="submit" name="send" value="Sūtīt"></td>
   </tr>
 </form>
</table>
<?
}
?>
</body>
</html>

un ir veel...kas mekle tas atrod nevis bljaustas:))vairs nemekleshu citu vieta:)))

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...