Skip to content

Instantly share code, notes, and snippets.

@dsummersl
Created February 17, 2013 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsummersl/4969808 to your computer and use it in GitHub Desktop.
Save dsummersl/4969808 to your computer and use it in GitHub Desktop.

Granny's Addressbook

Installing necessary software

This application will require the use of PHP, a MySQL database, a webserver such as Apache. If these are not already installed, please install them with the following command line inputs.

PHP:

$ sudo apt-get install php5

Apache:

$ sudo apt-get install apache2

Apache's PHP module:

$ sudo apt-get install libapache2-mod-php5

MySQL:

$ sudo apt-get install mysql-server

PHP's MySQL module:

$ sudo apt-get install php5-mysql

Restart Apache:

$ sudo /etc/init.d/apache2 restart

Section 2: Installing Granny's Addressbook

This application requires that the files are correctly placed, a MySQL database and a MySQL user are created with appropriate privileges, and that a MySQL table is imported into the database.

Before we move the files, we must set the permissions for Apache's root directory. In the following line, replace "username" with your own actual username:

$ sudo chown -R username /var/www/

Move the compressed tarball to your Apache2 document root directory:

$ mv ~/downloads/granny-book.tar.gz /var/www/

Extract the files from the tarball and then delete it:

$ tar -xvf /var/www/granny-book.tar.gz
$ rm /var/www/granny-book.tar.gz

Creating the database can be done with a simple command line input:

$ mysqladmin create granny

Creating the MySQL user must be done within the MySQL client:

$ mysql --user=root
mysql> CREATE USER 'granny'@'localhost' IDENTIFIED BY 'whodoIknow?';
mysql> GRANT ALL PRIVILEGES ON granny.* TO 'granny'@'localhost';
mysql> exit

Now, import the addressbook table into the granny database:

$ mysql -u granny -p granny < /var/www/granny/addressbook.sql

And delete the .sql file:

$ rm /var/www/granny/addressbook.sql

Using Granny's Addressbook

Granny's Addressbook is a web-based application so the user will need to start up the browser of their choice and navigate to:

http://localhost/granny/

From here the user will see several text input fields and a box with a list of sample names.

Finding contact information

From the list on the right, locate and click on the name of the person whose contact information you wish to know and the data will appear in the text fields on the left side.

Creating a new entry

Click on the blank line at the top of the list on the right. Fill in all the input fields on the left side of the page. Click the 'Save' button located at the bottom of the left side of the page. You should now see the name of the new contact at the bottom of the list on the right.

Updating an entry

From the list on the right, click the name of the contact whose information you wish to edit. Edit the text of any of the fields on the left side of the screen. Click the 'Save' button at the bottom of the left side of the page.

Deleting an entry

From the list on the right, click the name of the contact whose information you wish to delete. Click the 'Delete' button located at the bottom of the right side of the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment