";
$token = explode("!@#^!", $token);
//echo convert_uudecode($token[0])."
";
//echo convert_uudecode($token[1])."
";
//exit;
//$loginuserid=convert_uudecode($token[0]);
} else {
//$loginuserid=$_SESSION['userid'];
$loginuserid = isset($_SESSION['userid']) ? $_SESSION['userid'] : '';
// remove the key so we don't keep outputting the message
//unset($_SESSION['userid']);
}
//$loginuserid=$_REQUEST['token'];
//echo "loginuserid=". $loginuserid."
";
$loginusertype=$_REQUEST['user_type'];
if($loginuserid=='') header('Location:../index.php');
if($loginusertype==1)
{
$query = "SELECT t1.user_name,t1.mobile, t1.company_name, t1.company_type, t2.deviceid,t2.trackerid, t2.registration_number, t2.expiry_date, t2.device_type, t2.fencename FROM tbluserprofile AS t1, tbldeviceprofile AS t2 where t1.userid= '".$loginuserid."' and t2.userid= '".$loginuserid."' and t2.deviceid= '".$_REQUEST['deviceid']."'" ;
}
elseif($loginusertype==2)
{
$query = "SELECT t1.user_name,t1.mobile, t1.company_name, t1.company_type, t2.deviceid,t2.trackerid, t2.registration_number, t2.expiry_date, t2.device_type, t2.fencename FROM tbluserprofile AS t1, tbldeviceprofile AS t2 where t1.userid= '".$loginuserid."' and t2.supervisorid= '".$loginuserid."' and t2.deviceid= '".$_REQUEST['deviceid']."'" ;
}
else
{
$query = "SELECT t1.user_name,t1.mobile, t1.company_name, t1.company_type, t2.deviceid,t2.trackerid, t2.registration_number, t2.expiry_date, t2.device_type, t2.fencename FROM tbluserprofile AS t1, tbldeviceprofile AS t2 where t1.userid= '".$loginuserid."' and t2.userid= '".$loginuserid."' " ;
}
$result = mysql_query($query, $conn);
$row = mysql_fetch_assoc( $result);
$device_type=$row['device_type'];
$tbldeviceid='d'.$row['deviceid'];
$fencename=$row['fencename'];
$mobile = explode(",", $row['mobile']);
$company_name=$row['company_name'];
$company_type=$row['company_type'];
echo "";
$queryTrackerInfo = "SELECT * from tbldeviceprofile where userid='".$loginuserid."' " ;
$resultTrackerInfo = mysql_query($queryTrackerInfo, $conn);
//$noOfDevice = mysql_num_rows($resultTrackerInfo);
$regNoWE='';
$regNoAE='';
$regNoWEM='';
$regNoAEM='';
$noOfDeviceAE=0;
while ($rowTrackerInfo=mysql_fetch_assoc($resultTrackerInfo))
{
if($rowTrackerInfo['device_type']=="VT")
{
$registration_number_person_name=trim($rowTrackerInfo['registration_number']);
}
else
{
$registration_number_person_name=$rowTrackerInfo['person_name'];
}
$expiry_date=$rowTrackerInfo['expiry_date'];
$returnType=findExpiryDate($expiry_date);
if($returnType=="willBeExpire")
{
$regNoWE=$regNoWE.$registration_number_person_name.' on '.$expiry_date.'\n';
$regNoWEM=$regNoWEM.$registration_number_person_name.' on '.$expiry_date.'
';
}
else if($returnType=="expired")
{
$regNoAE=$regNoAE.$registration_number_person_name.' on '.$expiry_date.'\n';
$regNoAEM=$regNoAEM.$registration_number_person_name.' on '.$expiry_date.'
';
$noOfDeviceAE++;
if($loginusertype==4)header('Location:../index.php?err=4');
}
}
//$noOfDeviceR=$noOfDevice-$noOfDeviceAE;
if($loginusertype==4 && ($regNoWE!='' || $regNoAE!=''))
{
$message='Will Expire : \n\n'.$regNoWE.'\n\nPlease payment your service charge to NITS Service (Pvt.) Ltd.,\nAccount No 114.110.5240, Dutch Bangla Bank Ltd.(DBBL)';
echo "";
$message='Will Expire :
'.$regNoWEM;
//sendMail($loginuserid,$message,$primary_email);
}
function findExpiryDate($exp_date)
{
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);
$diff=($expiration_date-$today)/86400;
if ($diff < 0)
{
$type = "expired";
}
else if ($diff >= 0 && $diff <= 7)
{
$type = "willBeExpire";
}
else
{
$type = "running";
}
return $type;
}
function sendMail($loginuserid,$message,$email)
{
ini_set('SMTP', "115.69.209.209");
$subject=" \"Ntrack-Vehicle Tracking Service\" Expiration Notification (".$loginuserid."), Live";
$billing_contact='ntrack.billing@gmail.com';
$mailBody="Dear Mr./Ms. ".$loginuserid."
The service at risk of expiring:
".$message."
RENEW NOW to ensure all of your services remain active!
Please deposit to any following account and send us deposit slip with your \"User ID\" by email.
A/C Name : NITS Service Pvt Ltd
A/C No.: 114.110.5240, Dutch Bangla Bank Ltd.
A/C No.: 1101162920001, The City Bank Ltd.
A/C No.: 2048, Islami Bank Bangladesh Ltd., Mohakhali Branch, Dhaka.
Dial to 02-9887074-6, Ext 280 or 01975733160 (Somen)
If you wish to cancel, please disregard this email. Remember, canceled name/services may be
released for anyone to register and all related data will be removed from our server and
is no longer subject to recovery.
Thanks as always for being a Ntrack customer.
Sincerely,
NITS Service (Pvt.) Ltd.
";
$to = 'support.ntrack@gmail.com';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: newalert@nreach.net.bd' . "\r\n";
$headers .= 'Cc: '. $email . "\r\n";
$retval =mail($to, $subject, $mailBody, $headers);
}
?>