-2

I have a project and I want to provide the installation code on the client so that the program can run. how to make the installation code using codeigniter ?. as well as the installation code on windows

thank you

AL FIKRI
  • 3
  • 1

1 Answers1

0

If you want your application to have some kind of codes which application users can use to install or get authenticated for any specific reason. You can create an array of hashes, store it in your database and distribute the code to your users. Read What is the best way to create a random hash/string?

Then

Create an interface in your application which accepts that code, matches it with database and authenticate or reply in success depending on the condition you want to use.

Explaination

Step-1

Create Database table;

hash_table (id(INT), hash(STRING), created_at(TimeStamp), updated_at(TimeStamp), expire(ENUM[Yes,No]))

Step-2

Create Hashes

Use any hashing algorithm to create random hashes, save them in the table above.

Step-3

Create View

Create a view with a form which accepts this hash, post that form to verify

Step-4

Verify

Create a Controller that accepts your post request, get the hash and send it to model function which verifies it from database and return true/false

Mudassar Khani
  • 1,469
  • 1
  • 20
  • 39
  • Thanks for the comments. Actually I am new in using the codeigniter framework. How does it work ?. whether to create a library or helper? – AL FIKRI Aug 30 '17 at 06:29
  • I won't suggest creating library for that, its an overdo. just make a helper function which creates a hash and stores it in db. you can have multiple hashes/or codes whatever u want to name them or you can have one hash/code for one user. – Mudassar Khani Aug 30 '17 at 06:34
  • if you want to create single code for one user , you can have an expiry field in the database table which you can use as toggle to expire the code once used. – Mudassar Khani Aug 30 '17 at 06:35
  • thanks, but how is the application in helper? whether made first hashing. example: password_hash for db and password verify for helper. What do you think ? – AL FIKRI Aug 30 '17 at 06:45
  • thanks, I'll give it a try. if it is already running well. I will give the demo. Once again, thank you – AL FIKRI Aug 30 '17 at 07:11