using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using System.Data;
using System.Configuration;
public partial class _default : System.Web.UI.Page
{
MySqlConnection con;
MySqlDataAdapter adp;
protected void Page_Load(object sender, EventArgs e)
{
con = new MySqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
if (!Page.IsPostBack)
{
SignIn s = new SignIn(Session, Request, Response);
s.DefaultSignIn();
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataTable dt2 = new DataTable();
adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
Session["CCS"] = dt;
if (chkRemember.Checked == true)
{
Response.Cookies["CCS"].Value = txtUserName.Value;
Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
}
Response.Cookies["CCSi"].Value = txtUserName.Value;
Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);
adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
adp.Fill(dt2);
if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
{
Response.Redirect("PassUpdate.aspx");
}
else
{
Response.Redirect("home.aspx");
}
}
else
Alert.Show("Invalid combination of username or password");
}
protected void btnLogin_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataTable dt2 = new DataTable();
adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
Session["CCS"] = dt;
if (chkRemember.Checked == true)
{
Response.Cookies["CCS"].Value = txtUserName.Value;
Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
}
Response.Cookies["CCSi"].Value = txtUserName.Value;
Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);
adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
adp.Fill(dt2);
if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
{
Response.Redirect("PassUpdate.aspx");
}
else
{
Response.Redirect("home.aspx");
}
}
else
Alert.Show("Invalid combination of username or password");
}
protected void btnLogin_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataTable dt2 = new DataTable();
adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
Session["CCS"] = dt;
if (chkRemember.Checked == true)
{
Response.Cookies["CCS"].Value = txtUserName.Value;
Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
}
Response.Cookies["CCSi"].Value = txtUserName.Value;
Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);
adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
adp.Fill(dt2);
if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
{
Response.Redirect("PassUpdate.aspx");
}
else
{
Response.Redirect("home.aspx");
}
}
else
Alert.Show("Invalid combination of username or password");
}
protected void btnLogin_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataTable dt2 = new DataTable();
adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
Session["CCS"] = dt;
if (chkRemember.Checked == true)
{
Response.Cookies["CCS"].Value = txtUserName.Value;
Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
}
Response.Cookies["CCSi"].Value = txtUserName.Value;
Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);
adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
adp.Fill(dt2);
if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
{
Response.Redirect("PassUpdate.aspx");
}
else
{
Response.Redirect("home.aspx");
}
}
else
Alert.Show("Invalid combination of username or password");
}
}
09 October, 2012
Test post 2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment