0% found this document useful (0 votes)
64 views

Oose Lab Manual New With Final

Uploaded by

M subalakshmi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Oose Lab Manual New With Final

Uploaded by

M subalakshmi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 90

CCS356 – Object Oriented software

engineering FOREIGN TRADING SYSTEM

EX.NO:1 IDENTIFICATION OF SOFTWARE SYSTEM


Date:

AIM:
To identify the software system that needs to be developed.

Software:
Software is a collection of instructions, data, or computer
programs that are used to run machines and carry out particular activities. It is the
antithesis of hardware, which refers to a computer’s external components. A
device’s running programs, scripts, and applications are collectively referred to as
“software”

Types of Software:
It is a collection of data that is given to the computer to
complete a particular task. The chart below describes the types of software

Steps of Software Development Process:


1. Analysis: Understanding the Requirements

Before jumping into the software development process, you need to know exactly
what it should do and how it will be used.

2. Planning: Setting the Foundation


In the next phase of the software development life cycle, software engineers will
lay the groundwork

3. Design: Crafting the Details


After that, create detailed plans on how the custom software will work and look.
This stage requires a collaborative approach from both software engineering and
design teams.

4. Development: Writing the Code


After the design is done, it’s time to write the code. During development, the team
members use programming languages and technologies to turn the design into
working software. They create code that does things like showing the user
interface, handling data, and talking to other systems. Development usually takes
the most time because it’s the heart of the process.

5. Testing: Ensuring It Works


Testing is the crucial phase that comes after software development, making sure
the software functions correctly and meets everyone’s needs.

6. Deployment: Releasing to the World


Deployment is the phase where we take the software from the development
environment and make it available for users to use.

7. Maintenance: Keeping It Running


Once the software is out in the world, it doesn’t mean your job is finished.

The maintenance phase is all about keeping the software running smoothly and
addressing any issues that might arise.
Features:
 Usability (User-friendly)
 Efficiency
 Flexibility
 Reliability
 Maintainability
 Portability
 Integrity

RESULT:
Thus the software system that needs to be developed was successfully identified.

EX.NO:2 DOCUMENT THE SOFTWARE REQUIREMENTS


Date: SPECIFICATION FOR THE IDENTIFIED SOFTWARE

AIM:
This project emphasizes about the Foreign Trade System which is an
interface between the Accountholder and the market. In the initial phase details
about the various currencies and the profit and loss of currency hold is collected.

PROBLEM STATEMENT:
The practice of currency trading is also commonly referred to as foreign exchange,
Forex or FX for short. All currency has a value relative to other currencies on the
planet. Currency trading system uses the purchase and sale of large quantities of
currency to leverage the shifts in relative value into profit. The online Foreign
Currency Trading system is almost entirely a "spot" market. A "spot" market
means that the trading is made immediately or "on the spot". The settlement of
those Foreign Currency Trading spot transactions is made within two working
days.

INTENDED AUDIENCE AND READING SUGGESSIONS:


Audience:
The intended audience of this document is investors, traders, and all business
entrepreneurs.
Organization:
This software is used by the trade brokerage organizations that perform the trade
on behalf of the investors.

PROJECT SCOPE:
The online Foreign Currency Trading system enables you can have 24 hour
updates of your investment in currency from the convenience of your own home.
The Foreign Currency trading system involves no exchange fees, commissions and
payments of that sort. The margin and leverage trading allows you to increase your
earnings by up to 100times more than regular currency trading. This means larger
profits and can benefit some investors. Currency Converter gives you accurate and
instant foreign currency conversions. The options are varied for minimum currency
trading investments. There is also mini account wherewith a very small initial
investment in a leveraged foreign currency, you can reach a high reward through
minimal risk.
OVERALL DESCRIPTION:
Product Perspective:
The proposed foreign trading system is an on-line system. This system will provide
an online currency trading service for investors by taking in live feed in of
international currency status.

Product function

 Generates working software quickly and early during the software life cycle.
 More flexible-less costly to change scope and requirements.
 Easier to test and debug during a smaller iteration. Easier to manage risk
during its Iteration.
 Each iteration is an easily managed milestone.
 Each component is delivered to the client when it is complete. This allows
partial utilization of product and avoids long development time.
USER CHARACTERISTICS:
 There are various kinds of users for this product
 Investors
 Traders
 Brokers
 Banks.
DESIGN AND IMPLEMENTATION CONSTRAINTS:
Design Constraints:

LOGIN: The Login module contains the form which contain membership name
and member password. It includes Username and Password.
TRADING ACCOUNT DETAILS: This form contains the information about
accountholder, market status, currency held, trading histories, etc.
BUY: After the user logged in they can buy stocks online the user can buy stock
only it is available for buying.
BANK ACCOUNT DATABASE: After the trading is finished user has to select
the type of transaction whether credit card account.

FUNCTIONAL REQUIREMENTS:
External Interface Requirements:
Graphical User Interface for easy interaction with the customer. The system
maintains a relationship with the The system uses the GUI
Rational Rose Tool. According to the code generated by the Rose tool, the system
is developed. This gives more sequential access for the functions and the functions
can be coded easily.
User Interfaces:
GUI is used in generating forms. The credit card processing system provides a
good user interface. It is more interactive with the user that the user can easily
operate the system. This can be achieved by providing the snap shots describing
the functionality of the system. By viewing into the snap shots, the user can gain
better knowledge about the system.
Hardware Interfaces
Needed: Computers Hard Disk: 100-150 GBRAM: 512-1 GB required Internet
Connection required. Cables, wires, Network adapters are required.
Communication Interfaces
The local system must be connected to the server via Internet Connection. Email
and file transfer services are provided. E-Shopping is the key concept.

OTHER NON-FUNCTIONAL REQUIREMENTS:


Performance Requirements
The system must be able to perform in adverse weather conditions like heavy rain,
hot climate etc. Connection can be interrupted but service must be uninterrupted.
Transportation of stocks must be efficient and punctual. Database should support
large amount of data and also must preserve integrity, consistency of data and
should prevent data loss.

Software system attributes:


 System attributes or quality factors will have the following requirements.
 The software is more reliable as it causes no damage to the system in which
it works. If itleads to any malfunction, it has the capability to recover from
that damage.
 The system is available at all the places where the users fell it comfortable to
work withthis.
 The software is as secure as it is user-friendlier and the user can use the
system efficiently.
 It won’t cause any system attacks
 The software is easy to maintain and the updating over the system are
verified daily, inorder to have more secure data
 The software can be installed in any system that satisfies the hardware and
softwarerequirement of this system. It is more portable.
The system provides easiness for the customer to use it and of course it is more
user-friendly.

RESULT:
Thus the software requirement specification for the identical system was done
successfully.
EX.NO:3 IDENTIFY THE USE CASE AND DEVELOP THE USE
Date: CASE MODEL

AIM:
To draw a usecase diagram for foreign trading system.

USE CASE DIAGRAM:


A use-case diagram is a graph of actors, a set of use cases enclosed by a system
boundary,communication associations between actors and the use cases and
generalization among use cases.Use cases are text documents, not diagrams, and
use-case modeling is primarily an act of writingtext, not drawing diagrams.

Purpose of Usecase Diagram:

