5. Simple Content Management System

  • Use your terminal to ssh into the server and enter the folder /var/www/html/test01 with the command
    cd /var/www/html/test01
  • Download the archive with source files using the command
    wget https://gradeyard.com/downloads/impwic.tar.gz
  • Extract the archive with
    tar -xzvf impwic.tar.gz
  • Make sure that the group of test01 and all of its subfolders is wadmins
    sudo chgrp -R wadmins /var/www/html/test01/
  • The archive can be now safely erased
    rm impwic.tar.gz
  • Create the folder webFiles in the root directory. Change its permissions and the group to 755 and wadmins.
    sudo mkdir /webFiles
    sudo chmod -R 775 /webFiles/
    sudo chgrp -R wadmins /webFiles/
  • Open the following file in nano
    nano /var/www/html/test01/src/interface/SII_sessionInformation.cpp
    Locate the line that contains the password impwic++ and change that password to something else.
  • Compile the source codes with
  • The compiler will produce the file /var/www/html/test01/index.cgi.
  • Use your browser to access the content management system that was just installed and placed at the location https://yourdomain.com/test01.
  • Once you visit the website for the first time it will generate a database. If you are curious, you can see and analyze the underlying b-tree whose numerous components are placed in the folder /webFiles/. Please do not edit any database files manually. This would break the website.
  • The current site has only blank pages and system files. You can add more things by using the web form called websiteEdit.html. The form can be accessed by the browser by following the link https://yourdomain.com/test01/websiteEdit.html.
  • Once you fill the form and click on Submit the fields will be sent to index.cgi. It will understand the fields and decide how to process them and put in the database. If the password field contains the correct string (impwic++ in the case that you did not edit the source), then the database will receive a new entry. The name of the page is the first field of the form. For example, if you choose the name text001, then you will be able to access your text later by typing https://yourdomain.com/test01/index.cgi?page=text001. If you give the name firstPage to your database submission, then you are creating a special page that can be accessed with https://yourdomain.com/test01 in addition to https://yourdomain.com/test01/index.cgi?page=firstPage.
  • The contents of your database submissions can contain html code for better formatting of the text. The files htmlHeader.txt and htmlFooter.txt contain the html code for the start and the end of the page. The database submission contains the middle of the page. The header and the footer can be manually edited with editor nano. The rest of the website is stored in the database and edited by submitting an appropriate form to index.cgi.