Repository navigation
Expand file tree
/
Copy pathresetpass.aspx.vb
More file actions
118 lines (103 loc) · 3.68 KB
/
Copy pathresetpass.aspx.vb
File metadata and controls
118 lines (103 loc) · 3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Imports System.Data.OleDb
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Partial Class resetpass
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If Trim(TextBox1.Text) = "" And Trim(TextBox2.Text) = "" Then
MsgBox(" Required Field user id or email missing")
TextBox1.Focus()
Exit Sub
End If
If Len(TextBox3.Text) <> 10 Then
MsgBox(" invalid mobile no ")
Exit Sub
End If
If IsNumeric(TextBox3.Text) = False Then
MsgBox(" Invalid mobile no ")
Exit Sub
End If
Dim c As Class1
c = New Class1
Dim smail As String
Dim ustr, ustr2 As String
Dim mobno As String
ustr = ""
smail = ""
c.connect()
If Trim(TextBox1.Text) = "" Then
c.sql = "select * from register where email='" & Trim(TextBox2.Text) & "';"
c.cmd = New OleDbCommand(c.sql, c.cn)
c.dr = c.cmd.ExecuteReader
If c.dr.HasRows = False Then
MsgBox(" email id does not exists ...")
Exit Sub
End If
While c.dr.Read
smail = c.dr("email")
End While
c.dr.Close()
c.cmd.Dispose()
Else
c.sql = "select * from register where usrname='" & Trim(TextBox1.Text) & "';"
c.cmd = New OleDbCommand(c.sql, c.cn)
c.dr = c.cmd.ExecuteReader
If c.dr.HasRows = False Then
MsgBox(" user id does not exists ...")
Exit Sub
End If
While c.dr.Read
ustr = c.dr("usrname")
End While
c.dr.Close()
c.cmd.Dispose()
End If
c.sql = "select * from register where mobno=" & Val(TextBox3.Text) & ";"
c.cmd = New OleDbCommand(c.sql, c.cn)
c.dr = c.cmd.ExecuteReader
If c.dr.HasRows = False Then
MsgBox(" Mobile No does not exists ...")
Exit Sub
End If
While c.dr.Read
mobno = c.dr("mobno")
ustr2 = c.dr("usrname")
End While
c.dr.Close()
c.cmd.Dispose()
Dim rno As Double
rno = CInt(Math.Ceiling(Rnd() * 1000)) + 1
'MsgBox(rno)
Dim newpass As String
newpass = ustr2 & rno
c.sql = "Update register set pass='" & newpass & "' where mobno=" & Val(mobno) & ";"
c.cmd = New OleDbCommand(c.sql, c.cn)
c.cmd.ExecuteNonQuery()
c.cmd.Dispose()
c.sql = "Update login set passwd='" & newpass & "' where usrname='" & ustr2 & "';"
c.cmd = New OleDbCommand(c.sql, c.cn)
c.cmd.ExecuteNonQuery()
c.cmd.Dispose()
c.disconnect()
'send sms
Dim sURL As String
Dim objReader As StreamReader
sURL = "http://apps.smslane.com/vendorsms/pushsms.aspx?user=aditicomforts&password=" _
& "233257&msisdn=91" & mobno & "&sid=SMSLane&msg=Hi " & ustr2 & " Your new Password to login GROCART :" & newpass & "&fl=0"
Dim sResponse As WebRequest
sResponse = WebRequest.Create(sURL)
Try
Dim objStream As Stream
objStream = sResponse.GetResponse.GetResponseStream()
objReader = New StreamReader(objStream)
Response.Write(objReader.ReadToEnd())
objReader.Close()
MsgBox(" Your new password sent to mobile no ... ")
Response.Redirect("default.aspx")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class