Requirement Analysis:
Use case diagrams help in identifying and understanding the
functional requirements of a system by illustrating how users interact with
the system to achieve specific goals or tasks.

Communication:
They serve as a communication tool between stakeholders, including
developers, designers, clients, and end-users, by providing a high-level
overview of the system's functionality and user interactions.

System Design:
Use case diagrams aid in designing the system's architecture by
helping to identify the major components, interfaces, and interactions
between different parts of the system.

Scope Definition:
They assist in defining the scope of the system by identifying the
boundaries of its functionality and the actors involved in the system's
operation.

Requirements Validation:
Use case diagrams facilitate validation of system requirements by
ensuring that all necessary user interactions and system functions are
adequately represented.

User-Centered Design:
They emphasize the importance of understanding user needs and goals
by focusing on the specific
Basis for Testing:
Use case diagrams provide a basis for defining test cases and
scenarios to validate the functionality of the system from a user's
perspective.
Usecase Diagram for foreign trading system:

Primary Actors:
Investor, Market Authority
Secondary Actors:
Bank Authority, Trading Manager
System:
Account details, Database, Trading Account, Order, Sell, Market
Status, Cancel order, Generate report, Logout.

OUTPUT:
RESULT:
Thus the usecase diagram for the Foreign Trading System was done successful.
EX.NO.4 IDENTIFY THE CONCEPTUAL CLASS AND DEVELOP THE
Date: DOMAIN MODEL AND ALSO DERIVE A CLASS DIAGRAM

AIM:
To Identify the conceptual class and develop the domain model and also derive a
class diagram
CLASS DIAGRAM:
A class diagram in the Unified Modeling Language (UML) is a type of static
structure diagram that describes the structure of a system by showing the system's
classes, their attributes and operations.

Class diagram for foreign trading system:

Investor:
Represents an individual or entity participating in trading activities. It has an
aggregation relationship with the TradingManager, indicating that an
Investor can have a relationship with one or more TradingManagers. The
Investor class contains the login method.

TradingManager:
Manages trading activities and has an aggregation relationship with the
Investor class. It contains methods such as login.

Import:
Represents the importing activities in the trading system. It contains
methods like viewItem and placeOrder.

Export:
Represents the exporting activities in the trading system. It contains
methods like showItem and demand.

MarketAuthority:
Responsible for managing market-related activities such as updating market
status. It contains the method updateMarketStatus.

BankAuthority:
Handles banking and financial transactions, including authorizing payments.
It contains the method authorizePayment.

Authority:
An interface representing the authority of entities like MarketAuthority and
BankAuthority. Both MarketAuthority and BankAuthority implement this
interface.

Database:
Represents the database used in the system. Both MarketAuthority and
BankAuthority have a composition relationship with the Database,
indicating that they are composed of or depend on the Database component.

OUTPUT:

RESULT:
Thus the conceptual class was identified and class diagram for foreign trading
system was identified successfully.
EX.NO.5
Date: SEQUENCE AND COLLOBORATION
DIAGRAM

AIM:
To find the interaction between objects and represent them using
UML Sequence and Colloboration Diagram.

Interaction between objects:


 The Investor submits their account number and password to the
TradingAccount.
 The TradingAccount validates the submitted credentials. If they
are invalid, it returns an "Invalid, enter correct details" message
to the Investor.
 If the credentials are valid, the TradingAccount sends a request
to the MarketAuthority to check the market status.
 The MarketAuthority checks the market status and sends a
request to the BankDatabase to check if the bank balance is
greater than the trading account balance.
 If the bank balance is sufficient, the BankDatabase sends a
request to the Investment to check market investment.
 The Investment checks market investment and sends a request
to the TradingAccount for insufficient data balance.
 If there is insufficient data balance, the TradingAccount sends a
request to the MarketDatabase to sell.
 The TradingDatabase updates currency held and net amount.
 The Investor initiates a withdrawal process, which would
involve interactions with the Withdraw and Database
components.
Sequence diagram:

A sequence diagram is a type of interaction diagram that visualizes


the interactions between objects or components in a system over time.
It shows the sequence of messages exchanged between these objects
or components to achieve a particular functionality or scenario.
Sequence diagrams are particularly useful for understanding the flow
of control and data between different parts of a system.
OUTPUT:

Colloboration diagram:

A collaboration diagram, also known as a communication diagram, is


a type of interaction diagram in Unified Modeling Language (UML)
that visualizes the interactions between objects or components in a
system. Unlike sequence diagrams, which emphasize the time-based
ordering of messages, collaboration diagrams focus on the structural
organization of objects and their interactions in a more spatial manner.

OUTPUT:
RESULT:

Thus the UML Sequence and collaboration diagram for foreign trading
system was successfully drawn.
EX.NO.6
Date: STATE CHART AND ACTIVITY DIAGRAM

AIM:

To draw a state chart and activity diagram for foreign trading system.

STATE CHART DIAGRAM:

A State Machine Diagram is used to represent the condition of the system or part
of the system at finite instances of time. It’s a behavioral diagram and it represents
the behavior using finite state transitions.

PURPOSE:

Statechart diagram is one of the five UML diagrams used to model the dynamic
nature of a system. They define different states of an object during its lifetime and
these states are changed by events. Statechart diagrams are useful to model the
reactive systems. Reactive systems can be defined as a system that responds to
external or internal events.

Statechart diagram describes the flow of control from one state to another state.
States are defined as a condition in which an object exists and it changes when
some event is triggered. The most important purpose of Statechart diagram is to
model lifetime of an object from creation to termination.

Statechart diagrams are also used for forward and reverse engineering of a system.
However, the main purpose is to model the reactive system.

Following are the main purposes of using Statechart diagrams −

To model the dynamic aspect of a system.

To model the life time of a reactive system.


describe different states of an object during its lifetime.

Define a state machine to model the states of an object.

OUTPUT:

ACTIVITY DIAGRAM:

Activity Diagrams are used to illustrate the flow of control in a system and refer to
the steps involved in the execution of a use case. We can depict both sequential
processing and concurrent processing of activities using an activity diagram ie an
activity diagram focuses on the condition of flow and the sequence in which it
happens.

Activity Diagram Notations:


PURPOSE:

Modeling Business Processes:

Activity diagrams are commonly used to model business processes, workflows,


and procedures within organizations. They help in visualizing the sequence of
activities and decisions involved in various business processes, such as order
processing, customer service, or project management.

Describing Use Cases:

Activity diagrams can be used to describe the behavior of a system from the
perspective of specific use cases. They illustrate the sequence of actions performed
by actors or system components in response to various scenarios or user
interactions.

Analyzing and Optimizing Processes:

Activity diagrams provide a means to analyze and optimize processes by


identifying bottlenecks, redundancies, or inefficiencies in workflows.

Communicating System Behavior:


Activity diagrams serve as a communication tool between stakeholders, including
business analysts, developers, and users.

Supporting System Design:

Activity diagrams can aid in system design by helping developers understand the
behavior and logic of a system before implementation. They serve as a blueprint
for designing software systems, enabling developers to define the structure and
flow of the system's functionality.

OUTPUT:

RESULT:

Thus the statechart and activity diagram for foreign trading systemwas
successfully drawn.
Ex.No.7
Date: IMPLEMENT THE SYSTEM AS PER THE DETAILED
DESIGN

