Possible Cookie Usage?

M

Mike Copeland

In a Web site I'm building, I want to provide an ability to set a
"flag" message that users can see when they log on. Specifically, I
want the "flag" to show when the (snail) mail for our building has been
delivered, so people can come to the mailboxes to pick up their incoming
mail.
The problem is that I want to have a staff person "set the flag" in
some way. This person won't be technically savvy, nor would I want to
give them security permissions that their mistake could damage the site.
I also can't do the flag setting myself, as I won't always be available
at the time it's needed.
An initial thought I had was to use cookies: one that the staff
person could set and that my Web code could interpret and display. The
latter part seems simple enough, but I don't know how (or if) another
user could set the flag (in a cookie or file) and have the communication
work. That is, have the Web code access a cookie (or simple file) on a
specific user's (the staff person's) computer. In such a scenario, the
staff person would run a program or access a Web interface that would
write to a file (a cookie?) and the building's web site code would read
that information and report on it.
If this is possible, I don't quite know how to implement it. I
assume it's a simple JavaScript cookie reading activity, but I don't
know how to get that staff person's activity to write the file and where
it'd be stored. Any thoughts? TIA
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
, Mon, 28 Apr 2008 10:06:05, Mike Copeland <[email protected]> posted:
In a Web site I'm building, I want to provide an ability to set a
"flag" message that users can see when they log on. Specifically, I
want the "flag" to show when the (snail) mail for our building has been
delivered, so people can come to the mailboxes to pick up their incoming
mail.
The problem is that I want to have a staff person "set the flag" in
some way. This person won't be technically savvy, nor would I want to
give them security permissions that their mistake could damage the site.
I also can't do the flag setting myself, as I won't always be available
at the time it's needed.

You could maybe use a VBScript or JavaScript program running on their
machine under WSH, with buttons for "Mail has come" and "No it hasn't",
each of which invokes an FTP to upload an Include file which contains
either
var MailHere = true
or var MailHere = false
so that when they load a page it is customised by that.

Even better, you could give the staff person a compiled program that had
the FTP built in (I suppose you're defending against incompetence or
meddling, and not against skilled malice).

For a single daily delivery, code can clear the state at midnight; for
multiple deliveries it might be better to send the day's set of actual
delivery times.
 
B

Bart Van der Donck

Mike said:
   In a Web site I'm building, I want to provide an ability to set a
"flag" message that users can see when they log on.  Specifically, I
want the "flag" to show when the (snail) mail for our building has been
delivered, so people can come to the mailboxes to pick up their incoming
mail.
   The problem is that I want to have a staff person "set the flag" in
some way.  This person won't be technically savvy, nor would I want to
give them security permissions that their mistake could damage the site.  
I also can't do the flag setting myself, as I won't always be available
at the time it's needed.
   An initial thought I had was to use cookies: one that the staff
person could set and that my Web code could interpret and display.  The
latter part seems simple enough, but I don't know how (or if) another
user could set the flag (in a cookie or file) and have the communication
work.  That is, have the Web code access a cookie (or simple file) on a
specific user's (the staff person's) computer.  In such a scenario, the
staff person would run a program or access a Web interface that would
write to a file (a cookie?) and the building's web site code would read
that information and report on it.
   If this is possible, I don't quite know how to implement it.  I
assume it's a simple JavaScript cookie reading activity, but I don't
know how to get that staff person's activity to write the file and where
it'd be stored.  Any thoughts?  TIA

I'm not sure how this could be solved with cookies.

Admin page:

Set flag: <select name="flag" size="1">
<option value="true">true</option>
<option value="false">false</option>
</select>
<input type="submit">

Then use your favourite server-side langue to receive the form data
and store it in a file.

User pages could then perform an XMLHttpRequest to that file. If it
holds 'yes', then show the mail-icon in question.

Hope this helps,
 
M

Mike Copeland

If this is possible, I don't quite know how to implement it. I
If I read the problem right, the easiest solution is a simple timestamp.
Give the person in the mail room access to a trivial CGI (could be just
touching a file) that refreshes a master value, and that value is
supplied with the web interface. You can certainly add a JavaScript
cookie to compare the supplied value with the last stored value and add
some fancy notification if there's a change. It is slightly more tricky
if you want to give notification for individual mailboxes, but the basic
approach is the same.
Yes, that could do the job. However, how does the timestamp/flag get
"transmitted" to the Web site interface? That is, I could write a small
application that "touches" a file, but where does such a file reside to
have it accessible by my HTML/Javascript/CSS code that resides on the
server host? How would my code know where that file is, and how does it
interrogate it to find its timestamp?
No, I don't need to deal with specific mailboxes, because the mail is
delivered to the building once/day...but the times vary so much I am
trying to implement this interface to avoid the many calls to the Front
Desk that now occur. It's the Front Desk person who knows when the mail
has arrived and can "set the flag".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top