daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jun 24th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Net;
  8. using System.Data;
  9. using System.Data.SqlClient;
  10. using System.Collections.Specialized;
  11. using System.Text;
  12.  
  13. public partial class OTP : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         Panel2.Visible = false;
  18.     }
  19.  
  20.     protected void Button1_Click(object sender, EventArgs e)
  21.     {
  22.  
  23.         Panel1.Visible = false;
  24.         Panel2.Visible = true;
  25.         Random random = new Random();
  26.         int value = random.Next(1001, 9999);
  27.         string destinaddr = "65" + txtMobileNo.Text;
  28.         string message = "Your OTP Number is " + value + " ( Sent By : Unknown )";
  29.         sendSMS(destinaddr, value.ToString());
  30.     }
  31.  
  32.     public string sendSMS(string usernumber, string OTPCode)
  33.     {
  34.         String message = HttpUtility.UrlEncode("This is your OTP : " + OTPCode + ". This will expire in 30 seconds.");
  35.         using (var wb = new WebClient())
  36.         {
  37.             byte[] response = wb.UploadValues("https://api.txtlocal.com/send/", new NameValueCollection()
  38.                 {
  39.                 {"apikey" , "iM91uB/r99c-76KWeOLoMqbH2hRCwqgkdUsGeK0fo2"},
  40.                 {"numbers" , usernumber},
  41.                 {"message" , message},
  42.                 {"sender" , "OTP"}
  43.                 });
  44.             string result = Encoding.UTF8.GetString(response);
  45.             return result;
  46.         }
  47.     }
  48.  
  49. protected void Button2_Click(object sender, EventArgs e)
  50.     {
  51.         string OTP = txtOTP.Text;
  52.         if(OTP == txtOTP.Text)
  53.         {
  54.             Label1.Text = "Verified";
  55.         }
  56.         else
  57.         {
  58.             Label1.Text = "Incorrect OTP";
  59.         }
  60.     }
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top