On a mac, the ethernet port is called en0 and the wifi port en1.
You can verify this by going to System Preferences -> Network then, selecting Ethernet, clicking Advanced then looking at the Ethernet tab - this will tell you the mac address. Do the same but select Airport to get the mac address of the wifi port.
Then in a terminal type ifconfig to get a list of network interfaces, that will show you the interface name for each interface (en0, en1, etc), and a load of other information, including the mac address which is labelled 'ether'.
Once you know what the names are of the interfaces, you can set up cron jobs to disable them as described by Amardeep. - use en0 instead of eth0, and repeat for the wifi port.
2Unplug your cable, or simply shut down the machine man. It's not that hard. – user229044 – 2010-06-12T03:32:57.227
1This can also be a setting on your router. – Zurahn – 2010-06-12T03:34:45.417
6It is impossible.
If you have admin access to computer, you can't block yourself out - no matter what kind of block you install, you will be able to remove it yourself. And you will do it, thinking something like "just five more minutes".
You'll have to improve self-control. Or get a girlfriend. Either way will work better than cron job. – None – 2010-06-12T04:10:37.940