daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jun 8th, 2017 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. #assembly System.Windows.Forms.dll
  4. #include ...\urlhelp.cs
  5. #include ...\inifiles.cs
  6. #include ...\databaselink.cs
  7.  
  8. */
  9.  
  10. using System;
  11. using System.IO;
  12. using System.Windows.Forms;
  13.  
  14. public partial class Website
  15. {
  16.     public static bool SafeString(string Query)
  17.     {
  18.         string unsafestr = "<>[]%$#@!^&*()-=~`/\'\"";
  19.         foreach (char c in Query)
  20.             if (unsafestr.Contains(c.ToString()))
  21.                 return false;
  22.         return true;
  23.     }
  24.     public static string Redirect(string url)
  25.     {
  26.         return "<script language='JavaScript'> window.location='" + url + "'; </script>";
  27.     }
  28.     public static string WebRequest()
  29.     {
  30.         string DatabasePath = GenerateDatabase() + "\\Accounts\\";
  31.         string Username = URLHandler.GetField("username");
  32.         string Password = URLHandler.GetField("password");
  33.         string Query = URLHandler.GetField("query");
  34.         if (Query == "")
  35.         {
  36.             if (Username != "" && Password != "")
  37.             {
  38.                 if (Username.Length < 16 && Password.Length < 16)
  39.                 {
  40.                     IniFile ini = new IniFile(DatabasePath + Username + ".ini");
  41.                     if (File.Exists(ini.FileName))
  42.                     {
  43.                         return Redirect("/Register.cs?Query=This account already exists.");
  44.                     }
  45.                     else
  46.                     {
  47.                         ini.WriteString("Account", "Username", Username);
  48.                         ini.WriteString("Account", "Password", Password);
  49.                         ini.WriteString("Character", "Name", "INVALIDNAME");
  50.                         DirectoryInfo info = new DirectoryInfo(DatabasePath);
  51.                         ini.WriteString("Character", "UID", 1000000 + info.GetFiles().Length);
  52.                         return Redirect("/Register.cs?Query=Your account has been created.");
  53.                     }
  54.                 }  
  55.                 else
  56.                 {
  57.                     return Redirect("/Register.cs?Query=Username or Password is too long, 15 characters at maximum.");
  58.                 }
  59.             }
  60.             return Redirect("/Register.cs?Query=A username or password cannot be blank.");
  61.         }
  62.         if (SafeString(Query))
  63.             return Query;
  64.         return "error";
  65.     }
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top