Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Saving User Configuration for webpage?

Featured Replies

Hi guys, totally new here! Although i wish i found you lot earlier!

 

Im working on a project which is work related and i have this really good idea but i just cant seem to find the way to implement it, so im hoping some one can point me in right direction! :)

 

Basically, my team will be using this webpage for work and i have made it customisable, so they are able to move things around the page, and also change colours and names of the boxes that are being displayed on the page...

 

However my next hurdle is, how do I save the layout / configuration that the user has set for the page? So each time they come back its exactly how they left it, which assuming, will be the way they want it?

 

Im really stuck on this, maybe some one can shed some light.

 

Thanks in advance! :)

 

Aaron

  • Author

There is no log in required for this page, its it just accessed by entering the address on the local server. When you say local storage how do you mean?

 

Is cookies an option?

If there's no login then you've got two options, cookies or IP tracking.

 

With the cookies option it's fairly straightforward, just store the data you need in the cookie. Bear in mind the user will lose all the info if they delete the cookie, change machine, or if the cookie expires, and it won't work at all if cookies are turned off.

 

You could also use the IP, detect the users IP and then look it up in a flat file or database which contains all of the data against a list of IP addresses. This won't work if people connect from multiple IPs, different machines, from behind a dynamic IP etc etc. Frankly, it's probably going to be pretty unreliable.

 

A very simple login would be my choice, if it's only for user preferences then it doesn't need to be particularly complicated, just a database or flat file with usernames, hashed passwords and preference data. (You probably don't even need to hash the passwords, but it's good practice).

  • 2 weeks later...
  • Author

Thank you all for your comments and suggestions. I have tried cookies and it works as we want! Which IS GREAT

 

Also had an idea about letting the user save and download a configuration file of their settings for the page, i know its possible but cant find out how to do it.

 

I am still going to use cookies, because that will remember the last session, but the idea behind a config file is to enable the user to save a different configuration for every layout that suits the project they are working on. They will be then be able to upload the file when they want to load the configuration they saved.

 

Has anyone got any idea about how configuration files work?

 

Thanks in advance

Aaron

Yup, that would be very easy, just create the file (PHP has a collection of commands for working with files, fopen() fwrite() etc) and give the user a link to it, then make another form which allows them to upload a saved file.

 

Frankly though, it's just as easy to write a very basic login with config details saved alongside username and password, and probably less hassle for the user.

  • Author

Thanks for that T-G! I appreciate your help.

 

I understand what you mean about a log in, but ive had discussions with my line manager and he says that logging in every time a user wants to use the tool is useless, The current tool has no log in, but my idea would benefit from a log in quite obviously. Im doing a placement year at a very large company and this idea will be implemented to the current tool and it will be used by quite a few hundred people! So you can the problem i am faced with.

 

Do you have any more information on the creation of a PHP config file at all?

 

Cheers

 

Al

I'd honestly go with a login if I were you, by far the simplest and most robust system.

 

Two ways to do it, either with files or a database. With the file version you use a file to store the data, eg:

 

(name,hashed-password, config options)

 

dave,482c811da5d5b4bc6d497ffa98491e38,bg-color=#ff0000,font-size=1em

pete,db6ae64dfa9e78039db6df5b8edbc38c,bg-color=#000000,font-size=2em

etc.....

 

Then you use whichever language (I'd use PHP) to ask for login details, then load the file, then go through each line looking for a name that matches the login name.

 

When you've got that, perform a hash on the password they gave you (I'm using MD5 with no salt for this example, it's not a secure method), and compare that to the hash you have stored (eg if the user 'dave' gives "password123" then the hash you make will match the hash in the file, so you know it's right but you don't need to store the password itself, which is good for security.

 

Once you've got that far you can simply extract the config options from that line of the file.

 

With a DB approach it's much the same, but you're loading a row from a database instead of loading it from a plain text file.

 

If all of this is still too confusing then you probably need to drop back a step and learn a little more about your chosen language.

 

(Cross-posted to your thread, others may find it useful too)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.