Back to the main page

MyHW - hw and sw database

I was working on a hardware/software database, MySQL/Apache/PHP. I believe can be easily used for smaller organisations. Here is how to install and start with it.
First you need a system with installed MySQL/Apache/PHP. Here is one way how to get to this point, if you have Solaris Sparc machine.

Get and untar webstack-native-1.5-b09-solaris-sparc.tar (sorry I can't provide it here, try to get from Oracle or search somewhere else).
Use install script to install AMP (okay, first install dependencies)

{unixlab-2}/tmp/webstack> ./install amp
WS012 The following dependencies were not resolved,
sun-wsbase.pkg [SUNWjpg,SUNWfontconfig,SUNWpng,SUNWfreetype2]
        sun-apache22.pkg [SUNWpostgr-82-libs]
        sun-php52.pkg [SUNWlxsl]
Or you can install separate components individually.
{unixlab-2}/tmp/webstack> ./install apache
sun-apache22.pkg...
sun-apache22-dtrace.pkg...
sun-apache22-fcgid.pkg...
sun-apache22-perl.pkg...
sun-apache22-sed.pkg...
sun-apache22-jk.pkg...
sun-apache22-authgss.pkg...
sun-apache22-security2.pkg...
{unixlab-2}/tmp/webstack> ./install php
sun-php52.pkg...
sun-php52-xdebug.pkg...
sun-php52-suhosin.pkg...
sun-php52-apc.pkg...
sun-php52-idn.pkg...
sun-php52-dtrace.pkg...
sun-php52-memcache.pkg...
sun-php52-pgsql.pkg...
sun-php52-mysql.pkg...
sun-php52-tcpwrap.pkg...
Once done, start Apache service (svc:/network/http:sun-apache22)
It works, check http://unixlab-2 (the page "Sun GlassFish Web Stack 1.5" appears)

Get the tar of MyHW and untar in Apache document location. Download MyHW.tar
{unixlab-2}/var/opt/webstack/apache2/2.2/htdocs> tar -xvf MyHW.tar

It creates directory MyHW, change ownership of all files to root:bin
Go to http://unixlab-2/MyHW/ and you'll see the Home page.
Now get database dump (.sql) file and restore it, but it's needed first to manually create database. Download (right click) sql dump

Note: Use companyhw as database name.
{unixlab-2}/tmp> mysql -u root -p
Enter password:
mysql> create database companyhw;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| companyhw          |
| mysql              |
| test               |
+--------------------+
Restore dump of my example database, there are some example data already in the database.
{unixlab-2}/tmp> mysql -u root -p companyhw < yourcompany_hw_sw.sql

See the file userlogin.php (it's place where you can alter MySQL root's password, don't change database name, leave $db="mysql";). This file is for connecting to MySQL, that's why contains MySQL root login credentials.
See the file mysqlconnectsub-root.inc (it's place to define database name and setup MySQL root's password)
Files mysqlconnectsub-select_only.inc and mysqlconnectsub-update.inc define how two MySQL accounts access database, read-only and read-write access.

Those two MySQL accounts have to be created (no need to create system accounts), they are user_ro (read only privileges) and user_rw (all privileges).
Use below command to create them, the password is specified by "identified by".
mysql> grant all on companyhw.* to user_rw@localhost identified by "user_rw";
mysql> grant select on companyhw.* to user_ro@localhost identified by "user_ro";
mysql> show grants for user_ro@localhost;
+----------------------------------------------------------------------------------------------------------------+
| Grants for user_ro@localhost                                                                                   |
+----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'user_ro'@'localhost' IDENTIFIED BY PASSWORD '*089FFA116E666708BDCE121072293C3BC958C0D3' |
| GRANT SELECT ON `companyhw`.* TO 'user_ro'@'localhost'                                                         |
+----------------------------------------------------------------------------------------------------------------+
mysql> show grants for user_rw@localhost;
+----------------------------------------------------------------------------------------------------------------+
| Grants for user_rw@localhost                                                                                   |
+----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'user_rw'@'localhost' IDENTIFIED BY PASSWORD '*7B1C295ED76FD5A1A60930D9FA4788F26190CAEC' |
| GRANT ALL PRIVILEGES ON `companyhw`.* TO 'user_rw'@'localhost'                                                 |
+----------------------------------------------------------------------------------------------------------------+

You'll need to create MySQL user who can use application (username=tota, password=makedonija), use command for this:
mysql> grant select on companyhw.* to tota@localhost identified by "makedonija";
mysql> show grants for tota@localhost;
+-------------------------------------------------------------------------------------------------------------+
| Grants for tota@localhost                                                                                   |
+-------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'tota'@'localhost' IDENTIFIED BY PASSWORD '*EFB6FA999B45C388F54D260DF780E19E11369D3C' |
| GRANT SELECT ON `companyhw`.* TO 'tota'@'localhost'                                                         |
+-------------------------------------------------------------------------------------------------------------+
I believe at this point, a user can login and use the application.
Important:
I noticed some bugs here (security ones), and didn't have time to work on this. Whoever has time is more than welcome to improve this application.

Here are some screens of the application:













Back to the main page