protected void Page_Init(object sender, EventArgs e) { try { // base bool mb = is_mobile(); this.head.Controls.Add(new Literal() { Text = @"<link href=""" + (mb ? "base-mobile.css?ver=1" : "base.css?ver=1") + @""" type=""text/css"" rel=""stylesheet"" />" }); __mobile.Value = mb ? "true" : "false"; // check user string u_name = ""; int u_id = -1; FormsIdentity id = (FormsIdentity)tlp.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; u_name = ticket.Name.Split(new char[] { '|' })[0]; u_id = int.Parse(ticket.Name.Split(new char[] { '|' })[1]); // check utente string u_email = ""; user.type_user u_tp = user.type_user.none; if (cry.encode_tobase64(u_name) == tlp.core.app_setting("ad-usr")) { u_email = cry.decrypt(tlp.core.app_setting("ad-mail"), "kokko32!"); u_id = 0; u_tp = user.type_user.admin; } else { DataRow dr = tlp.db_conn.first_row(@"select nome, email, isnull(activated, 0) as activated from users where nome = '" + u_name + "';"); if (dr == null || Convert.ToInt16(dr["activated"]) != 1) { tlp.log_out("login.aspx"); return; } u_email = dr["email"].ToString(); u_tp = user.type_user.normal; } tlp.set_user(u_id, u_name, u_email, u_tp); __utype.Value = u_tp.ToString(); // command txt_cmd.Value = this.cmd = tlp.qry_val("cmd"); // parameters _qvals = new Dictionary <string, string>(); foreach (string qs in Request.QueryString.AllKeys.Where(x => x != "cmd")) { _qvals.Add(qs, tlp.qry_val(qs)); } } catch { } }
public void set_user(int id, string user, string email, user.type_user tp) { _user = new user(id, user, email, tp); }