Your IP : 216.73.216.57


Current Path : C:/Inetpub/vhosts/yuksekkariyer.com/httpdocs/admin/
Upload Files:
Current File: C:/Inetpub/vhosts/yuksekkariyer.com/httpdocs/admin/Login.aspx.cs

using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
		// txtKullaniciAd.Attributes.Add("autocomplete", "off");
            if (Request.Cookies["UserID"] == null)
            {
                //Response.Redirect("Login.aspx");
            }
            else
            {
                Session["UserID"] = Request.Cookies["UserID"].Value;
                Session["UserNAME"] = Request.Cookies["UserNAME"].Value;
                Response.Redirect("Default.aspx");
            }
            pnlUyari.Visible = false;
            ltrMesaj.Text = "";
        }

    }

    protected void btnGiris_OnServerClick(object sender, EventArgs e)
    {
        using (OleDbConnection vt = new baglanti().baglan())
        {
            if (!string.IsNullOrEmpty(txtKullaniciAd.Text))
            {
                if (!string.IsNullOrEmpty(txtSifre.Text))
                {
                    vt.Open();
                    OleDbCommand cmd = new OleDbCommand("SELECT * FROM Login WHERE durum=true AND mail=@KULLANICIADI AND Parola=@SIFRE", vt);
                    cmd.Parameters.AddWithValue("@KULLANICIADI", Genel.cleanText(txtKullaniciAd.Text.TrimEnd().TrimStart()));
                    cmd.Parameters.AddWithValue("@SIFRE", Genel.cleanText(txtSifre.Text.TrimEnd().TrimStart()));
                    OleDbDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            pnlUyari.Visible = false;
                            ltrMesaj.Text = "";
                            var IDCookie = new HttpCookie("UserID", dr["id"].ToString());
                            var USERCookie = new HttpCookie("UserNAME", dr["kullanici"].ToString());
                            Session["UserID"] = IDCookie.ToString();
                            if (chkBeniHatirla.Checked)
                            {
                                IDCookie.Expires = DateTime.Now.AddDays(30);
                                USERCookie.Expires = DateTime.Now.AddDays(30);
                            }
                            Response.Cookies.Add(IDCookie);
                            Response.Cookies.Add(USERCookie);
                            Response.Redirect("Default.aspx");
                            vt.Close();
                        }
                    }
                    else
                    {
                        pnlUyari.Visible = true;
                        ltrMesaj.Text = "";
                        ltrMesaj.Text = "Kullanıcı Adı veya Şifre Hatalı !";
                        txtKullaniciAd.Text = "";
                        txtSifre.Text = "";
                    }
                }
                else
                {
                    pnlUyari.Visible = true;
                    ltrMesaj.Text = "";
                    ltrMesaj.Text = "Şifre Alanını Doldurunuz !";
                }
            }
            else
            {
                pnlUyari.Visible = true;
                ltrMesaj.Text = "";
                ltrMesaj.Text = "Kullanıcı Adı Alanını Doldurunuz !";
            }
        }
    }

    protected void btnSifremiUnuttum_OnServerClick(object sender, EventArgs e)
    {
            Response.Redirect("LoginSifremiUnuttum.aspx");
    }
}