-
Notifications
You must be signed in to change notification settings - Fork 2
/
VerifyMail.aspx.cs
66 lines (58 loc) · 2.27 KB
/
VerifyMail.aspx.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using MySql.Data.MySqlClient;
public partial class VerifyMail : System.Web.UI.Page
{
MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["constring"].ConnectionString);
MySqlCommand cmdmail,cmdentry,cmdfr;
protected void Page_Load(object sender, EventArgs e)
{
string uname,code;
uname=decodepwd( Request.QueryString["uid"]);
code=Request.QueryString["aucode"];
try
{
con.Open();
cmdmail = new MySqlCommand("update alumnireg set valid_mail=1 where username='" + uname + "' and auth_code='" + code + "'", con);
cmdmail.ExecuteNonQuery();
cmdentry = new MySqlCommand("update login set logentry=2 where username='" + uname + "'", con);
cmdentry.ExecuteNonQuery();
cmdfr = new MySqlCommand("update forum_users set group_id=4 where username='" + uname + "'", con);
cmdfr.ExecuteNonQuery();
}
catch (Exception ex)
{
CreateLogFile log = new CreateLogFile();
log.ErrorLog(Server.MapPath("Logs/Errorlog"), "Page_Load method of VerifyMail page :" + ex.Message);
}
finally
{
con.Close();
}
}
protected string decodepwd(string depas)
{
try
{
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(depas);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
string result = new String(decoded_char);
return result;
}
catch (Exception ex)
{
CreateLogFile log = new CreateLogFile();
log.ErrorLog(Server.MapPath("Logs/Errorlog"), "Decode method of VerifyMail page :" + ex.Message);
return "conversion error";
}
}
}