AIM:

To Implement the system as per the detailed design.

Implementation:

Implementing a Foreign Trading System involves several steps. Below is a


simplified step-by-step :

Requirement Analysis:

Understand the requirements of the Foreign Trading System. This involves


gathering information on what functionalities are needed, what currencies or
commodities will be traded, regulations, user roles, etc.

Design:

Based on the requirements, design the system architecture, database schema, user
interface, and other components.

Decide on the technologies and frameworks you will use for development.

Database Design:

Design the database schema to store information such as user data, trading
transactions, currency/commodity details, etc.

Choose an appropriate database management system (e.g., MySQL, PostgreSQL,


MongoDB) and set up the database.

Backend Development:
Implement the backend logic of the system using a programming language like
Python, Java, or Node.js.

Develop functionalities such as user authentication, trade execution, order


management, transaction processing, etc.

Frontend Development:

Design and develop the user interface (UI) for the trading system using HTML,
CSS, and JavaScript.

Implement features for user registration, login, trading dashboard, market data
display, etc.

Integration:

Integrate the backend and frontend components to ensure they work together
seamlessly.

Implement APIs or communication protocols for data exchange between different


system modules.

Testing:

Conduct thorough testing of the system to identify and fix any bugs or issues.

Perform unit testing, integration testing, and system testing to ensure the system
functions correctly under various conditions.

Security Implementation:

Implement security measures such as encryption, secure authentication,


authorization mechanisms, etc., to protect user data and transactions.

Follow industry best practices and compliance standards (e.g., GDPR, PCI DSS)
for data security

Deployment:
Deploy the Foreign Trading System on a suitable hosting platform or server.

Configure the server environment and ensure it meets the system requirements.

Set up monitoring and logging mechanisms to track system performance and


errors.

Maintenance and Support:

Provide ongoing maintenance and support for the trading system.

Address any issues or enhancements requested by users.

Keep the system updated with the latest security patches and updates.

Documentation:

Document the system architecture, design decisions, codebase, APIs, user manuals,
etc., for future reference and maintenance.

Training:

Provide training to users and administrators on how to use the Foreign Trading
System effectively and efficiently.

Remember that developing a Foreign Trading System can be complex, especially


considering factors such as real-time data processing, regulatory compliance, and
security. It's essential to involve domain experts and follow industry best practices
throughout the development process.
Code:

bank.php

<?php

include "bank_check.php";

?>

<html>

<head>

<title>Bank Account Details</title>

<link rel="stylesheet" href="style.css">

</head>

<body background="queen.jpg">

<h1 class="inp" style="text-align: center">Bank Details</h1>

<form method="post" action="signup_add.php">

<center>

<table class="inp" style="width: 400px;">

<tr>

<td style="width: 35%;">

Account Number:

</td>

<td style="width: 65%;">


<input id="accno" type="text" name="accno" maxlength="52" />

</td>

</tr>

<tr>

<td style="width: 35%;">

Bank Name:

</td>

<td style="width: 65%;">

<input id="bank_name" type="text" name="bank_name"


maxlength="2048" />

</td>

</tr>

<tr>

<td style="width: 35%;">

Available Balance:

</td>

<td style="width: 65%;">

<input id="abal" type="text" name="abal" maxlength="16" />

</td>

</tr>

<tr>

<td colspan="2" style="width: 100%;">


<button type="submit" name="submit">Submit</button>

</td>

</tr>

</table>

</center>

</form>

</body>

</html>

db.inc.php

<?php

include('db.inc.php');

include "session.php";

$ses_sql = mysqli_query($db,"select * from users where email = '$user_check'


");

?>

db.inc.php

<?php

$conn = mysqli_connect("localhost","root","","fts");

// Check connection

if (mysqli_connect_errno())

echo "Failed to connect to MySQL: " . mysqli_connect_error() }?>

index.html
<html>

<head>

<title>foreign trading system</title>

<link rel="stylesheet" href="style.css">

</head>

<body background=king.jpg>

<center><font face="Showcard Gothic" color="black"><h1


color="#000fff">FOREIGN TRADING SYSTEM</h1></font><br><br>

<table style="border-spacing:1em">

<tr>

<td>

<a type="button" class="button" value="LOGIN"


href="login.html">Login</a></td>

<a type="button" class="button_main" value="LOGIN"


href="login.html">Login</a></td>

<td>

<a type="button" class="button" value="SIGN UP" href="signup.html">Sign


Up</a></td></center>

<a type="button" class="button_main" value="SIGN UP"


href="signup.html">Sign Up</a></td></center>

</table>

</body>

</html>

8 changes: 4 additions & 4 deletions8


login.html

</head>

<h1 class="inp" style="text-align: center">Login</h1>

<body background="queen.jpg">

<form action="logval.html" method="post">

<form action="logval.php" method="post">

<div class="center">

<center>

<table class="inp">

<tr>

<td>Email:</td>

<td><input type="email" name="uname" value=""></td>

<td><input type="email" id="uname" name="uname" value=""></td>

</tr>

<tr>

<td>Password:</td>

<td><input type="password" name="upass" value=""></td>

<td><input type="password" id="upass" name="upass" value=""></td>

</tr>

<tr>

<td><input type="submit" name="" value="Submit"></td>

<td><button type="submit" name="submit">Submit</button></td>

</tr>
</table>

</center>

5 changes: 5 additions & 0 deletions5

logout.php

<?php

unset($_SESSION['uid']); session_destroy();

echo "<script>window.location.assign('index.html')</script>"

?>

login.html

<!DOCTYPE html>

<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Login</title>

<link rel="stylesheet" href="style.css">

</head>

<h1 class="inp" style="text-align: center">Login</h1>

<body background="queen.jpg">

<form action="logval.html" method="post">

<form action="logval.php" method="post">

<div class="center">

<center>

<table class="inp">
<tr>

<td>Email:</td>

<td><input type="email" name="uname" value=""></td>

<td><input type="email" id="uname" name="uname" value=""></td>

</tr>

<tr>

<td>Password:</td>

<td><input type="password" name="upass" value=""></td>

<td><input type="password" id="upass" name="upass" value=""></td>

</tr>

<tr>

<td><input type="submit" name="" value="Submit"></td>

<td><button type="submit" name="submit">Submit</button></td>

</tr>

</table>

</center>

logout.php

<?php

unset($_SESSION['uid']); session_destroy();

echo "<script>window.location.assign('index.html')</script>";

logval.php
?php

session_start();

include "db.inc.php";

