Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/26/25 in all areas

  1. Angus Robertson

    Blocking hackers

    ICS has a component TIcsBlackList that can be used by servers to count access attempts by IP address, and block after a specified number of attempts until after several hours of inactivity. It's use is illustrated in the OverbyteIcsSslMultiWebServ sample. Just noticed these lines in the log for one of my web servers, someone using Alibaba Cloud in Hong Kong has made almost three million access attempts to my web site over several weeks, trying to read access data that is limited to 50 accesses per day. And still trying despite those requests being rejected. 47.76.209.138 attempts 1,481,269, first at 12:18:52, last at 20:00:17 BLOCKED 47.76.99.127 attempts 1,478,638, first at 12:04:36, last at 19:58:57 BLOCKED Should really be reporting the date of first access, but don't normally see hackers continuing this long. The sample shows various ways to detect hackers, such as web site access by IP address instead of host name, that stops hundreds daily on my sites (no HTTP allowed). Angus
  2. Update: the old convertor (9 years old) was brought up to date. This is the major update! It has: True unicode support! Fixed bugs Better file handling Smaller code English instead of spanish There is plenty of room for optimizations. I will try to update it as necessary. (Precompiled exe file available) PS: does anyone know how to reduce its size? It is 10MB!
  3. bravesofts

    How to open form2 then close form1

    hidding instance of TForm1 doesn't mean is closed!! --- Creating a Form2 instance without an owner by passing nil in Create(nil) can lead to a memory leak if an exception occurs!! The code lacks proper cleanup for Form2. A better practice is to use a try..finally block to ensure Form2 is freed, even if an exception occurs. Form2 := TForm2.Create(nil); try Form2.ReceivedValue := TButton(Sender).Caption; Form2.Position := poScreenCenter; Form2.ShowModal; finally Form2.Free; end; When Form1 is the main form, closing it will terminate the entire application. To handle this scenario while still achieving the desired behavior (hiding Form1 and showing Form2 modally), you can modify the code as follows: Avoid Global Form Variables: Avoid using Form2 as a global variable unless necessary. Use local variables whenever possible: Updated Code with Form1 as MainForm: procedure TForm1.Button1Click(Sender: TObject); var LNewForm2: TForm2; begin // Hide the MainForm (Form1) Self.Hide; try // Create and display Form2 LNewForm2 := TForm2.Create(nil); try LNewForm2.ReceivedValue := TButton(Sender).Caption; // Pass value to Form2 LNewForm2.Position := poScreenCenter; if LNewForm2.ShowModal = mrOk then begin // Show Form1 again if Form2 was accepted Self.Show; end else begin // Handle Cancel logic (if needed) Self.Close; end; finally LNewForm2.Free; // Ensure Form2 is freed end; except on E: Exception do begin // Show the MainForm back if any exception occurs Self.Show; raise; // Re-raise the exception end; end; end;
  4. Remy Lebeau

    How to open form2 then close form1

    That is not quite accurate. Yes, the app will terminate if the MAIN Form is closed. But the FIRST Form does not need to be the MAIN Form. The MAIN Form is the first Form created with TApplication.CreateForm(). But you do not need to use CreateForm() to create and show a Form. It is possible to show a Form before the MAIN Form is established.
×