Joel Francisco geek stories and photography misadventures

16Oct/080

Lightbox JS

Ever wondered how thumbnail pictures when clicked turns the whole background dark and the picture appears with a fade , transforming effect while the picture grows to its bigger size??? Then you are looking for a Lightbox JS DHTML! It has been around for a while and has been used  by alot of web designers already.

To know more about it visit DynamicDrive.com at this URL:

http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm

17Jul/080

Password Protect a page using .HTACCESS

This is not actually a PHP code or command but since you have reached this article it simply means you are into PHP Programming.........and since Apache is THE webserver mostly used for open source web programming then might as well put this article on the PHP Basics Category.

So you want the easiest way to password protect your pages or perhaps the whole web folder by giving someone a username and a password to access a certain content or a web page. Ok so what do you need??

1. Make sure your using Apache Web Server (im not sure if this works in IIS)
2. .htaccess file (should be located in the folder where the pages you want to protect is)
3. .htpasswd file (should be located somewhere in the webserver, just so you know where you saved it)

STEPS:

1. Create a .htaccess file or htaccess.txt (since you might have some problems when doing this with MS Windows)
2. Put this in your .htaccess file:

AuthName "LOGIN WINDOW NAME"
AuthType Basic
AuthUserFile /folderwhereyourpasswordislocated/.htpasswd
require valid-user

3. Edit 1st line with whatever you want to call it
4. Edit 3rd line where the .htpasswd will be located (which is somewhere in your web server). Dont change anything anymore on the .htaccess file
5. Upload the .htacess file or your htaccess.txt on your web server where you want to password protect a page (e.g. /public_html/secretpage/)
6. In case you save it to htaccess.txt Rename htaccess.txt to .htaccess using your favorite ftp application (usually you highlight it, right click, then rename) . If not go to Step 7.
7. Create your .htpasswd file or htpasswd.txt
8. Generate the .htpasswd contents by going here: http://www.advancehost.com/htpasswd.html or look for HTPASSWD GENERATOR in Google
9. Fill the form and click submit
10. It will have something like this: (i entered username: user password: pass)

Success!

Here is your crypted password. Copy and paste the output to your htpasswd file:

user:pauONM/HSu9pM (this is just an example)

11. Copy/paste user:pauONM/HSu9pM to .htpasswd then save
12. Upload .htpasswd to the location you put on step no. 4
13. Test it! Voila your page is protected!

17Jul/080

PHP Redirect Page

Been busy lately. But I would just like to share some useful PHP basics (to all wannabe nerds out there) and also to make this site a little more useful to others, that is why i have a new category just for this epiphany. Ok here we go:

PHP: How to Redirect a Page (to somewhere other than that page)

Just put this code before the <html> tag and edit the blue colored text as you like:

<?php

header( 'Location: http://www.domain.com/new_page.html' ) ;

?>

We usually redirect a page if we just don't want it to go to the page where its suppose to go.....weird... anyway i find it very useful.
Cheers!

Random Snaps

Gawad Kalinga - Shoot & Shelter Gawad Kalinga - Shoot & Shelter DSC_0538.jpg DSC_0378.jpg DSC_0561.jpg DSC_0553.jpg DSC_0071.jpg Dubai Festival City Night Shoot

Blogroll

Archives

Categories

RSS Tekzilla!

New Tag Cloud