PROJECT REPORT
Project Submitted by
Faria Nazir
Sidra Tariq
TABLE OF CONTENTS
1
Table of Contents 2
1. Introduction...................................................................................................................................3
2. Acknowledgement.........................................................................................................................3
3. Project Description.........................................................................................................................4
3.1 Getting System Information............................................................................................................4
3.2 Coding for getting system information...........................................................................................4
3.3 My system information...................................................................................................................6
3.4 Interface.........................................................................................................................................7
3.5 Coding for Interface........................................................................................................................8
3.6 Validation of fields........................................................................................................................10
3.7 Coding for validation.....................................................................................................................10
3.8 HTML connection with database..................................................................................................13
3.9 Database Table.............................................................................................................................13
3.10 Coding for connection...................................................................................................................14
3.11 Viewing user's record....................................................................................................................15
3.12 Coding for viewing user's record...................................................................................................15
3.13 Login.js file....................................................................................................................................16
3.14 Extracting user's data from database...........................................................................................16
3.15 View_Request.php........................................................................................................................16
4. What we have learnt....................................................................................................................17
2
1. ACKNOWLEDGEMENT
We are foremost grateful to Almighty Allah who has given us a chance to start this project, inspired us
for continual improvements and to carry this effort to its completion. We solute our parents for whom
we have no words to describe our sensation of respect. We are indebted to Engr. Arif Mehmood and
Engr. Haseeb Anwar for their valuable suggestions and encouragement. Lastly, we would like to thank all
members of ID Technologies who helped us during the completion of this project.
2. INTRODUCTION
This project provides an application to know about the user’s system information like MAC Address, CPU
ID, and Motherboard ID that can be used in software licensing because MAC Address is Media Access
Control address, a hardware address that uniquely identifies each node of a network. The CPUID opcode
is a processor supplementary instruction (its name derived from CPU IDentification) for the x86
architecture. It was introduced by Intel in 1993 when it introduced the Pentium and SL-Enhanced 486
processors.By using the CPUID opcode, software can determine processor type and the presence of
features (like MMX/SSE). The CPUID opcode is 0FA2h and the value in the EAX register specifies what
information to return.
3
3. PROJECT DESCRIPTION
We were assigned a project of web development to find the System Information and handle the
requests of users. To accomplish this project we used
C#
HTML
PHP
JAVASCRIPT
3.1 GETTING SYSTEM INFORMATION:
The foremost task was to get the system information on which our entire project resides. We worked on
several languages like java, applet but we found C# the most significant.
We created a form in which we have used four labels, three text fields and one OK button. The four
labels are
MAC Address
CPU ID
Motherboard ID
ID Technologies
As the form loads, the MAC Address, CPU ID and Motherboard ID of the user’s system appears in the
respective fields. When the user clicks the OK button the form disappears.
3.2 CODING FOR GETTING SYSTEM INFORMATION:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
4
private void Form1_Load(object sender, EventArgs e)
{
ManagementScope theScope = new ManagementScope("\\\\" + Environment.MachineName + "\\
root\\cimv2");
StringBuilder theQueryBuilder = new StringBuilder();
theQueryBuilder.Append("SELECT * FROM Win32_NetworkAdapter");
ObjectQuery theQuery = new ObjectQuery(theQueryBuilder.ToString());
ManagementObjectSearcher theSearcher = new ManagementObjectSearcher(theScope,
theQuery);
ManagementObjectCollection theCollectionOfResults = theSearcher.Get();
foreach (ManagementObject theCurrentObject in theCollectionOfResults)
{
if (theCurrentObject["MACAddress"] != null)
{
//string macAdd = "MAC Address: " + theCurrentObject["MACAddress"].ToString();
tx_mac.Text = theCurrentObject["MACAddress"].ToString();
var processorID = "";
var query = "SELECT ProcessorId FROM Win32_Processor";
var oManagementObjectSearcher = new ManagementObjectSearcher(query);
foreach (var oManagementObject in oManagementObjectSearcher.Get())
{
processorID = (string)oManagementObject["ProcessorId"];
break;
}
//MessageBox.Show(processorID);
tx_cpuid.Text = processorID;
5
string mbInfo = String.Empty;
//Get motherboard's serial number
ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select * From
Win32_BaseBoard");
foreach (ManagementObject mo in mbs.Get())
{
mbInfo += mo["SerialNumber"].ToString();
}
//return mbInfo;
// MessageBox.Show(mbInfo);
tx_mID.Text = mbInfo;
}
private void bt_ok_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
OUTPUT:
3.3 MY SYSTEM INFORMATION
6
The purpose of HTML was to design the interface of our project through which the user can inteact with
the system.
3.4 INTERFACE:
FIELDS:
Our interface consists of nine fields in which first six fields are compulsory for the user to fill and among
the last three if the users enters data in at least one field then his data will be added after pressing the
submit button.
LINK:
We have added a link named as “Get System Information”. By clicking this link, the system prompts the
user to save or run the link. After running the link, the user’s system information (MAC Address, CPU ID
and Motherboard ID) is displayed in the form.
RADIO BUTTONS:
There are two radio buttons through which the type of license is selected by the user.
7
INTERFACE SETTING:
To make our interface look appealing, we have added an image, have set a background colour. We have
also set the pixels width in order to make the interface appear similar everywhere.
3.5 CODING FOR INTERFACE: (index.html)
<html>
<head>
<script type="text/javascript" src="jstest.js"></script>
</head>
<img src="LatextraBaner.png" alt="logo" width="866" height="200" />
<body bgcolor="#1E90FF">
<div style="width: 800px">
<form method="POST" onsubmit="return validate_form(this)" action="response_handler.php">
</br></br>
<center>
<table>
<tr>
<td width="50%"> First Name: </td>
<td> <input type="text" name="fname" /> </td>
</tr>
<tr>
<td width="50%"> Last Name :</td>
<td> <input type="text" name="lname" /></td>
</tr>
<tr>
<td width="50%"> Organization Name:</td>
8
<td> <input type="text" name="oname"/></td>
</tr>
<tr>
<td width="50%">Email:</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td width="50%">Contact Number:</td>
<td><input type="text" name="cno" /></td>
</tr>
<tr>
<td width="50%">Duration in years:</td>
<td><input type="text" name="years"/ ></td>
</table>
<br/>
<table>
<p>Type Of License</p>
<input type="radio" name="os" value="Read Only"/>Read Only<br/>
<input type="radio" name="os" value="Extend"/>Extend<br/>
</br>
<a href="WindowsFormsApplication6.exe">Get System Information</a>
</br></br>
<tr>
<td width="50%">MAC ID:</td>
<td><input id="input1" type="text" name="mid" /></td>
9
</tr>
<tr>
<td width="50%">CPU ID:</td>
<td><input id="input2" type="text" name="cid" /></td>
</tr>
<tr>
<td width="50%">MotherBoard ID:</td>
<td><input id="input3" type="text" name="mbid" /></td>
</tr>
</table>
</br></br>
<input type="submit" value="submit"/>
</center>
</form>
</div>
</body>
</html>
3.6 VALIDATION OF FIELDS:
We have used Java script to apply validation on fields. If the user leaves one of the fields, then a prompt
Message appears to enter data in that field. The data is not submitted until the user enters data in the
fields.
3.7 CODING FOR VALIDATION: (jstest.js)
function validate_required(field,alerttxt) {
with (field) {
if (value==null||value=="") {
alert(alerttxt);
10
return false;
else {
return true;
} } }
function validate_email(field,alerttxt) {
with (field) {
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) {
alert(alerttxt);
return false;
else {
return true;
} } }
function check_one_select(){
var input1 = document.getElementById('input1');
var input2 = document.getElementById('input2');
var input3 = document.getElementById('input3');
if(input1.value == '' & input2.value == ''& input3.value == ''){
alert("Enter value in atleast one field of MAC,CPU and Motherboard");
return false;
else{
11
return true;}
function validate_form(thisform) {
with (thisform) {
if (validate_required(fname,"Please specify your First Name!")==false) {
fname.focus();
return false;
if (validate_required(lname,"Please specify your last Name!")==false) {
lname.focus();
return false;
if (validate_required(oname,"Please specify your Organization Name!")==false) {
oname.focus();
return false;
if (validate_required(email,"Email must be filled out!")==false) {
email.focus();
return false;
if (validate_email(email,"Not a valid e-mail address!")==false) {
email.focus();
return false;
if (validate_required(cno,"Enter your contact number!")==false) {
12
cno.focus();
return false;
if (validate_required(years,"Enter your time Duration !")==false) {
years.focus();
return false;
if (check_one_select()==false) {
mid.focus();
return false;
} }
3.8 HTML CONNECTION WITH THE DATABASE:
In order to save the data of the user we have connected the html with database through php.
As the user clicks the submit button, the connection with the database is established and the user
record is added.
3.9 DATABASE TABLE
Field Name Data Type Length Primary Key Not Null Auto
Increment
Record_ID int 6 yes yes yes
First_Name Varchar 15 yes
Last_Name Varchar 15 yes
Name_Of_Organization varchar 35 Yes
Email varchar 30 Yes
Contact_number varchar 30 Yes
Duration_In_Years int 5 Yes
Type_Of_License varchar 10 yes
MAC_ Address varchar 16
CPU_ID varchar 25
Motherboard_ID Varchar 25
13
3.10 CODING FOR CONNECTION: (response_handler.php)
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("license_request", $con);
echo "connection establish </br></br>";
$sql="INSERT INTO user_data (Record_ID,First_Name, Last_Name,
Name_Of_Organization,Email,Contact_number,Duration_In_Years,Type_Of_License,MAC_Address,CPU
_ID,Motherboard_ID)
VALUES
('null','$_POST[fname]','$_POST[lname]','$_POST[oname]','$_POST[email]','$_POST[cno]','$_POST[years]
','$_POST[os]','$_POST[mid]','$_POST[cid]','$_POST[mbid]')";
if (!mysql_query($sql,$con))
die('Error: ' . mysql_error());
else{
echo "record added";
mysql_close($con)
?>
14
3.11 VIEWING USER’S RECORD:
In order to view the user’s record, we have created an html page in which there are two fields namely
user name and password. The record can be viewed if a valid name and password is entered otherwise a
prompt message appears either the name or password is invalid.
3.12 CODING FOR VIEWING USER’S DATA:
<html>
<head>
<img src="LatextraBaner.png" alt="logo" width="866" height="200" />
<script language="JavaScript" type="text/JavaScript" src="login.js"></script>
</head>
<body bgcolor="#1E90FF">
<form>
<br>
<center>
Username: <input type="text" name="username"></br>
<br>
Password: <input type="password" name="password"></br>
<br>
<input type="button" value="Login" onClick="Login(this.form);"></br>
</center>
</form>
15
</body>
</html>
3.13 LOGIN.JS FILE:
function Login(form) {
if (form.username.value == "faria" && form.password.value == "sidra") {
location.href = 'view_request.php';
}
else {
alert("Either the username or password you entered is incorrect.\nPlease try again.");
form.username.focus();
}
return true;
}
3.14 EXTRACTING USER’S DATA FROM DATABASE:
We established the html connection with the database through php to extract the user’s data.
Whatever data is entered by the user can then be viewed.
3.15 VIEW_REQUEST.PHP:
<html>
<head>
<img src="idtech_logo.jpg" alt="logo" width="1500" height="80" />
<body bgcolor="#1E90FF">
<center>
<h1>User Requests</h1>
</center>
<?php
$conn = mysql_connect("localhost","root","");
$db = mysql_select_db("license_request",$conn);
?>
<?php
echo "<ul>";
$sql = "select * from user_data";
$qury = mysql_query($sql);
while($row = mysql_fetch_array($qury))
16
echo "<li>Record ID: $row[0]</li><li>First_Name: $row[1]</li><li>Last_Name:
$row[2]</li><li>Name_Of_Organization: $row[3]</li><li>Email: $row[4]</li><li>contact_number:
$row[5]</li><li>Duration In Years: $row[6]</li><li>MAC Address: $row[7]</li><li>CPU ID:
$row[8]</li><li>Motherboard ID: $row[9]</li><br />";
echo "</ul>";
?>
</body>
</head>
</html>
4. WHAT WE HAVE LEARNT . . .
Our experience in ID Technologies was really interesting and informative. First of all, we learnt how to
work in an office environment. We were provided a very peaceful and calm working environment.
OUR LEARNINGS:
We learnt a lot many things in this short period of time which are as follows:
Creating a simple class in C++
Function Pointers
Reading and writing a C++ file
Creating an XML and KML files
Working on HTML
Working on Applet
Linking HTML with Applet
Event handling in C#
Working on Java Script
Working on php
All these things were quiet useful and significant for us and we tried our level best to learn as much as
we can.
17
18