-
Notifications
You must be signed in to change notification settings - Fork 2
/
Activation.aspx.cs
44 lines (43 loc) · 1.66 KB
/
Activation.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using MySql.Data.MySqlClient;
public partial class _Activation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
string activationCode = !string.IsNullOrEmpty(Request.QueryString["Activation_Code"]) ? Request.QueryString["Activation_Code"] : Guid.Empty.ToString();
using (MySqlConnection con = new MySqlConnection(constr))
{
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM User_Activation WHERE Activation_Code = Activation_Code"))
{
using (MySqlDataAdapter sda = new MySqlDataAdapter())
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("Activation_Code", activationCode);
cmd.Connection = con;
con.Open();
int rowsAffected = cmd.ExecuteNonQuery();
con.Close();
if (rowsAffected == 1)
{
ltMessage.Text = "Activation successful.";
}
else
{
ltMessage.Text = "Invalid Activation code.";
}
}
}
}
}
}
}