fork download
  1. #region Include Classes
  2. using System;
  3. using System.Threading;
  4. using System.Text;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Data;
  11. using MySql;
  12. using MySql.Web;
  13. using MySql.Data;
  14. using MySql.Data.Common;
  15. using MySql.Data.Entity;
  16. using MySql.Data.Entity.Properties;
  17. using MySql.Data.MySqlClient;
  18. using MySql.Data.MySqlClient.Authentication;
  19. using MySql.Data.MySqlClient.Properties;
  20. using MySql.Data.Types;
  21. #endregion
  22.  
  23.  
  24. namespace WebApplication1
  25. {
  26. public partial class Default : System.Web.UI.Page
  27. {
  28. private string tmpStr = String.Empty;
  29.  
  30. protected void Page_Load(object sender, EventArgs e)
  31. {
  32. try
  33. {
  34. tmpStr = HttpUtility.UrlDecode(Page.ClientQueryString);
  35. Response.Redirect("Cabinet.aspx", true);
  36.  
  37. if (tmpStr != String.Empty)
  38. {
  39. if (Page.Request.HttpMethod == "GET")
  40. {
  41. if (Page.Request.Params["method"] == "checkAuth")
  42. {
  43. string reqLogin = Page.Request.Params["username"].ToString();
  44. string reqPass = Page.Request.Params["password"].ToString();
  45. bool reqChecked = Convert.ToBoolean(Page.Request.Params["checked"].ToString());
  46.  
  47. MySQLGear mysqlObject = new MySQLGear();
  48. MySqlConnection mysqlConn = mysqlObject.CreateConnection();
  49. bool userExists = Convert.ToBoolean(mysqlObject.MakeScalar(ref mysqlConn,
  50. "SELECT COUNT(*) FROM `data_user` WHERE username='" + reqLogin + "' AND password='" + reqPass + "'"));
  51.  
  52. if (userExists)
  53. {
  54. Page.Response.Cookies.Add(new HttpCookie("sessionId", Guid.NewGuid().ToString()));
  55. Page.Response.Cookies.Add(new HttpCookie("clientIp", Page.Request.UserHostAddress.ToString()));
  56. Page.Response.Cookies.Add(new HttpCookie("timeAuth", DateTime.Now.ToString()));
  57.  
  58. Response.Redirect("Cabinet.aspx", true);
  59. }
  60. else
  61. {
  62. Page.ClientScript.RegisterStartupScript(GetType(), "", "showDialog('Error', 'You have encountered a critical error.', 'error', 2);", true);
  63. }
  64. }
  65. }
  66. else if (Page.Request.HttpMethod == "POST")
  67. {
  68.  
  69. }
  70. }
  71. }
  72. catch (ThreadAbortException)
  73. {
  74. // ignore it, because we know that come from the redirect
  75. }
  76. catch (Exception exc)
  77. {
  78. exc.ToString();
  79. }
  80. }
  81. }
  82. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty