English 中文(简体)
Block Websites Under Certain Conditions
原标题:
  • 时间:2009-11-20 01:08:22
  •  标签:
  • web

I d like to create a simple program that will block certain websites for the user under certain conditions (e.g. after 7:00pm if homework is due the next day). This would be just a programming exercise for myself/for self discipline, so it would not have to support passwords or any other security. It need only be very basic. What language would you recommend using for this project, and how might I go about doing it? I m a beginner Java programmer, and know the very basics of C++, although I think this is a scripting language type project. Any suggestions?

最佳回答

The only bomb-proof way you do this is to build a proxy HTTP server that implements the website access policies that you want to enforce. This typically needs to run on a separate machine for that the user cannot disable it. Then you configure your network firewalls so that the user s machine cannot access remote HTTP servers directly, but has to use your proxy server.

This is probably not a programming problem. Rather you need to find some existing proxy server that can implement the kinds of policies that you want, install it, configure it and configure your firewall and browser web-access.

EDIT : if you are doing this to impose discipline on yourself, the easy way would be to write an Proxy Auto-config file that sends you to some page like this.

问题回答

There is no such simple program. You are writing one program, the browser is another. You can t write a program outside the browser that reaches in and does this sort of thing. You can write plugins: one for IE, one for FireFox, one for Opera. And then you have to convince your User/Victim to install it/them.

If you are on Windows, you can create two copied of c:windowssystem32driversetchosts. Make one copy your original, and to the second one, add entries the site you d like to restrict:

127.0.0.1 stackoverflow.com

Next, create two scheduled tasks. One to replace hosts with the original file and the other one to replace hosts with your restricted file.





相关问题
Block Websites Under Certain Conditions

I d like to create a simple program that will block certain websites for the user under certain conditions (e.g. after 7:00pm if homework is due the next day). This would be just a programming ...

Looking for a good exercise in building a website

I d like to learn how to build a website, say using .Net (Monorail comes to mind). I d like a pet project, something that: Will take a fair yet reasonble amount of time I can I can build on my own ...

Recoding a Podcast Website - What should I use?

OK here is the deal. Me and some buddies are doing a Podcast(for over 4 year now) and in April we relaunched the site, that included a new Backend. Since I only had 2 weeks back then for getting ...

Cache And Compare Files In C#

Ok, I m trying to make an application for an online Radio Station. I have it set to read the song title and artist and write it to a text file on the webserver. I want to have the application store ...

How does Drupal provide an edit/review/publish model?

How does Drupal support a means to update and review a website before it is published? Does it only allow you to preview a page at a time before you publish it or is there a way to create a site ...

热门标签