1 (edited by AD1408 2023-09-15 15:44:48)

Topic: Protecting Image with Password

Hi All,


I was trying to protect images with password using K245 script - (I think). However, no success. I even couldn't correct If else stm.
I used a panel for covering image if password assign to it. Alternatively, total blur of the image instead of panel but I have no idea about it.
Could somebody help please...
Sample project attached:

Post's attachments

Attachment icon ImagePw.zip 79.88 kb, 50 downloads since 2023-09-15 

Adam
God... please help me become the person my dog thinks I am.

Re: Protecting Image with Password

Hi Adam,
Any reason why you don't want to use the standard 'roles' functionality?
Derek.

3 (edited by AD1408 2023-09-15 16:48:09)

Re: Protecting Image with Password

Hi Derek,
Thanks for the suggestion.
My thinking was app open to all (no users or passwords)  but certain images are passw protected. Image passwords would be assigned by whoever adds the record - if needed. Perhaps there is much better way doing it but I'm stuck.

Adam
God... please help me become the person my dog thinks I am.

Re: Protecting Image with Password

??????

if (Form1.CheckBox1.Checked = True) and (Form1.edPassword.Text = DecryptRC5( GetStrIni('USER','Password'), 'Enigma')) then
begin
Form1.Panel1.Visible := True else Form1.Panel1.Visible := False;
Form1.btnEdit.enabled := True else Form1.btnEdit.enabled := False;
end;

 

Where did you take the example?

Re: Protecting Image with Password

pavlenko.vladimir.v wrote:

??????

if (Form1.CheckBox1.Checked = True) and (Form1.edPassword.Text = DecryptRC5( GetStrIni('USER','Password'), 'Enigma')) then
begin
Form1.Panel1.Visible := True else Form1.Panel1.Visible := False;
Form1.btnEdit.enabled := True else Form1.btnEdit.enabled := False;
end;

 

Where did you take the example?

-----

In your quote:

(Form1.edPassword.Text = DecryptRC5( GetStrIni('USER','Password'), 'Enigma'))

The part with slight difference taken fro the following thread:
https://myvisualdatabase.com/forum/view … hp?id=8202

Adam
God... please help me become the person my dog thinks I am.

Re: Protecting Image with Password

procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
begin
  if (SQLExecute('SELECT passwordtwo FROM Items WHERE id='+Form1.TableGrid1.sqlValue)= StrToMD5(Form1.edPassword02.Text)) then
     Form1.Panel2.Visible := False else ShowMessage('No');
end;

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  if (SQLExecute('SELECT passwordone FROM Items WHERE id='+Form1.TableGrid1.sqlValue)= StrToMD5(Form1.edPassword.Text)) then
     Form1.Panel1.Visible := False else ShowMessage('No');
end;

procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
  if (SQLExecute('SELECT imgPassw FROM Items WHERE id='+Form1.TableGrid1.sqlValue)='1') then
     Form1.Panel1.Visible := True else Form1.Panel1.Visible := False;
  if (SQLExecute('SELECT imgPassw02 FROM Items WHERE id='+Form1.TableGrid1.sqlValue)='1') then
     Form1.Panel2.Visible := True else Form1.Panel2.Visible := False;
  Form1.DBImage1.Clear;
  Form1.DBImage2.Clear;
  Form1.DBImage1.LoadFromDatabase('Items','img01',Form1.TableGrid1.dbItemID);
  Form1.DBImage2.LoadFromDatabase('Items','img02',Form1.TableGrid1.dbItemID);
end;

procedure changePassword (Sender: TObject);
begin
  if (TdbEdit(Sender).Text <> '') then TdbCheckBox(frmItems.FindComponent(TdbEdit(Sender).Hint)).Checked := True
  else TdbCheckBox(frmItems.FindComponent(TdbEdit(Sender).Hint)).Checked := False;
end;

procedure changemd5 (Sender: TObject);
begin
  if (TdbEdit(Sender).Text <> '') then TdbEdit(frmItems.FindComponent(TdbEdit(Sender).Hint)).Text := StrToMD5(TdbEdit(Sender).Text)
  else TdbEdit(frmItems.FindComponent(TdbEdit(Sender).Hint)).Text :='';
end;
Post's attachments

Attachment icon ImagePw.rar 235.43 kb, 57 downloads since 2023-09-15 

Re: Protecting Image with Password

Thank you very much for your kind help pavlenko.vladimir.v.............
Truly appreciated............
I'll study and work on it.

Adam
God... please help me become the person my dog thinks I am.