if (isset($_POST['submit'])){

$email = $_POST['uname'];

$pass = $_POST['upass'];

if (empty($email)||empty($pass)){

$empty = "";

if(empty($pass)){

$empty .= " Password";

if(empty($email)){

$empty .= " Email";

mysqli_close($conn);

echo' <script> alert("Fill out all the fields".$empty);</script>' ;

else{

if (!filter_var($email,FILTER_VALIDATE_EMAIL)){

mysqli_close($conn);

echo' <script> alert("Invalid


Email");window.location.assign("login.html") ;</script>';

}
else{

$sql = "SELECT * FROM fts.users WHERE email = \"$email\" AND


password = \"$pass\"";

$result = mysqli_query($conn,$sql);

$resultCheck = mysqli_num_rows($result);

$row = mysqli_fetch_array($result,MYSQLI_ASSOC);

if ($resultCheck == 1){

$_SESSION['uid'] = $row['uid'];

header("location: main.php");

}else {

$error = "Your Login Name or Password is invalid";

echo "<script>alert('$error');window.location.assign('login.html');</script>";

else{

mysqli_close($conn);

echo' <script> alert("Please enter values in the


fields");window.location.assign("login.html");</script>' ;
}

?>

main.php

!DOCTYPE html>

<?php

include('session.php');

?>

<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Foreign Trading System</title>

<link rel="stylesheet" href="style.css">

</head>

<body background="queen.jpg">

<center><h1 class="inp">Foreign Trading System</h1>

<h1 class="inp" >Welcome <?php echo $login_session ?></h1>

<table style="border-spacing:1em ">

<tr>

<td>

<a class="button"href="transaction.html">New Transaction</a></td>

<td>

<a class="button"href="bank.php">Bank account details</a></td>


<td>

<a class="button"href="transhist.php">Transaction History</a></td>

<td>

<a class="button"href="logout.php">Logout</a></td>

</tr>

</center>

</body>

sell.php

<html>

<head>

<link rel="stylesheet" href="style.css">

<title>Sell</title>

</head>

<body background="wiz.jpg">

<center>

<link rel="stylesheet" href="style.css">

<h1 class="inps">SELL</h1></font><br><br>

<form method="post" action="sell_add.php">

<table class="inps" style="width: 400px;">

<tr>

<td style="width: 35%;">

ITEM NAME:

</td>
<td style="width: 65%;">

<input id="name" type="text" name="iname" maxlength="52" />

</td>

</tr>

<tr>

<td style="width: 35%;">

QUANTITY:

</td>

<td style="width: 65%;">

<input id="quantity" type="QUANTITY" name="quant"


maxlength="16" />

</td>

</tr>

<tr>

<td style="width: 35%;">

PRICE:

</td>

<td style="width: 65%;">

<input id="price" type="text" name="price" maxlength="2048" />

</td>

</tr>

<tr>

<td></td>
<td style="width: 65%;">

<button type="submit" name="submit">Submit</button>

</td>

</tr>

</table>

</form>

</center>

</form>

</body>

</html>

sell_add.php

<?php

include "db.inc.php";

include "session.php";

$uid=$_SESSION['uid'];

if (isset($_POST['submit'])){

$iname = $_POST['iname'];

$quant = $_POST['quant'];

$price = $_POST['price'];

$ses_sql = mysqli_query($conn,"SELECT * FROM users WHERE uid= '$uid'


");

$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);

$currency = $row['currency'];
if (empty($iname)||empty($quant)||empty($price)){

$empty = "";

if(empty($iname)){

$empty .= " iname";

if(empty($price)){

$empty .= " Price";

if(empty($quant)){

$empty .= " quant";

mysqli_close($conn);

echo' <script> alert("Fill out all the fields".$empty);</script>' ;

Else{

$sql = "INSERT INTO fts.sell_table (iname, quant,


price,uid,currency) VALUES('$iname','$quant','$price','$uid','$currency')";

if(mysqli_query($conn,$sql))

mysqli_close($conn);

echo' <script> alert("Product added


succefully");window.location.assign("main.php");</script>' ;

}
else{

echo "Error: " . $sql . "<br>" . mysqli_error($conn);

else{

mysqli_close($conn);

echo' <script> alert("Please enter values in the


fields");window.location.assign("sell.php");</script>' ;

?>

16 changes: 16 additions & 0 deletions16

session.php

@@ -0,0 +1,16 @@

<?php

include('db.inc.php');

session_start();

$user_check = $_SESSION['uid'];

$ses_sql = mysqli_query($conn,"SELECT * FROM users WHERE uid=


'$user_check' ");

$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);

$login_session = $row['name'];
if(!isset($_SESSION['uid'])){

echo "nein";

?>

signup.html

<html>

<head>

<title>Table Align Demo</title>

<script type="text/javascript">

function ValidateForm()

var nameB = document.getElementById ("name");

if (nameBox.value.length == 0)

alert ("Enter name.");

return false;

var re = /^\w+(?:\s\w+){0,3}$/;

if (!nameBox.value.match (re))

alert ("Invalid name.");

return false;

}
var pwBox = document.getElementById ("password");

if (pwBox.value.length < 6)

alert ("Password is too short.");

return false;

if (pwBox.value.length > 16)

alert ("Password is too long.");

return false;

re = /^\S{6,16}$/;

if (!pwBox.value.match (re))

alert ("Invalid password.");

return false;

re = /^\d{7,16}$/;

var telBox = document.getElementById ("telephone");

if (telBox.value.length > 0)

if (!telBox.value.match (re))

{
alert ("Invalid telephone number.");

return false;

re = /^\w+([\.\-\+]\w+)*@\w+(\-\w+)*\.\w+(\-\w+)*(\.\w+(\-\w+)*)*$/;

var emailBox = document.getElementById ("email");

if (!emailBox.value.match (re))

alert ("Invalid email address: " + emailBox.value);

return false;

var maleBox = document.getElementById ("male");

var femaleBox = document.getElementById ("female");

if(!maleBox.checked && !femaleBox.checked)

alert ("Specify gender");

return false;

alert("Successfull");

return true;

</script>

<title>Signup</title>
<link rel="stylesheet" href="style.css">

</head>

<body background="queen.jpg">

<form method="get" action="main.htm">

<h1 class="inp" style="text-align: center">Sign Up</h1>

<form method="post" action="signup_add.php">

<center>

<table class="inp" style="width: 400px;">

<tr>

@@ -92,52 +17,52 @@

NAME:

</td>

<td style="width: 65%;">

<input id="name" type="text" name="NAME" maxlength="52" />

<input id="name" type="text" name="name" maxlength="52" />

</td>

</tr>

<tr>

<td style="width: 35%;">

PASSWORD:

EMAIL:

</td>

<td style="width: 65%;">


<input id="password" type="PASSWORD" name="PASSWORD"
maxlength="16" />

<input id="email" type="text" name="email" maxlength="2048" />

</td>

</tr>

<tr>

<td style="width: 35%;">

EMAIL:

PASSWORD:

</td>

<td style="width: 65%;">

<input id="email" type="text" name="EMAIL" maxlength="2048" />

<input id="password" type="PASSWORD" name="password"


maxlength="16" />

</td>

</tr>

<tr>

<td style="width: 35%;">

PHONE NO:

</td>

<td style="width: 65%;">

<input id="phone no" type="text" name="PHONE NO" maxlength="16"


/>
<input id="phone_no" type="text" name="phone_no"
maxlength="16" />

</td>

</tr>

<tr>

<td style="width: 35%;">

GENDER:

</td>

<td style="width: 65%;">

<input id="male" type="radio" value="Male" name="gender"


checked/>Male

<input id="female" type="radio" value="Female" name="gender"


/>Female

<input id="gender" type="radio" value="Male" name="gender"


checked/>Male

<input id="gender" type="radio" value="Female" name="gender"


/>Female

</td>

</tr>

<tr>

<td style = "width:35%;">

CURRENCY:

</td>
<td style = "width:35%;"><input type="radio" id="group3"
name="group3" value="INR" checked>INR<input type="radio" id="group3"
name="group3" value="usd">USD</td>

<td style = "width:35%;"><input type="radio" id="group3"


name="group3" value="INR" checked>INR<input type="radio" id="group3"
name="group3" value="USD">USD</td>

</tr>

<tr>

<td colspan="2" style="width: 100%;">

<input type="submit" value="Submit" onclick="king.html" />

<button type="submit" name="submit">Submit</button>

</td>

</tr>

</table>

</html>

signup_add.php

<?php

include "db.inc.php";

if (isset($_POST['submit'])){

$name = $_POST['name'];

$email = $_POST['email'];

$pass = $_POST['password'];

$phone_no=$_POST['phone_no'];

$gender = $_POST['gender'];
$currency = $_POST['group3'];

if (empty($name)||empty($email)||empty($pass)||empty($phone_no)||
empty($gender)||empty($currency)){

$empty = "";

if(empty($name)){

$empty .= " Name";

if(empty($phone_no)){

$empty .= " Contact Number";

if(empty($pass)){

$empty .= " Password";

if(empty($currency)){

$empty .= " Currency";

if(empty($gender)){

$empty .= " Gender";

if(empty($email)){

$empty .= " Email";

mysqli_close($conn);
echo' <script> alert("Fill out all the fields".$empty);</script>' ;

else{

if (!filter_var($email,FILTER_VALIDATE_EMAIL)){

mysqli_close($conn);

echo' <script> alert("Invalid Email") ;</script>';

header("Location: index.php?invalid+email");

else{

if (!preg_match('/^[0-9]*$/',$phone_no) || strlen($phone_no) != 10){

mysqli_close($conn);

echo' <script> alert("Invalid+Number");</script>' ;

else{

$sql = "SELECT * FROM fts.users WHERE email = \"$email\"";

$result = mysqli_query($conn,$sql);

$resultCheck = mysqli_num_rows($result);

if ($resultCheck > 0){

mysqli_close($conn);

echo' <script> alert("Already


registered");window.location.assign("index.html");</script>' ;

else{
$sql = "INSERT INTO fts.users (name, email, password, phone_no,
gender ,currency)
VALUES('$name','$email','$pass','$phone_no','$gender','$currency')";

if(mysqli_query($conn,$sql))

mysqli_close($conn);

echo' <script> alert("Registration


successful");window.location.assign("index.html");</script>' ;

else{

echo "Error: " . $sql . "<br>" . mysqli_error($conn);

else{

mysqli_close($conn);

echo' <script> alert("Please enter values in the


fields");window.location.assign("signup.html");</script>' ;

?>

style.css
.inp{

font: verdana;color: WHITE;

.button{

display: block;width: 115px;height: 25px;background-color:


transparent;background-repeat:no-repeat;padding: 10px;text-align: center;text-
decoration: none;

border-radius: 5px;

color: white;

font-weight: bold;

.button_main{

display: block;width: 115px;height: 25px;background-color:


transparent;background-repeat:no-repeat;padding: 10px;text-align: center;text-
decoration: none;

border-radius: 5px;

color: black;

font-weight: bold;

.inps{

font: verdana;color: Black;

transaction.html

<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Transaction</title>

</head>

<link rel="stylesheet" href="style .css">

<link rel="stylesheet" href="style.css">

<body background=queen.jpg>

<center>

<h1 class='inp'>New Transaction</h1>

<table class="inp">

<tr>

<td>

<a class="button" href="sell.php">Sell</a></td>

55<a class="button inp" href="sell.php">Sell</a></td>

<td>

<a class="button" href="buy.php">Buy</a></td>

<a class="button inp" href="buy.php">Buy</a></td>

</tr>

</table>

<center>

</body>

</html>
Result:

Thus the Implementation of foreign trading system was done successful.


Ex.NO:8 TEST THE SOFTWARE SYSTEM AS PER THE DETAILED
Date: DESIGN

AIM:

To Test the Software system as per the detailed design.

Testing:

Testing the Foreign Trading System is crucial to ensure its functionality, reliability,
security, and performance. Here's a basic outline of how you can test the software
system:

Unit Testing:

Test individual components (functions, methods, classes) of the system in


isolation.

Use testing frameworks like JUnit (for Java), pytest (for Python), or Jasmine (for
JavaScript) to automate unit tests.

Verify that each component behaves as expected and handles edge cases properly.

Integration Testing:

Test the interactions between different modules or components of the system.

Verify that data is exchanged correctly between backend and frontend components.

Check the integration of third-party services or APIs (if any) used in the system.

User Interface (UI) Testing:

Test the user interface to ensure it is intuitive, responsive, and visually appealing.

Conduct manual testing to simulate user interactions and workflows.

Verify that all UI elements are functional and display accurate information.
Functional Testing:

Test the functional requirements of the system as specified in the requirements


document.

Verify that users can perform actions such as registration, login, placing orders,
executing trades, viewing account balances, etc.

Test different scenarios and edge cases to ensure all functionalities work correctly.

Security Testing:

Perform security testing to identify vulnerabilities and weaknesses in the system.

Test for common security issues such as SQL injection, cross-site scripting (XSS),
cross-site request forgery (CSRF), etc.

Verify that user authentication, authorization, and data encryption mechanisms are
implemented correctly.

Performance Testing:

Test the performance of the system under various load conditions.

Conduct stress testing to determine how the system handles high volumes of
trading transactions.

Measure response times, throughput, and resource utilization to identify


performance bottlenecks.

Regression Testing:

Conduct regression testing to ensure that new changes or bug fixes do not
introduce new issues.

Re-run existing test cases to verify that previously tested functionalities still work
as expected.

Compliance Testing:

Test the system for compliance with regulatory requirements and industry
standards.
Ensure that the system adheres to relevant financial regulations, data privacy laws,
and security standards.

User Acceptance Testing (UAT):

Involve end-users or stakeholders in the testing process to validate the system


against their expectations.

Gather feedback from users and make any necessary adjustments based on their
input.

Documentation Review:

Review the system documentation to ensure it accurately reflects the current state
of the system.

Verify that user manuals, installation guides, and technical documentation are
comprehensive and up-to-date.

Bug Reporting and Tracking:

Report any bugs or issues identified during testing using a bug tracking system
(e.g., Jira, Bugzilla).

Prioritize and track the resolution of reported bugs until they are fixed.

Final Validation:

Once all testing activities are completed, conduct a final validation to ensure that
the system meets the quality standards and requirements.

By following this testing process, you can identify and address any issues or
deficiencies in the Foreign Trading System before it is deployed to production.

RESULT:

Thus the testing for the foreign trading system was done successful.
EX.NO:9 IMPROVE THE REUSABILITY AND
DATE: MAINTAINABILITY OF THE SOFTWARE SYSTEM BY
APPLYING APPROPRIATE DESIGN PATTERNS

AIM:

To Improve the reusability and maintainability of the software system by


applying appropriate design patterns

Improvement in the system:

Implementing improvements in a Foreign Trading System involves a combination


of software development, design enhancements, and integration of new features.
Below are steps to implement some of the improvements mentioned earlier:

User Interface Enhancements:

Collaborate with UI/UX designers to create mockups and wireframes for the
improved interface.

Implement the design changes using HTML, CSS, and JavaScript frameworks such
as React or Angular.

Integrate responsive design principles to ensure compatibility across various


devices and screen sizes.

Advanced Trading Features:

Analyze requirements for advanced trading features such as limit orders, stop
orders, and margin trading.

Develop backend logic to support these features, including order management,


position tracking, and risk management.

Implement frontend components to allow users to place and manage advanced


orders through the trading interface.
Mobile Trading App:

Develop native or cross-platform mobile applications for iOS and Android


platforms.

Utilize frameworks like React Native or Flutter to build a single codebase for both
platforms.

Implement features consistent with the web platform, including real-time trading,
market data visualization, and account management.

Integration with External Services:

Identify relevant financial data providers, news APIs, and analytics platforms for
integration.

Develop backend integrations to fetch and process external data feeds.

Display integrated data within the trading interface, such as real-time market
prices, news articles, and financial indicators.

Enhanced Security Measures:

Implement multi-factor authentication (MFA) using SMS, email, or authenticator


apps.

Integrate biometric authentication (e.g., fingerprint or facial recognition) for added


security.

Enhance data encryption mechanisms and secure communication protocols to


protect sensitive user information.

Performance Optimization:
Analyze performance bottlenecks and optimize critical components such as
database queries and API endpoints.

Implement caching strategies to reduce latency and improve response times for
frequently accessed data.

Scale the application horizontally by deploying additional instances and using load
balancers to distribute traffic evenly.

Customization and Personalization:

Develop user settings pages to allow customization of trading dashboard layouts,


theme selection, and notification preferences.

Implement features such as watchlists, favorite asset lists, and customizable


charting options.

Store user preferences securely and ensure they persist across sessions.

Education and Training Resources:

Create educational content such as video tutorials, written guides, and interactive
courses.

Integrate educational resources directly into the trading platform, providing


contextual help and guidance.

Develop a simulated trading environment (demo account) where users can practice
trading with virtual funds.

Compliance and Regulatory Updates:

Stay informed about changes in regulatory requirements and compliance standards.

Update the platform's KYC/AML procedures, privacy policies, and terms of


service as needed.
Implement compliance checks and verification processes to ensure adherence to
regulatory guidelines.

Feedback Mechanism:

Add feedback forms, surveys, and suggestion boxes within the trading platform.

Implement analytics tools to track user interactions and gather usage data.

Regularly review user feedback and prioritize feature requests based on user needs
and preferences.

Continuous Testing and Quality Assurance:

Set up automated testing frameworks to perform regression tests, unit tests, and
integration tests.

Conduct regular code reviews and quality assurance checks to maintain code
quality.

Establish a continuous integration and deployment (CI/CD) pipeline for automated


builds and deployments.

Collaboration with Industry Experts:

Engage with traders, financial analysts, and industry experts through forums,
webinars, and workshops.

Solicit feedback and insights from industry professionals to refine trading


strategies and platform features.

Consider forming partnerships with financial institutions or trading firms to


leverage their expertise and resources.

Implementing these improvements requires a coordinated effort involving


developers, designers, product managers, and stakeholders. Prioritize features
based on user needs, market trends, and regulatory requirements to deliver a more
robust and competitive Foreign Trading System.

RESULT:
Thus reusability and maintainability of the software system by applying
appropriate design patterns was improved.

Ex.No.10 IMPLEMENT THE MODIFIED SYSTEM AS PER THE


Date: DETAILED DESIGN

AIM:

To Implement the modified system as per the detailed design.

Implementation:

Implementing a Foreign Trading System involves several steps. Below is a


simplified step-by-step :

Requirement Analysis:

Understand the requirements of the Foreign Trading System. This involves


gathering information on what functionalities are needed, what currencies or
commodities will be traded, regulations, user roles, etc.

Design:

Based on the requirements, design the system architecture, database schema, user
interface, and other components.

Decide on the technologies and frameworks you will use for development.

Database Design:

Design the database schema to store information such as user data, trading
transactions, currency/commodity details, etc.

Choose an appropriate database management system (e.g., MySQL, PostgreSQL,


MongoDB) and set up the database.

Backend Development:

Implement the backend logic of the system using a programming language like
Python, Java, or Node.js.
Develop functionalities such as user authentication, trade execution, order
management, transaction processing, etc.

Frontend Development:

Design and develop the user interface (UI) for the trading system using HTML,
CSS, and JavaScript.

Implement features for user registration, login, trading dashboard, market data
display, etc.

Integration:

Integrate the backend and frontend components to ensure they work together
seamlessly.

Implement APIs or communication protocols for data exchange between different


system modules.

Testing:

Conduct thorough testing of the system to identify and fix any bugs or issues.

Perform unit testing, integration testing, and system testing to ensure the system
functions correctly under various conditions.

Security Implementation:

Implement security measures such as encryption, secure authentication,


authorization mechanisms, etc., to protect user data and transactions.

Follow industry best practices and compliance standards (e.g., GDPR, PCI DSS)
for data security

Deployment:

Deploy the Foreign Trading System on a suitable hosting platform or server.

Configure the server environment and ensure it meets the system requirements.

Set up monitoring and logging mechanisms to track system performance and


errors.
Maintenance and Support:

Provide ongoing maintenance and support for the trading system.

Address any issues or enhancements requested by users.

Keep the system updated with the latest security patches and updates.

Documentation:

Document the system architecture, design decisions, codebase, APIs, user manuals,
etc., for future reference and maintenance.

Training:

Provide training to users and administrators on how to use the Foreign Trading
System effectively and efficiently.

Remember that developing a Foreign Trading System can be complex, especially


considering factors such as real-time data processing, regulatory compliance, and
security. It's essential to involve domain experts and follow industry best practices
throughout the development process.

Code:

bank.php

<?php

include "bank_check.php";

?>

<html>

<head>

<title>Bank Account Details</title>

<link rel="stylesheet" href="style.css">

</head>
<body background="queen.jpg">

<h1 class="inp" style="text-align: center">Bank Details</h1>

<form method="post" action="signup_add.php">

<center>

<table class="inp" style="width: 400px;">

<tr>

<td style="width: 35%;">

Account Number:

</td>

<td style="width: 65%;">

<input id="accno" type="text" name="accno" maxlength="52" />

</td>

</tr>

<tr>

<td style="width: 35%;">

Bank Name:

</td>

<td style="width: 65%;">

<input id="bank_name" type="text" name="bank_name"


maxlength="2048" />

</td>

</tr>

<tr>
<td style="width: 35%;">

Available Balance:

</td>

<td style="width: 65%;">

<input id="abal" type="text" name="abal" maxlength="16" />

</td>

</tr>

<tr>

<td colspan="2" style="width: 100%;">

<button type="submit" name="submit">Submit</button>

</td>

</tr>

</table>

</center>

</form>

</body>

</html>

db.inc.php

<?php

include('db.inc.php');

include "session.php";

$ses_sql = mysqli_query($db,"select * from users where email = '$user_check'


");
?>

db.inc.php

<?php

$conn = mysqli_connect("localhost","root","","fts");

// Check connection

if (mysqli_connect_errno())

echo "Failed to connect to MySQL: " . mysqli_connect_error() }?>

index.html

<html>

<head>

<title>foreign trading system</title>

<link rel="stylesheet" href="style.css">

</head>

<body background=king.jpg>

<center><font face="Showcard Gothic" color="black"><h1


color="#000fff">FOREIGN TRADING SYSTEM</h1></font><br><br>

<table style="border-spacing:1em">

<tr>

<td>

<a type="button" class="button" value="LOGIN"


href="login.html">Login</a></td>

<a type="button" class="button_main" value="LOGIN"


href="login.html">Login</a></td>
<td>

<a type="button" class="button" value="SIGN UP" href="signup.html">Sign


Up</a></td></center>

<a type="button" class="button_main" value="SIGN UP"


href="signup.html">Sign Up</a></td></center>

</table>

</body>

</html>

8 changes: 4 additions & 4 deletions8

login.html

</head>

<h1 class="inp" style="text-align: center">Login</h1>

<body background="queen.jpg">

<form action="logval.html" method="post">

<form action="logval.php" method="post">

<div class="center">

<center>

<table class="inp">

<tr>

<td>Email:</td>

<td><input type="email" name="uname" value=""></td>

<td><input type="email" id="uname" name="uname" value=""></td>

</tr>
<tr>

<td>Password:</td>

<td><input type="password" name="upass" value=""></td>

<td><input type="password" id="upass" name="upass" value=""></td>

</tr>

<tr>

<td><input type="submit" name="" value="Submit"></td>

<td><button type="submit" name="submit">Submit</button></td>

</tr>

</table>

</center>

5 changes: 5 additions & 0 deletions5

logout.php

<?php

unset($_SESSION['uid']); session_destroy();

echo "<script>window.location.assign('index.html')</script>"

?>

login.html

<!DOCTYPE html>

<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Login</title>
<link rel="stylesheet" href="style.css">

</head>

<h1 class="inp" style="text-align: center">Login</h1>

<body background="queen.jpg">

<form action="logval.html" method="post">

<form action="logval.php" method="post">

<div class="center">

<center>

<table class="inp">

<tr>

<td>Email:</td>

<td><input type="email" name="uname" value=""></td>

<td><input type="email" id="uname" name="uname" value=""></td>

</tr>

<tr>

<td>Password:</td>

<td><input type="password" name="upass" value=""></td>

<td><input type="password" id="upass" name="upass" value=""></td>

</tr>

<tr>

<td><input type="submit" name="" value="Submit"></td>

<td><button type="submit" name="submit">Submit</button></td>

</tr>
</table>

</center>

logout.php

<?php

unset($_SESSION['uid']); session_destroy();

echo "<script>window.location.assign('index.html')</script>";

logval.php

?php

session_start();

include "db.inc.php";

if (isset($_POST['submit'])){

$email = $_POST['uname'];

$pass = $_POST['upass'];

if (empty($email)||empty($pass)){

$empty = "";

if(empty($pass)){

$empty .= " Password";

if(empty($email)){

$empty .= " Email";

mysqli_close($conn);
echo' <script> alert("Fill out all the fields".$empty);</script>' ;

else{

if (!filter_var($email,FILTER_VALIDATE_EMAIL)){

mysqli_close($conn);

echo' <script> alert("Invalid


Email");window.location.assign("login.html") ;</script>';

else{

$sql = "SELECT * FROM fts.users WHERE email = \"$email\" AND


password = \"$pass\"";

$result = mysqli_query($conn,$sql);

$resultCheck = mysqli_num_rows($result);

$row = mysqli_fetch_array($result,MYSQLI_ASSOC);

if ($resultCheck == 1){

$_SESSION['uid'] = $row['uid'];

header("location: main.php");

}else {

$error = "Your Login Name or Password is invalid";

echo "<script>alert('$error');window.location.assign('login.html');</script>";

}
else{

mysqli_close($conn);

echo' <script> alert("Please enter values in the


fields");window.location.assign("login.html");</script>' ;

?>

main.php

!DOCTYPE html>

<?php

include('session.php');

?>

<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Foreign Trading System</title>

<link rel="stylesheet" href="style.css">

</head>

<body background="queen.jpg">

<center><h1 class="inp">Foreign Trading System</h1>

<h1 class="inp" >Welcome <?php echo $login_session ?></h1>

<table style="border-spacing:1em ">

<tr>

<td>
<a class="button"href="transaction.html">New Transaction</a></td>

<td>

<a class="button"href="bank.php">Bank account details</a></td>

<td>

<a class="button"href="transhist.php">Transaction History</a></td>

<td>

<a class="button"href="logout.php">Logout</a></td>

</tr>

</center>

</body>

sell.php

<html>

<head>

<link rel="stylesheet" href="style.css">

<title>Sell</title>

</head>

<body background="wiz.jpg">

<center>

<link rel="stylesheet" href="style.css">

<h1 class="inps">SELL</h1></font><br><br>

<form method="post" action="sell_add.php">

<table class="inps" style="width: 400px;">

<tr>
<td style="width: 35%;">

ITEM NAME:

</td>

<td style="width: 65%;">

<input id="name" type="text" name="iname" maxlength="52" />

</td>

</tr>

<tr>

<td style="width: 35%;">

QUANTITY:

</td>

<td style="width: 65%;">

<input id="quantity" type="QUANTITY" name="quant"


maxlength="16" />

</td>

</tr>

<tr>

<td style="width: 35%;">

PRICE:

</td>

<td style="width: 65%;">

<input id="price" type="text" name="price" maxlength="2048" />

</td>
</tr>

<tr>

<td></td>

<td style="width: 65%;">

<button type="submit" name="submit">Submit</button>

</td>

</tr>

</table>

</form>

</center>

</form>

</body>

</html>

sell_add.php

<?php

include "db.inc.php";

include "session.php";

$uid=$_SESSION['uid'];

if (isset($_POST['submit'])){

$iname = $_POST['iname'];

$quant = $_POST['quant'];

$price = $_POST['price'];
$ses_sql = mysqli_query($conn,"SELECT * FROM users WHERE uid= '$uid'
");

$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);

$currency = $row['currency'];

if (empty($iname)||empty($quant)||empty($price)){

$empty = "";

if(empty($iname)){

$empty .= " iname";

if(empty($price)){

$empty .= " Price";

if(empty($quant)){

$empty .= " quant";

mysqli_close($conn);

echo' <script> alert("Fill out all the fields".$empty);</script>' ;

else{

$sql = "INSERT INTO fts.sell_table (iname, quant,


price,uid,currency) VALUES('$iname','$quant','$price','$uid','$currency')";

if(mysqli_query($conn,$sql))

{
mysqli_close($conn);

echo' <script> alert("Product added


succefully");window.location.assign("main.php");</script>' ;

else{

echo "Error: " . $sql . "<br>" . mysqli_error($conn);

else{

mysqli_close($conn);

echo' <script> alert("Please enter values in the


fields");window.location.assign("sell.php");</script>' ;

?>

16 changes: 16 additions & 0 deletions16

session.php

@@ -0,0 +1,16 @@

<?php

include('db.inc.php');

session_start();

$user_check = $_SESSION['uid'];

$ses_sql = mysqli_query($conn,"SELECT * FROM users WHERE uid=


'$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);

$login_session = $row['name'];

if(!isset($_SESSION['uid'])){

echo "nein";

?>

signup.html

<html>

<head>

<title>Table Align Demo</title>

<script type="text/javascript">

function ValidateForm()

var nameB = document.getElementById ("name");

if (nameBox.value.length == 0)

alert ("Enter name.");

return false;

var re = /^\w+(?:\s\w+){0,3}$/;

if (!nameBox.value.match (re))

{
alert ("Invalid name.");

return false;

var pwBox = document.getElementById ("password");

if (pwBox.value.length < 6)

alert ("Password is too short.");

return false;

if (pwBox.value.length > 16)

alert ("Password is too long.");

return false;

re = /^\S{6,16}$/;

if (!pwBox.value.match (re))

alert ("Invalid password.");

return false;

re = /^\d{7,16}$/;

var telBox = document.getElementById ("telephone");

if (telBox.value.length > 0)
{

if (!telBox.value.match (re))

alert ("Invalid telephone number.");

return false;

re = /^\w+([\.\-\+]\w+)*@\w+(\-\w+)*\.\w+(\-\w+)*(\.\w+(\-\w+)*)*$/;

var emailBox = document.getElementById ("email");

if (!emailBox.value.match (re))

alert ("Invalid email address: " + emailBox.value);

return false;

var maleBox = document.getElementById ("male");

var femaleBox = document.getElementById ("female");

if(!maleBox.checked && !femaleBox.checked)

alert ("Specify gender");

return false;

alert("Successfull");

return true;
}

</script>

<title>Signup</title>

<link rel="stylesheet" href="style.css">

</head>

<body background="queen.jpg">

<form method="get" action="main.htm">

<h1 class="inp" style="text-align: center">Sign Up</h1>

<form method="post" action="signup_add.php">

<center>

<table class="inp" style="width: 400px;">

<tr>

@@ -92,52 +17,52 @@

NAME:

</td>

<td style="width: 65%;">

<input id="name" type="text" name="NAME" maxlength="52" />

<input id="name" type="text" name="name" maxlength="52" />

</td>

</tr>

<tr>

<td style="width: 35%;">

PASSWORD:
EMAIL:

</td>

<td style="width: 65%;">

<input id="password" type="PASSWORD" name="PASSWORD"


maxlength="16" />

<input id="email" type="text" name="email" maxlength="2048" />

</td>

</tr>

<tr>

<td style="width: 35%;">

EMAIL:

PASSWORD:

</td>

<td style="width: 65%;">

<input id="email" type="text" name="EMAIL" maxlength="2048" />

<input id="password" type="PASSWORD" name="password"


maxlength="16" />

</td>

</tr>

<tr>

<td style="width: 35%;">

PHONE NO:

</td>
<td style="width: 65%;">

<input id="phone no" type="text" name="PHONE NO" maxlength="16"


/>

<input id="phone_no" type="text" name="phone_no"


maxlength="16" />

</td>

</tr>

<tr>

<td style="width: 35%;">

GENDER:

</td>

<td style="width: 65%;">

<input id="male" type="radio" value="Male" name="gender"


checked/>Male

<input id="female" type="radio" value="Female" name="gender"


/>Female

<input id="gender" type="radio" value="Male" name="gender"


checked/>Male

<input id="gender" type="radio" value="Female" name="gender"


/>Female

</td>

</tr>

<tr>

<td style = "width:35%;">

CURRENCY:
</td>

<td style = "width:35%;"><input type="radio" id="group3"


name="group3" value="INR" checked>INR<input type="radio" id="group3"
name="group3" value="usd">USD</td>

<td style = "width:35%;"><input type="radio" id="group3"


name="group3" value="INR" checked>INR<input type="radio" id="group3"
name="group3" value="USD">USD</td>

</tr>

<tr>

<td colspan="2" style="width: 100%;">

<input type="submit" value="Submit" onclick="king.html" />

<button type="submit" name="submit">Submit</button>

</td>

</tr>

</table>

</html>

signup_add.php

<?php

include "db.inc.php";

if (isset($_POST['submit'])){

$name = $_POST['name'];

$email = $_POST['email'];

$pass = $_POST['password'];

$phone_no=$_POST['phone_no'];
$gender = $_POST['gender'];

$currency = $_POST['group3'];

if (empty($name)||empty($email)||empty($pass)||empty($phone_no)||
empty($gender)||empty($currency)){

$empty = "";

if(empty($name)){

$empty .= " Name";

if(empty($phone_no)){

$empty .= " Contact Number";

if(empty($pass)){

$empty .= " Password";

if(empty($currency)){

$empty .= " Currency";

if(empty($gender)){

$empty .= " Gender";

if(empty($email)){

$empty .= " Email";

}
mysqli_close($conn);

echo' <script> alert("Fill out all the fields".$empty);</script>' ;

else{

if (!filter_var($email,FILTER_VALIDATE_EMAIL)){

mysqli_close($conn);

echo' <script> alert("Invalid Email") ;</script>';

header("Location: index.php?invalid+email");

else{

if (!preg_match('/^[0-9]*$/',$phone_no) || strlen($phone_no) != 10){

mysqli_close($conn);

echo' <script> alert("Invalid+Number");</script>' ;

else{

$sql = "SELECT * FROM fts.users WHERE email = \"$email\"";

$result = mysqli_query($conn,$sql);

$resultCheck = mysqli_num_rows($result);

if ($resultCheck > 0){

mysqli_close($conn);

echo' <script> alert("Already


registered");window.location.assign("index.html");</script>' ;

}
else{

$sql = "INSERT INTO fts.users (name, email, password, phone_no,


gender ,currency)
VALUES('$name','$email','$pass','$phone_no','$gender','$currency')";

if(mysqli_query($conn,$sql))

mysqli_close($conn);

echo' <script> alert("Registration


successful");window.location.assign("index.html");</script>' ;

else{

echo "Error: " . $sql . "<br>" . mysqli_error($conn);

else{

mysqli_close($conn);

echo' <script> alert("Please enter values in the


fields");window.location.assign("signup.html");</script>' ;

?>
style.css

.inp{

font: verdana;color: WHITE;

.button{

display: block;width: 115px;height: 25px;background-color:


transparent;background-repeat:no-repeat;padding: 10px;text-align: center;text-
decoration: none;

border-radius: 5px;

color: white;

font-weight: bold;

.button_main{

display: block;width: 115px;height: 25px;background-color:


transparent;background-repeat:no-repeat;padding: 10px;text-align: center;text-
decoration: none;

border-radius: 5px;

color: black;

font-weight: bold;

.inps{

font: verdana;color: Black;

transaction.html
<!DOCTYPE html>

<html lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Transaction</title>

</head>

<link rel="stylesheet" href="style .css">

<link rel="stylesheet" href="style.css">

<body background=queen.jpg>

<center>

<h1 class='inp'>New Transaction</h1>

<table class="inp">

<tr>

<td>

<a class="button" href="sell.php">Sell</a></td>

<a class="button inp" href="sell.php">Sell</a></td>

<td>

<a class="button" href="buy.php">Buy</a></td>

<a class="button inp" href="buy.php">Buy</a></td>

</tr>

</table>

<center>

</body>
</html>

RESULT:

Thus the modified Implementation of foreign trading system was done


successfully.

You might also like