TechEthical CEHP

Current Path : G:/PleskVhosts/megamind.net.in/careercentre360.com/
Upload File :
Current File : G:/PleskVhosts/megamind.net.in/careercentre360.com/sendsms.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;

namespace Directory
{
    public enum SMSType {Enquiry, Registration, ContactUs, Subscribe, StudentLogin}

    public class sendsms
    {
        public HttpCookie otp_random(int min = 1111, int max = 9999, int time_minutes = 10)
        {
            Random r = new Random();
            int num = r.Next(min, max);

            HttpCookie cookie = new HttpCookie("otp");
            cookie.Value = "" + num;
            cookie.Expires = DateTime.Now.AddMinutes(time_minutes);
            return (cookie);
        }

        public long getOTP(int min = 1111, int max = 9999, int time_minutes = 10)
        {
            Random r = new Random();
            int num = r.Next(min, max);
            return num;
        }

        public void SendSMSIndivisual(string mobile, string msg, SMSType smsType)
        {
            if (mobile != "" && msg != "")
            {
                var msg1 = msg;
                string url = "";

                connection_sql obj = new connection_sql();
                string Param = "";
                switch(smsType)
                {
                    case SMSType.Enquiry:
                        Param = " and SendEnquiry='Yes'";
                        break;

                    case SMSType.Registration:
                        Param = " and SendRegistration='Yes'";
                        break;

                    case SMSType.ContactUs:
                        Param = " and SendContactUs='Yes'";
                        break;

                    case SMSType.Subscribe:
                        Param = " and SendSubscribe='Yes'";
                        break;

                    case SMSType.StudentLogin:
                        Param = " and SendStudentLogin='Yes'";
                        break;
                }

                url = obj.getRecordID("select SendSMS from tbl_SMS where id <> 0 " + Param);
                url = url.Replace("[[MOBILE]]", mobile);
                url = url.Replace("[[SMS]]", msg);

                if (url.Length > 10)
                { 
                    bool success = false;                
                    try
                    {
                        var outn = 0;
                        WebRequest request = WebRequest.Create(url);
                        using (WebResponse response = (HttpWebResponse)request.GetResponse())
                        {
                            Stream receiveStream = response.GetResponseStream();
                            using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
                            {
                                string line = readStream.ReadToEnd().Trim();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        success = false;
                    }
                }
            }
            else
            {
               // ScriptManager.RegisterStartupScript(this, GetType(), "set", "alert('Invalid SMS URL');", true);
            }
        }


        public void SendSMS_OTP(string mobile, string msg )
        {
            if (mobile !=""  && msg !="")
            {               
                var msg1 = msg;
                string url = "";

                url = "http://hindit.co.in/API/pushsms.aspx?loginID=T1CarrierCenter&password=NAVIN2JOSHIKA&mobile=" + mobile + "&text=" + msg + "&senderid=CARERR&route_id=2&Unicode=0&IP=x.x.x.x";
                bool success = false;
                // url = "";
                try
                {
                    var outn = 0;
                    WebRequest request = WebRequest.Create(url);

                    using (WebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                        Stream receiveStream = response.GetResponseStream();

                        using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
                        {
                            string line = readStream.ReadToEnd().Trim();
                        }
                    }
                }
                catch (Exception ex)
                {
                    // Response.Write(ex);
                    success = false;
                }
            }
            else
            {
                
            }
        }

        public void SendSMS_ForEnquiry(string mobile, string msg)
        {
            if (mobile != "" && msg != "")
            {
                var msg1 = msg;
                string url = "";

                //// url = "http://sms.mysmpp.com/rest/services/sendSMS/sendGroupSms?AUTH_KEY=26efc5d7dc16cd5877fc94e7152f88&message=" + msg + "&senderId=SBKUCH&routeId=1&mobileNos=" + mobile + "&smsContentType=english";
                //url = "http://digital.flyhibulksms.com/sendSMS?username=subkuch&message=" + msg + "&sendername=SBKUCH&smstype=TRANS&numbers=" + mobile + "&apikey=4d2f236c-76b4-4e40-af53-ee8ea6a1d742";
                url = "http://hindit.co.in/API/pushsms.aspx?loginID=T1CarrierCenter&password=NAVIN2JOSHIKA&mobile=" + mobile + "&text=" + msg + "&senderid=CARERR&route_id=2&Unicode=0&IP=x.x.x.x";
                bool success = false;
                try
                {
                    var outn = 0;
                    WebRequest request = WebRequest.Create(url);

                    using (WebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                        Stream receiveStream = response.GetResponseStream();

                        using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
                        {
                            string line = readStream.ReadToEnd().Trim();
                            //success = Int32.TryParse(line, ref outn);
                        }
                    }
                }
                catch (Exception ex)
                {
                    // Response.Write(ex);
                    success = false;
                }
            }
            else
            {
                //Response.Redirect("home_CompanyRegistration.aspx");
            }



        }



    }
}

TechEthical Mini WebShell Version 1.0, Coded By The_M@T3