Click on a thumbnail and it shows the large photo + a photo caption. I made this years ago for a client but never posted it on my site. I just remembered it, so here it is.
This JavaScript tells you the HEX code of a colour that you select from a visual pallette of web safe colours which are good to use for cross-platform uniformity. To download the script, view source once you click on the download link.
This simple JavaScript allows you to pick a web page from a drop down menu and your browser will take you there. The nice thing with this script is that you do not have to include a "submit" button. The new page will just load once you let go of the menu. To download the script, view source once you click on the download link.
This JavaScript tells you number of available RAM slots, maximum RAM and how to upgrade the RAM in Apple Power Macintosh computers. Very easy to add newer or older models.
This very simple JavaScript reads your browser's history and sends you back one page when you click on the link. This is useful for a page that is low down on a multi-link tree and you can't be certain where the page was accessed from. You can easily modify the script to send the user back more than 1 page.
Fill out a form, and it gets emailed! Unlike other scripts of this kind, this script hides the email address that the email will go to, to stop spam bots from picking up your email address off your web site.
This hack to the open source cgi shopping cart system web_store allows you to charge multiple taxes for your items depending on where the person is buying from. Handy if you need to calculate federal taxes and only sometimes provincial taxes. Ideal for Canadian, British, & New Zealand stores or other countries that rip their citizens off with ridiculous taxes.
Same as above, but for Commerce.cgi. I didn't find this one on any of my CDs at home, but I originally created this for work, and know for certain it's on a CD at work, so I'll grab it there. In the meantime, you can find other people copied my code (without credit) on the support forum at the Commerce.cgi site. It should work too, although I never tested their syntax.
Again, this is on a CD at work, but Extropia does have it listed under their Cool Hacks section - properly credited. Here's the link to the hack.
How-to: Setup a chroot jail for your FTP users
This How-to will explain how to restrict your FTP users to their
home directory, so they won't be able to look at any directories
higher than their own.
Launch Terminal (in Applications -> Utilities)
type: cd /etc
sudo pico ftpchroot
Type the valid usernames of people in this file that you want to be restricted to their own directory when they FTP into their machine. Separate each entry by a carriage return. This file will look simply like this:
ebunny
sclaus
tfairy
Then save the file by holding down the Control key and hitting X. This will create the file ftpchroot in the /etc directory.
Now restart your FTP server by turning it off then on again in your Sharing Control panel. Done!
*UPDATE: The ftp server in 10.2 has the chroot feature broken. If you want to still use the built-in ftp server, you'll have to recompile it from source. Here's how:
How-to: Password protect Apache folders
This How-to will tell you how to get Apache to prompt your users
for a username & password when they try and look at a directory
you've secured.
As with all things Apache, start by editing the configuration file. This is in /private/etc/httpd
Launch a terminal.
Type: cd /private/etc/httpd
Type: sudo pico httpd.conf
(You can use a different text editor if you wish, other than pico).
Scroll down until you reach the AuthConfig section. It will look like this:
# This controls which options the .htaccess files in directories
can
# override. Can also be "All", or any combination of "Options",
"FileInfo",
# "AuthConfig", and "Limit"
AllowOverride None
Change that last line to:
AllowOverride AuthConfig
Save the httpd.conf file. If you're using pico, this is done by holding down control and hitting x.
Now, back in the terminal, type:
sudo htpasswd -c .htpasswd username
The username can be named what you like. For example, if you want people to be prompted for the username "friend" you would enter friend instead of username.
This command will also prompt you for the password you want to use.
Now in the terminal, type: cd /Library/WebServer/Documents/DirectoryYouWannaSecure
Substitute "DirectoryYouWannaSecure" for the name of the folder you want people to have to type in a username & password to access. Or substitute the path to your own user's Sites directory.
In the terminal, type: sudo pico .htaccess
(again, you can use a different text editor than pico if you wish).
In the .htaccess file you just created with pico, paste this:
AuthUserFile /private/etc/httpd/.htpasswd
AuthGroupFile /dev/null
AuthName "Members Only"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
Save this file. Again control-x if in pico.
Restart Apache: sudo apachectl restart (or turn it off & on with the button in your Sharing control panel)
Now when you go to http://localhost/DirectoryYouWannaSecure you'll be asked for a username & password!
How-to: password protect symbolic links through Apache
NOTE: the proper and most secure way to serve from a directory that Apache does not normally serve from is not to create symbolic links as described below, but instead to use Apache's built-in Alias feature. Here's how to do that:
Say you want to share your Music folder inside your home user's folder at http://localhost/music Well to do this, launch Terminal and type:
I've left the symbolic link directions below here, as I've been told that some people have problems using Apache's Alias directive when trying to link to different volumes. While I think that may be an ownership or permissions problem, here is my old directions if you prefer this method:
First (in case you haven't created the symbolic link), bring up a terminal. Type in the terminal:
ln -s /Users/username/Music /Library/WebServer/Documents/Music
Modify first path above to the directory you actually want accessible in your web site. Modify the second path if you prefer to serve it out of your own /Users/username/Sites/Music (for example). This is the directory you'd create your .htaccess file in, as described in the first post in this thread.
You'll have to give Apache permission to read the folder that you've symlinked to, so type:
sudo chmod o+x /Users/username/Music
(of course substitute the path above to match the directory you
want to serve)
Now to protect that directory:
In terminal type:
cd /private/etc/httpd
sudo pico httpd.conf
Scroll down until you see a section that reads this:
# Control access to UserDir directories. The following is an
example
# for a site where these directories are restricted to
read-only.
Add these lines:
<Directory "/Library/WebServer/Documents/Music">
AllowOverride AuthConfig
</Directory>
Save the file, restart Apache.
Now when you go to http://localhost/Music you'll be prompted for your username & password and taken into your /Users/username/Music directory through Apache!