Start a conversation

How to use the macro sc_encode

The macro sc_encode is a function create by Netmake. If you don’t want to use the macro, there is a PHP function called md5 that has a hash of 128 bits and has a similar effect as the macro.

On this tutorial we’ll show the difference between the macro and the PHP function, both displayed above. Then we’ll see how to insert in the database an encrypted field. 

Difference sc_encode x md5:

1. To display the difference, we created two applications, one Control and one Blank.

 

2. On the control application, we created a field named “password”. On the event onValidate, we have the following code:

3. The code displayed above there are two variables, $sc_var_cript and $md5_var_script, that receive the result of the functions that are used on the field password.

 

4. On the last line, we’ll see a macro called sc_redir, that’s being used to call the application blank passing two variables as global.

 

5. On the blank application, we have to following code on the event onExecute:

http://cdn1.netmake.com.br/img_kb/en_us/how_to_use_the_macro_sc_encode/img01.png

 

6. On the image bellow, you’ll see the result after we run the control application, we’ll insert a value in the field password, then we’ll click OK:

7. Inserting an encrypted field in the database:

 - We created a Form to insert a user, where we have a field is the type password, and we are using the event onBeforeInsert

 

This way from the moment your insert data to your database it will be encrypted.

 

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Amanda Santos (Migrated deleted Agent)

  2. Posted
  3. Updated

Comments