472,121 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

Possible Cookie Usage?

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
Jun 27 '08 #1
5 930
In comp.lang.javascript message <MP************************@news.cox.net
>, Mon, 28 Apr 2008 10:06:05, Mike Copeland <mr*****@cox.netposted:
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.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Jun 27 '08 #2
Mike Copeland wrote:
* *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,

--
Bart
Jun 27 '08 #3
In article <MP************************@news.cox.net>,
mr*****@cox.net (Mike Copeland) wrote:
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
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.

--
My personal UDP list: 127.0.0.1, 4ax.com, buzzardnews.com, googlegroups.com,
heapnode.com, localhost, ntli.net, teranews.com, vif.com, x-privat.org
Jun 27 '08 #4
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

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".
Jun 27 '08 #5
In article <MP************************@news.cox.net>,
mr*****@cox.net (Mike Copeland) wrote:
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
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?
I have no way of knowing how your corporate intranet functions. You'd
use PHP or Perl or Ruby or whatever else is already in place to handle
the server side processing. If you're not the person in control of
that, you need to talk to the person who is. That is beyond the scope
of JavaScript, though. All that JavaScript can accomplish is to put a
more friendly interface on the web page (or possibly a widget/gadget)
that relays that information to the user.

--
My personal UDP list: 127.0.0.1, 4ax.com, buzzardnews.com, googlegroups.com,
heapnode.com, localhost, ntli.net, teranews.com, vif.com, x-privat.org
Jun 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.