make a sms.php
put this in core.php
put this in config.php
put a column in ibwf_user is sms
i dnt knw sql for this if u knw then post here
source- youngbuzz script
if give any error post your solution here if you shortout that error !
thank you !
PHP Code:
<?php
include("config.php");
include("core.php");
echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML Mobile 1.0//EN\"". " \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $sitename; ?></title>
<meta forua="true" http-equiv="Cache-Control" content="no-cache"/>
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
<?php
connectdb();
$sid = $_GET["sid"];
echo gettheme($sid);
?>
</head>
<body>
<?php
gettimebar($sid);
$action = $_GET["action"];
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</div></div></body></html>";
exit();
}
if(isbanned($uid))
{
echo "<p align=\"center\">";
echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
echo "<b>You are Banned</b><br/><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
$remain = $banto[0]- time();
$rmsg = gettimemsg($remain);
echo "<b>Time Left: </b>$rmsg<br/>";
$nick = getnick_uid($banto[2]);
echo "<b>By: </b>$nick<br/>";
echo "<b>Reason: </b>$banto[1]";
//echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</div></div></body></html>";
exit();
}
/* if((getposts($sid)<50) AND (getshoutcount($uid)<200)){
boxstart("Error!");
echo "To prevent misuse, this feature is available only to those users who have more than 50 posts or 200 shouts.";
boxend();
getfooter($sid);
echo "</body></html>";
exit();
}
*/
if($action=="main")
{
addonline($uid,"Composing SMS","sms.php?action=$action");
$umsg = getunreadpm($uid);
if($umsg>0){
echo "<p align=\"center\"><a href=\"inbox.php?action=main&sid=$sid\">Inbox($umsg new msg)</a></p>";
}
boxstart("Compose SMS");
echo "Your site name allows you to send unlimited SMSes for free to any network's mobile no. in India. Even the latest 8xxxxxxxxx series numbers are supported. <br/>";
echo "<font color=\"red\"><b>Warning: Using this service for abuse will be strictly dealt with, and police action will be taken.</b></font><br/>";
$msglength=131-strlen(getnick_sid($sid));
echo "<form action=\"sms.php?action=send&sid=$sid\" method=\"post\">
Enter the 10 digit Indian mobile no.:<br/>
<input class=\"inputText\" type=\"text\" name=\"mobile\"size=\"20\" maxlength=\"10\" format=\"*N\"/><br/>
Enter your message($msglength chars max):<br/>
<input class=\"inputText\" type=\"Text\" name=\"message\" maxlength=\"$msglength\"></textarea><br/>
<input class=\"inputButton\" type=\"submit\" name=\"Submit\" value=\"Submit\"/>
</form>
";
boxend();
getfooter($sid);
echo "</body>";
}
else if ($action=="send"){
addonline(getuid_sid($sid), "Sending an SMS", "");
$sms = mysql_fetch_array(mysql_query("SELECT sms FROM ibwf_users WHERE id='".$uid."'"));
boxstart("Sending SMS");
echo "<p style=\"text-align: center\">";
$mobno=$_POST["mobile"];
///////Test whether cell number is valid(i.e. starting from 8 or 9 and containing 10 digits only)
if (!preg_match('/^[9|8]\d{9}$/', $mobno)){
echo "This is not a valid Indian mobile number!!! Please <a href=\"sms.php?action=main&sid=$sid\">go back</a> and retry.</p>";
boxend();
getfooter($sid);
echo "</body></html>";
exit();
}
$message=$_POST["message"];
/////////////if the message + footer is larger than 140 chars truncate the message to fit
$add="#".getnick_sid($sid)."@Yoursite";
$count=strlen($add);
$count=140-$count;
if(strlen($message)>$count){
$message=substr($message, 0, $count);
$flag[0]=1;
$flag[1]=strlen($message);
}
$message.=$add;
$bool=sendsms($mobno, $message);
if($bool==true){
if($flag[0]==1){
echo "Your message was longer than $flag[1] characters so it was truncated and first $flag[1] characters have been sent.<br/>";
}
echo "Your SMS has been successfully sent to $mobno<br/>";
$sms[0]++;
$b1 = mysql_query("UPDATE ibwf_users SET sms='$sms[0]' WHERE id='".$uid."'");
}
else{
echo "An error crept in while sending your SMS. Please try after sometime while an admin looks into the issue and fixes it.";
}
//////////////////////
echo "</p>";
boxend();
getfooter($sid);
echo "</body></html>";
}
put this in core.php
PHP Code:
////////////////////////////////////////////////// sms sending
function sendsms($mobile, $text){
$username="your id of way2sms";
$password="your way2sms password";
$result = "";
$headers= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\nAccept-Language: en-us,en;q=0.5\nAccept-Encoding: gzip,deflate\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\nKeep-Alive: 300\nConnection: keep-alive\n";
$fp = fsockopen("way2sms.com", 80, $errno, $errstr, 30);
if($fp){
$request="GET / HTTP/1.1\nHost: way2sms.com\n$headers\n";
fputs($fp, $request);
//echo "Request:<br/>".$request;
while(!feof($fp)){
$result .= fgets($fp, 128);
}
fclose($fp);
//echo "<br/><br/>Reply:<br/>".$result;
}
$return=explode("\n", $result);
$return=$return[3];
$i=17;
$location="";
while($return[$i]!="/"){
$location.=$return[$i];
$i++;
}
$fp1 = fsockopen($location, 80, $errno, $errstr, 30);
if($fp1){
$request="POST /auth.cl HTTP/1.1\nHost: $location\n$headers"."Referer: http://$location/content/prehome.jsp\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 43\n\nusername=$username&password=$password";
fputs($fp1, $request);
//echo "<br/><br/>Request:<br/>".$request;
while(!feof($fp1)){
$result1 .= fgets($fp1, 128);
}
fclose($fp1);
//echo "<br/><br/>Reply: <br/>".$result1;
}
$blah=strstr($result1, "Location: ");
$return=explode("\n", $blah);
$return1=$return[0];
$return="";
$blah="";
$blah=strstr($result1, "Set-Cookie: ");
$return=explode("\n", $blah);
$blah="";
$return=$return[0];
$return=explode(" ", $return);
$return=$return[1];
$return=explode(";", $return);
$cookie=$return[0];
$blah=explode(".com", $return1);
$blah=$blah[1];
$blah=explode("Main.jsp", $blah);
$blah=$blah[0];
$blah=explode("jsp/", $blah);
$blah=$blah[0];
$fp2=fsockopen($location, 80, $errno, $errstr, 30);
$data="custid=undefined&HiddenAction=instantsms&Action=custfrom950000&MobNo=$mobile&textArea=".urlencode($text)."&yincheck=on";
if($fp2){
$request="POST $blah"."FirstServletsms?custid= HTTP/1.1\nHost: $location\n$headers"."Referer: http://$location//jsp/InstantSMS.jsp?val=0\nContent-Type: application/x-www-form-urlencoded\nCookie: $cookie\nContent-Length: ".strlen($data)."\n\n$data";
//$request="POST //FirstServletsms?custid= HTTP/1.1\nHost: $location\n$headers"."Referer: http://$location//jsp/InstantSMS.jsp?val=0\nContent-Type: application/x-www-form-urlencoded\nCookie: $cookie\nContent-Length: ".strlen($data)."\n\n$data";
fputs($fp2, $request);
//echo "<br/><br/>Request:<br/>".$request;
while(!feof($fp2)){
$result2 .= fgets($fp2, 128);
}
fclose($fp2);
//echo "<br/><br/>Reply:<br/>".$result2;
}
if(substr_count($result2, "OK")){
return true;
}
else return false;
}
PHP Code:
$sms_username="your id way2sms"; //Register at way2sms.com and put ur mobile number here without 91, example 9810012345
$sms_password="your passowrd way2sms"; //Your way2sms.com password
put a column in ibwf_user is sms
i dnt knw sql for this if u knw then post here
source- youngbuzz script
if give any error post your solution here if you shortout that error !
thank you !
Comment