Top Banner
2011 Abdul Muqsit – Waqas Dil CUSIT Uploader V1.0
98

Online File Storage System In PHP

Mar 11, 2015

Download

Documents

Moxet Khan

This is my final year thesis about the online file storage system designed for university students, they can upload their CV, applications, letters, EBOOK and presentations. Document consists of Database model, Data flow diagrams, Entity relationships and screen shots.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Online File Storage System In PHP

CITY UNIVERSITY OF SCIENCE & TECHNOLOGY www.cusit.edu.pk

Abdul Muqsit – Waqas Dil

2011CUSIT Uploader V1.0

Page 2: Online File Storage System In PHP

1Contents1. INTRODUCTION............................................................................................................................12

1.1. Problem area........................................................................................................................12

1.1.1. System crash................................................................................................................12

1.1.2. Drive lost/failure..........................................................................................................12

1.1.3. Unable to access files globally.....................................................................................13

1.2. Proposed solution.................................................................................................................13

1.3. Objectives............................................................................................................................13

1.4. Scope of the system.............................................................................................................13

1.5. Tools....................................................................................................................................14

1.5.1. PHP..............................................................................................................................14

1.5.1.1. Data types................................................................................................................14

1.5.1.2. Functions..................................................................................................................15

1.5.2. MySQL........................................................................................................................15

1.5.2.1. Uses of MySQL.......................................................................................................16

1.5.2.2. Platform and interfaces............................................................................................16

1.5.2.3. Command line..........................................................................................................17

1.5.2.4. MySQL versions......................................................................................................17

1.5.3. WAMP.........................................................................................................................18

1.5.3.1. Installing Wamp.......................................................................................................18

1.5.3.2. Functionalities..........................................................................................................18

1.5.3.3. How to start the server.............................................................................................19

1.5.4. CSS (Cascading Style Sheet).......................................................................................20

1.5.5. Adobe Photoshop CS 5................................................................................................21

1.5.6. Javascript.....................................................................................................................21

1.5.7. JQuery..........................................................................................................................21

2. ANALYSIS....................................................................................................................................24

2.1. Existing system....................................................................................................................24

2.2. Proposed solution.................................................................................................................24

2.3. Components to be develop...................................................................................................24

2.3 Key stack holder..................................................................................................................24

2.4 Equipment............................................................................................................................24

2.4.1 Infrastructure................................................................................................................24

2.4.2 Computer hardware......................................................................................................25

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 3: Online File Storage System In PHP

22.4.3 Communication and network.......................................................................................25

2.5 Development model.............................................................................................................26

2.5.1 Incremental development model..................................................................................26

2.5.2 Advantages of incremental model................................................................................26

2.5.3 Model implementation.................................................................................................27

2.6 Decision tree........................................................................................................................27

2.6.1 Advantages of decision tree.............................................................................................27

2.6.2 Disadvantages of decision tree.........................................................................................28

2.6.3 Decision tree for uploading system..................................................................................28

3. DESIGNING..................................................................................................................................30

3.1. Interface Design...................................................................................................................30

3.2. Detailed description of each system component..................................................................31

3.2.1. Sign In.............................................................................................................................31

3.2.2. Navigation Panel..............................................................................................................31

3.2.3. Sign Up Form..................................................................................................................31

3.2.4. Profile management.........................................................................................................32

3.2.5. File Management.............................................................................................................33

3.2.6. Back-End Admin Panel....................................................................................................35

3.2.7. Newsletter System...........................................................................................................37

3.2.8. Statistics...........................................................................................................................38

3.2.9. News manager.................................................................................................................39

3.2.10. Quota...............................................................................................................................39

3.3. Validations...........................................................................................................................40

3.3.1. Validations display..........................................................................................................40

3.3.2. User login........................................................................................................................40

3.3.3. Uploader..........................................................................................................................41

3.3.4. Sessions...........................................................................................................................41

3.3.5. Registration......................................................................................................................42

3.3.6. Administration level checks.............................................................................................43

3.3.6.1. Quota restriction..........................................................................................................43

3.3.6.2. Newsletter Checks.......................................................................................................43

3.3.6.3. Extensions....................................................................................................................44

3.4. Data flow diagrams..............................................................................................................45

3.4.1. DFD representation..........................................................................................................46

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 4: Online File Storage System In PHP

33.4.2. DFD For Login................................................................................................................47

3.4.3. DFD for Registration.......................................................................................................48

3.4.4. DFD for Uploader............................................................................................................49

3.5. Database design...................................................................................................................50

3.5.1. Entity relationship diagram..............................................................................................50

3.5.2. The design process...........................................................................................................52

3.5.2.1. Purpose of the database................................................................................................52

3.5.2.2. Required information for database...............................................................................52

3.5.2.3. Turns information into columns...................................................................................52

3.5.2.4. Data dictionary (Shown in above tables)......................................................................54

4. IMPLEMENTATION.......................................................................................................................56

4.1. Administrative functions......................................................................................................56

4.1.1. User control.....................................................................................................................56

4.1.2. Extension control.............................................................................................................57

4.1.3. Setting up quota...............................................................................................................57

4.1.4. File management..............................................................................................................58

4.1.5. Statistics...........................................................................................................................58

4.1.6. Sending newsletter...........................................................................................................59

4.1.7. Adding news....................................................................................................................59

4.1.8. Pages................................................................................................................................59

4.2. User functions......................................................................................................................60

4.2.1. User Login.......................................................................................................................61

4.2.2. Managing files.................................................................................................................61

4.2.3. Uploading........................................................................................................................62

4.2.4. Updating profile...............................................................................................................63

4.2.5. Change password.............................................................................................................63

4.2.6. Checking statistics...........................................................................................................64

5. TESTING THE SYSTEM.................................................................................................................66

5.1. Security................................................................................................................................66

5.1.1. Sessions...........................................................................................................................66

5.1.2. Availability......................................................................................................................67

5.1.3. Integrity...........................................................................................................................67

5.2. Usability..............................................................................................................................68

5.3. Test reports..........................................................................................................................69

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 5: Online File Storage System In PHP

45.3.1. Session error....................................................................................................................69

5.3.2. News letter.......................................................................................................................69

5.3.3. Overall statistics report....................................................................................................69

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 6: Online File Storage System In PHP

5TABLE OF FIGURES

FIGURE 1 SQL PLATFORM 16FIGURE 2 STARTING WAMP SERVER 19FIGURE 3 DECISION TREE OF UPLOADER 28FIGURE 4 THE NAVIGATION PANEL 31FIGURE 5 REGISTRATION FORM 32FIGURE 6 EDIT PROFILE FOR ADMINISTRATOR 33FIGURE 7 FILE MANAGER FOR STUDENTS 34FIGURE 8 ADMINISTRATION BACK-END 36FIGURE 9 SENDING NEWSETTER TO STUDENTS 37FIGURE 10 STATISTICS IN FIGURES 38FIGURE 11 STATISTICS USING GRAPH 38FIGURE 12 FRONT-END NEWS TICKER 39FIGURE 13 ASSIGN QUOTA TO STUDENTS 39FIGURE 14 RED ALERT FOR ERROR DISPLAY 40FIGURE 15 GREEN ALERT FOR SUCCESS MESSAGE 40FIGURE 16 DFD REPRESENTATION 46FIGURE 17 DFD FOR LOGIN MODULE 47FIGURE 18 DFD FOR REGISTRATION PROCESS 48FIGURE 19 DFD FOR UPLOADER 49FIGURE 20 ERD OF THE SYSTEM 51FIGURE 21 USER TABLE 52FIGURE 22 ADMIN TABLE 53FIGURE 23 FILES TABLE 53FIGURE 24 EXTENSION TABLE 54FIGURE 25 NEWS TABLE 54FIGURE 26 PAGES TABLE 54FIGURE 27 USER MANAGEMENT FOR ADMIN 56FIGURE 28 EXTENSION CONTROL 57FIGURE 29 QUOTA MANAGER 58FIGURE 30 FILE MANAGER FOR ADMINISTRATOR 58FIGURE 31 GRAPH STATISTICS FOR ADMINISTRATOR 58FIGURE 32 SENDING MASS MAIL TO THE USERS 59FIGURE 33 USER HOME PAGE 60FIGURE 34 LOGIN SCREEN 61FIGURE 35 FILE MANAGER FOR STUDENTS 61FIGURE 36 MAIN UPLOADER 62FIGURE 37 PROFILE PAGE FOR STUDENTS 63FIGURE 38 CHANGE PASSWORD SCREEN 64FIGURE 39 FILES STATISTICS 64FIGURE 40 SESSION ERROR DISPLAY 66FIGURE 41 USER AVAILIBILITY TESTING 67FIGURE 42 ENTRY CHECKING 67FIGURE 43 FRONT-END 68

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 7: Online File Storage System In PHP

6

This book is dedicated with all my heart to my parents, friends and teachers who put up with me

“disappearing” into my university during the several months that I worked on this project.

They provide the energy that powers my writing, and I love them to no end.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 8: Online File Storage System In PHP

7CUSIT Uploader

This project proposal is submitted to the Department of Computer Science, City University of Science and Information Technology as on

June 22, 2011

Author: Abdul Muqsit & Waqas Dil

Supervisor: Rashid Ahmad

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 9: Online File Storage System In PHP

8 Department of Computer ScienceCity University of Science & Information

Technology, Peshawar

Final Approval

This is certified that we have studied this project report, titled CUSIT Uploader, submitted by Abdul Muqsit and Waqas Dil University Registration Number CUP-09SG-0212-3345 and CUP-09SG-0212-3353. We conclude that this project report is of sufficient standard to warrant its acceptance by the City University of Science and Information Technology Peshawar for the award of the degree of master of computer science (MCS).

Committee

External Examiner Name______________________________________________________DesignationInstitute

Internal ExaminerName______________________________________________________DesignationInstitute

Supervisor Name______________________________________________________DesignationInstitute

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 10: Online File Storage System In PHP

9Abstract

The purpose of CUSIT uploader is to provide secure file storage where students can store important files. Although the backup will often help to save your work, should a major damage occur; you can still potentially lose all the work already completed within the window at 24. To eliminate this problem, online file storage system will provide you with continuous data protection when you upload your files to the CUSIT uploader.

Online file storage is one of the most safe and fast way to store all sensitive data that a student requires. By providing you with an extreme level of security, improved file access speed and decrease the cost of your current file storage. The system having sophisticated features and functionality providing real time file transfer free.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 11: Online File Storage System In PHP

10Declaration

I hereby declare that this software neither as a whole nor as a part thereof has been copied from any source. Further, I declare that I have developed this software and the accompanied reports entirely on the basis of my personal efforts, made under the sincere guidance of my supervisor. No portion of this work presented in this report has been submitted in support of an application for another degree or qualification of this or any other university or institution learning. If any part of this system is proved to be copied or found to be a report of some other, I will stand by the consequences.

ABDUL [email protected]

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 12: Online File Storage System In PHP

11

CHAPTER 1

INTRODUCTION

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 13: Online File Storage System In PHP

121. INTRODUCTION

If you’ve ever lost a disk or jump drive, or had your computer crash and important files vaporized, you know the benefit of having a backup of your files. The Online Storage System allows you to back up your files on the internet where they are safe and easily accessed. The simplest file hosting service built for businesses, professionals, artists, student and anyone in between. The service allows you to store your necessary files online to the file server via submitting your login credential. The system having advance features in order to be easily manage and utilize.

Initially the system is built for students only; they have the rights to upload only document extensions in specific rang of file size. There is no possibility that a user upload any streaming or large files like mp3, mp4 and so on. It will prevent bandwidth of the server as well as easier for administrator to manage files in between hundred and thousands of users at the same time.

High level front-end design and interface allows the user to manage and upload their files more efficiently in a simple way. In mostly online web-application the systems are highly developed but due to weak design and interface the users are hesitating to use them; and hence the system lack visitor count and traffic.

1.1. Problem areaFollowing are some of the problem users faces in traditional file system due to which the need of the new system is arrived, by using the online file storage system these problems can easily be overcome.

1.1.1. System crashThe first problem faces by the users is system crash, when there are lots of important data in your system and suddenly due to some viruses or any other emergency attack your system was crashed, so there is 30% chances of being the data be recovered by the data recovery software; and some time if you don’t have registered license of the recovery software so you can only recover specific file size like 100 KB and so on.

1.1.2. Drive lost/failureDrive failure occurs when a hard disk drive malfunctions and the stored information cannot be accessed with a properly configured computer. A disk failure may occur in the course of normal operation or due to an external factor such as exposure to fire or water or high magnetic waves, or suffering a sharp impact or environmental contamination, which can lead to a head crash.

In another sense if you lost your drive/disk anywhere, so you have to face such problem. All of your data in the disk can be damage or corrupt.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 14: Online File Storage System In PHP

131.1.3. Unable to access files globallyNow days the field of computer science and internet enables a user to access their files from anywhere if they have proper internet connection, if you have files/data in your local computer; so there is no chance of accessing your data outside your computer if you don’t want to share your files on internet.

1.2. Proposed solutionThe best way to solve above problem is to build an Online File Storage System where the members can upload their files and can access them anywhere via an internet connection. Further the users must have their username and password to ensure secure file transfer.

If your data lost/failure to be accessed, you can download your files from online system using your login details. The files will be saved on fast and secure servers on the internet. Initially the system is developed for the students where they can upload their CV’s, presentations, PDF, plain text and also their spreadsheets.

1.3. ObjectivesThe purpose of CUSIT uploader is to provide secure file storage where students can store important files. Although the backup will often help to save your work, should a major damage occur; you can still potentially lose all the work already completed within the window at 24. To eliminate this problem, online file storage system will provide you with continuous data protection when you upload your files to the CUSIT uploader.

Online file storage is one of the most safe and fast way to store all sensitive data that a student requires. By providing you with an extreme level of security, improved file access speed and decrease the cost of your current file storage. The system having sophisticated features and functionalities providing real time file transfer for free.

1.4. Scope of the systemOnline files management system has a number of key advantages. Here is a list of the kinds of documents that can be managed using online storage system. Student can easily store their

1. Presentations2. Curriculum vitae (CV)3. Applications/Certificates4. E-Books5. Spreadsheets6. Proposal7. Thesis8. Text files

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 15: Online File Storage System In PHP

141.5. ToolsAs our system is online, we have to use the following tools.

1.5.1. PHPFor online web solutions and application PHP is the power full and latest server side scripting language. PHP is a general-purpose scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications. PHP can be deployed on most web servers and as a standalone interpreter, on almost every operating system and platform free of charge. A competitor to Microsoft's Active Server Pages (ASP) server-side script engine and similar languages, PHP is installed on more than 20 million websites and 1 million web servers.

PHP was originally created by Rasmus Lerdorf in 1995. The main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification.[6] PHP is free software released under the PHP License; it is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP.

1.5.1.1. Data typesPHP stores whole numbers in a platform-dependent range, either a 64-bit or 32-bit signed integer equivalent to the C-language long type. Unsigned integers are converted to signed values in certain situations; this behavior is different from other programming languages. Integer variables can be assigned using decimal (positive and negative), octal, and hexadecimal notations. Floating point numbers are also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation. PHP has a native Boolean type that is similar to the native Boolean types in Java and C++.

Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl and C++. The null data type represents a variable that has no value. The only value in the null data type is NULL. Variables of the "resource" type represent references to resources from external sources.

CUSIT Uploader V1.0 - http://cusit.edu.pk

While PHP originally stood for "Personal Home Page", it is now said to stand for "PHP: Hypertext Preprocessor", a recursive acronym.

PHP VERSION5.3 RELEASED

POPULAR FRAMWORKSZENDSYMPHONYPHPCAKECOMPARISONAKELOSYII

VARIBLE DECLARATION$NAME = “MOXET”:$NUM = 1;$FLAG = TRUE;$ARRAY = ARRAY(‘1’,’2’,’3’);

Page 16: Online File Storage System In PHP

15These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources. Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in hashes with both keys and values, and the two can be intermingled.[61] PHP also supports strings, which can be used with single quotes, double quotes, nowdoc or heredoc syntax.

1.5.1.2. FunctionsPHP has hundreds of base functions and thousands more via extensions. These functions are well documented on the PHP site; however, the built-in library has a wide variety of naming conventions and inconsistencies. PHP currently has no functions for thread programming, although it does support multiprocessing programming on POSIX systems.

Additional functions can be defined by a developer:

function myFunction() { return 'MOXET';}

echo 'My name is ' . myFunction() . '!';

1.5.2. MySQLMySQL is a relational database management system (RDBMS) that runs as a server providing multi- user access to a number of databases. It is named after developer Michael Widenius' daughter, My. The SQL phrase stands for Structured Query Language.

The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation.

Free-software-open source projects that require a full-featured database management system often use MySQL. For commercial use, several paid editions are available, and offer additional functionality. Applications which use MySQL databases include: Joomla, WordPress, MyBB, phpBB, Drupal and other software built on the LAMP software stack. MySQL is also used in many high-profile, large-scale World Wide Web products, including Wikipedia, Google (though not for searches) and Facebook.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 17: Online File Storage System In PHP

161.5.2.1. Uses of MySQL

MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP web application software stack—LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python".

MySQL is used in some of the most frequently visited web sites on the Internet, including Flickr, Nokia.com, YouTube and as previously mentioned: Wikipedia, Google and Facebook.

1.5.2.2. Platform and interfacesMySQL is written in C and C++. Its SQL parser is written in yacc, and a home-brewed lexical analyzer named sql_lex.cc. MySQL works on many different system platforms, including AIX, BSDi, FreeBSD, HP-UX, eComStation, i5/OS, IRIX, Linux, Mac OS X, Microsoft Windows, NetBSD, Novell NetWare, OpenBSD, OpenSolaris, OS/2 Warp, QNX, Solaris, Symbian, SunOS, SCO OpenServer, SCO UnixWare, Sanos and Tru64. A port of MySQL to OpenVMS also exists.

Many programming languages with language-specific APIs include libraries for accessing MySQL databases. These include MySQL Connector/Net for integration with Microsoft's Visual Studio (languages such as C# and VB are most commonly used) and the ODBC driver for Java. In addition, an ODBC interface called MyODBC allows additional programming languages that support the ODBC interface to communicate with a MySQL database, such as ASP or ColdFusion. The HTSQL - URL based query method also ships with a MySQL adapter, allowing direct interaction between a MySQL database and any web client via structured URLs. The MySQL server and official libraries are mostly implemented in ANSI C/ANSI C++.

Figure 1 SQL Platform

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 18: Online File Storage System In PHP

171.5.2.3. Command lineMySQL ships with a suite of command-line tools for tasks such as querying the database, backing up data, inspecting status, performing common tasks such as creating a database, and many more. A variety of third-party command-line tools is also available, including Maatkit, which is written in Perl.

1.5.2.4. MySQL versionsMySQL Server 5.5 is currently generally available (as of December 2010). Enhancements and features include:

1. The default storage engine is InnoDB, which supports transactions and referential integrity constraints.

2. Improved InnoDB I/O subsystem [29]3. Improved SMP support [30]4. Semi synchronous replication.5. SIGNAL and RESIGNAL statement in compliance with the SQL standard.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 19: Online File Storage System In PHP

181.5.3. WAMPWAMP is an acronym formed from the initials of the operating system Microsoft Windows and the principal components of the package: Apache, MySQL and one of PHP, Perl or Python. Apache is a web server. MySQL is an open-source database.

PHP is a scripting language that can manipulate information held in a database and generate web pages dynamically each time content is requested by a browser. Other programs may also be included in a package, such as phpMyAdmin which provides a graphical user interface for the MySQL database manager, or the alternative scripting languages Python or Perl. On the other hand we have LAMP which is same as WAMP but for Linux operating system and MAMP for MAC.

1.5.3.1. Installing WampDouble click on the downloaded file and just follow the instructions. Everything is automatic. The WampServer package is delivered with the latest releases of Apache, MySQL and PHP.

Once WampServer is installed, you can add other releases by downloading them on this website. They will then appear in the WampServer menu and you will be able to switch releases with a simple click.Each release of Apache, MySQL and PHP has its own settings and its own files (data for MySQL).

1.5.3.2. FunctionalitiesWampServer's functionalities are very complete and easy to use so we won't explain here how to use them.With a left click on WampServer's icon, you will be able to:

1. Manage your Apache and MySQL services2. Switch online/offline (give access to everyone or only localhost)3. Install and switch Apache, MySQL and PHP releases4. Manage your servers settings5. Access your logs6. Access your settings files7. Create alias

With a right click :1. Change WampServer's menu language2. Access this page

1.5.3.3. How to start the serverWhen you install WampServer, a "www" directory is created (generally c:\wamp\www). Create a directory inside for your project and put your PHP files in it.Click on the link "Localhost" in the WampServer menu or open your browser and open the http://localhost address.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 20: Online File Storage System In PHP

19

Figure 2 Starting Wamp Server

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 21: Online File Storage System In PHP

201.5.4. CSS (Cascading Style Sheet)Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics (the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including plain XML, SVG and XUL.

CSS is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the layout, colors, and fonts.[1] This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple pages to share formatting, and reduce complexity and repetition in the structural content (such as by allowing for tableless web design). CSS can also allow the same markup page to be presented in different styles for different rendering methods, such as on-screen, in print, by voice (when read out by a speech-based browser or screen reader) and on Braille-based, tactile devices. While the author of a document typically links that document to a CSS style sheet, readers can use a different style sheet, perhaps one on their own computer, to override the one the author has specified.

CSS specifies a priority scheme to determine which style rules apply if more than one rule matches against a particular element. In this so-called cascade, priorities or weights are calculated and assigned to rules, so that the results are predictable.

Including CSS in your web page:

<link rel="stylesheet" href="moxet.css" type="text/css" />

Syntax:

td{color:green;width:30px;

CUSIT Uploader V1.0 - http://cusit.edu.pk

Who Maintained CSS?

The CSS specifications are maintained by the World

Wide Web Consortium (W3C). Internet media

type (MIME type) text/css is registered for use with CSS by RFC 2318 (March

1998).

Page 22: Online File Storage System In PHP

21background:#ffffff;}

1.5.5. Adobe Photoshop CS 5Adobe Photoshop is a graphics editing program developed and published by Adobe Systems Incorporated. Adobe's 2003 "Creative Suite" rebranding led to Adobe Photoshop 8's renaming to Adobe Photoshop CS. Thus, Adobe Photoshop CS5 is the 12th major release of Adobe Photoshop. The CS rebranding also resulted in Adobe offering numerous software packages containing multiple Adobe programs for a reduced price. Adobe Photoshop is released in two editions: Adobe Photoshop, and Adobe Photoshop Extended, with the Extended having extra features available. Adobe Photoshop Extended is included in all of Adobe's Creative Suite offerings except Design Standard, which includes the Adobe Photoshop edition.

Alongside Adobe Photoshop and Adobe Photoshop Extended, Adobe also publishes Adobe Photoshop Elements and Adobe Photoshop Lightroom, collectively called "The Adobe Photoshop Family" by Adobe. In 2008, Adobe released Adobe Photoshop Express, a free web-based image editing tool to edit photos directly on blogs and social networking sites.

1.5.6. JavascriptJavaScript, also known as ECMAScript, is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions. It is also considered a functional programming language like Scheme and OCaml because it has closures and supports higher-order functions.

JavaScript is an implementation of the ECMAScript language standard and is primarily used in the form of client-side JavaScript, implemented as part of a web browser in order to provide enhanced user interfaces and dynamic websites. This enables programmatic access to computational objects within a host environment.

JavaScript's use in applications outside web pages—for example in PDF documents, site-specific browsers and desktop widgets—is also significant. Newer and faster JavaScript VMs and frameworks built upon them (notably Node.js) have also increased the popularity of JavaScript for server-side web apps.

JavaScript uses syntax influenced by that of C. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics. The key design principles within JavaScript are taken from the Self and Scheme programming languages.

1.5.7. JQueryjQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig. Used by over 43% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 23: Online File Storage System In PHP

22jQuery is free, open source software, dual-licensed under the MIT License and the GNU General Public License, Version 2. jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. jQuery also provides capabilities for developers to create plugins on top of the JavaScript library. Using these facilities, developers are able to create abstractions for low-level interaction and animation, advanced effects and high-level, theme-able widgets. This contributes to the creation of powerful and dynamic web pages.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 24: Online File Storage System In PHP

23

CHAPTER 2

ANALYSIS

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 25: Online File Storage System In PHP

242. ANALYSIS

2.1. Existing systemThe system is developed for CUSIT student, before this system there was no proper online file storage system for CUSIT student. They have to transfer their files using email or USB drives; and there are lots of chances of data being lost in USB or loss of the drive.Although CUSIT having student area where they can store their files but can only be accessed within university using LAN. To avoid such problem the need of online storage system arrived.

2.2. Proposed solutionThe best way to solve above problem is to build an Online File Storage System where the members can upload their files and can access them anywhere via an internet connection. Further the users must have their username and password to ensure secure file transfer.

If your data lost/failure to be accessed, you can download your files from online system using your login details. The files will be saved on fast and secure servers on the internet. Initially the system is developed for the students where they can upload their CV’s, presentations, PDF, plain text and also their spreadsheets.

2.3. Components to be developTo ensure the proper solution for the existing system the students need the following components in order to upload their files on the system.

1. Sign up form, so that users can join in to become members.2. Allow member to upload files to the server.3. Account privacy prevent guest to access private files.4. User profile allows viewing the details about the registrar.5. A member should have full security options for own profile.6. Web site should have eye catching look and feel.7. File system allows the specific extension to be store (doc, xls, ppt).8. Sign In form, so that the user can login to his area to manage files.9. Navigation panel contain delete, copy and rename file attributes.10. News ticker in order the students informed about latest news.11. Comments box so the guest/students can comments about the system.

2.3 Key stack holder1. Students2. Developers

2.4 EquipmentIn order to develop and proper organize the file uploading system we need the following equipment. Without these equipment’s the system can’t function accurately.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 26: Online File Storage System In PHP

252.4.1 Infrastructure

2-tier (Client, Server)

2.4.2 Computer hardwarePentium II450 MHz256 MB RamNIC CardModem / DSL

2.4.3 Communication and networkAny student having internet connection and active account can access the system.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 27: Online File Storage System In PHP

262.5 Development modelAs the system is online and we have to make module of the system and develop as whole, the best idea to develop this system possible using Incremental Development Model.

2.5.1 Incremental development modelWhen an incremental model is used, the first increment is often a core product. The core product is used by the customer or undergoes a detailed review. As a result of use and/or evaluation a plan is developed for the next increment. The plan addresses the modification to the core product to better meet the needs of the customer and delivery of additional features and functionality. Software is constructed in a step-by-step manner. While a software product is being developed, each step adds to what has already been completed.

2.5.2 Advantages of incremental model1. System is developed and delivered in

increments after establishing an overall architecture.

2. Requirements and specifications for each increment may be developed.

3. Users may experiment with delivered increments while others are being developed.

4. Intended to combine some of the advantages of prototyping but with a more manageable process and better system structure.

5. Incremental development is especially useful when staffing us unavailable for a complete implementation by the business deadline.

CUSIT Uploader V1.0 - http://cusit.edu.pk

“The Incremental model combines elements of the linear sequential

model with the iterative philosophy of the prototyping. This model has been explicitly designed

to accommodate a product that evolves over time.

Page 28: Online File Storage System In PHP

276. Early increments can be implemented with fewer people.

2.5.3 Model implementation1. Any difficulty in design, coding and testing a modification should signal the need for

redesign or re-coding.2. Modifications should fit easily into isolated and easy-to-find modules. If they do not,

some redesign is possibly needed.3. Modifications to tables should be especially easy to make. If any table modification is not

quickly and easily done, redesign is indicated.4. Modifications should become easier to make as the iterations progress. If they are not,

there is a basic problem such as a design flaw or a proliferation of patches.5. Patches should normally be allowed to exist for only one or two iterations. Patches may

be necessary to avoid redesigning during an implementation phase.6. The existing implementation should be analyzed frequently to determine how well it

measures up to project goals.7. Program analysis facilities should be used whenever available to aid in the analysis of

partial implementations.8. User reaction should be solicited and analyzed for indications of deficiencies in the

current implementation.

2.6 Decision treeA decision tree is a decision support tool that uses a tree-like graph or model of decisions and their possible consequences, including chance event outcomes, resource costs, and utility. It is one way to display an algorithm. Decision trees are commonly used in operations research, specifically in decision analysis, to help identify a strategy most likely to reach a goal. Another use of decision trees is as a descriptive means for calculating conditional probabilities.

A decision Tree consists of 3 types of nodes:1. Decision nodes - commonly represented by squares.2. Chance nodes - represented by circles.3. End nodes - represented by triangles.

Drawn from left to right, a decision tree has only burst nodes (splitting paths) but no sink nodes (converging paths). Therefore, used manually, they can grow very big and are then often hard to draw fully by hand. Traditionally, decision trees have been created manually - as the aside example shows - although increasingly, specialized software is employed.

2.6.1 Advantages of decision treeAmongst decision support tools, decision trees (and influence diagrams) have several advantages:Decision trees:

Are simple to understand and interpret. People are able to understand decision tree models after a brief explanation.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 29: Online File Storage System In PHP

28 Have value even with little hard data. Important insights can be generated based on

experts describing a situation (its alternatives, probabilities, and costs) and their preferences for outcomes.

Use a white box model. If a given result is provided by a model, the explanation for the result is easily replicated by simple math.

Can be combined with other decision techniques. The following example uses Net Present Value calculations, PERT 3-point estimations (decision #1) and a linear distribution of expected outcomes (decision #2):

2.6.2 Disadvantages of decision treeFor data including categorical variables with different number of levels, information gain in decision trees are biased in favor of those attributes with more levels.

2.6.3 Decision tree for uploading systemFollowing decision tree depict the uploading process of the system.

Figure 3 Decision tree of uploader

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 30: Online File Storage System In PHP

29

CHAPTER 3

DESIGNING

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 31: Online File Storage System In PHP

303. DESIGNING

3.1. Interface DesignGeneral description of software components to be develop in next phase, these modules are developed one by one using data flow diagrams and ERD.

1. Sign Up formAllows the users to login to the system in order to upload files and mange profile.

2. Navigation PanelUse to easily switch between pages.

3. Sign In formThe user can register, in order to upload their files. The user must have to validate the email address before proceeding.

4. Profile ManagementThe feature allows the users to change name, email and security question.

5. File ManagementThe most important component of the system is file manager, where the user can manage their uploaded files.

6. Back-end Admin PanelAdministration panel for admin to control the whole system.

7. Newsletter SystemLet the user knows about the changes made by the admin.

8. StatisticsA complete statistics about how much data is uploaded on the system, also using PHP graph to show the values graphically.

9. News ManagerThis panel is developed for news management.

10. QuotaTo restrict the user not to upload more than quota size.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 32: Online File Storage System In PHP

313.2. Detailed description of each system component

3.2.1. Sign InThe component allow the student to login to their area in order to upload files, once a student login he/she can perform certain actions, the login detail is controlled by the session using PHP. It is the secure method to control the system from outside the guests. Following chunk of code allows a student to protect their area from guest login.

<?phpsession_start();if(empty($_session[username]){ $_session[msg]=”please login first”; header(“location:index.php”); exit();}else{ //rest of the code}

3.2.2. Navigation PanelThe navigation panel is used to switch between pages. A navigation bar (also known as a links bar or link bar) is a sub region of a web page that contains hypertext links in order to navigate between the pages of a website.

Since it usually appears on all or at least on several pages of a website, it is one of the key design-elements of websites – in terms of usability as well as visual attractiveness.

CUSIT Uploader V1.0 - http://cusit.edu.pk

File Manager Allows The Students To Manage Their Uploaded Files, Delete, Edit, Upload and Rename Files.

Page 33: Online File Storage System In PHP

32

Figure 4 The navigation panel

3.2.3. Sign Up FormSign up form is used to register in the system. While register the form ask about certain fields like username, email and password. In this system the field use to make unique accounts is username. You can’t register with same username twice. The sign in form is very advance and the checking of username is on the spot using JQuery. If a username is found in our database the system will shows that the username is not available.

For the recovery of password, sign in form contains security question module which allows the students to choose a unique security question and give the proper answer. The answer and questionWill be stored in the database, and when the users forget the password. The system automatically ask the same question, if the user submit wrong question the system refuse to change the password in success, the system shows two text-boxes to change the password.

<form action="register.php" method="POST"><input type="text" maxlength=20 name="username"><input type="text" maxlength=20 name="name"><input type="text" maxlength=20 name="email"><input type="password" maxlength=20 name="password"></form>

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 34: Online File Storage System In PHP

33

Figure 5 Registration form

3.2.4. Profile managementA user profile is a collection of personal data associated to a specific user. A profile refers therefore to the explicit digital representation of a person's identity. A user profile can also be considered as the computer representation of a user model.

A profile can be used to store the description of the characteristics of person. This information can be exploited by systems taking into account the persons' characteristics and preferences. For instance profiles can be used by adaptive hypermedia systems that personalize the human computer interaction.

The profile management component allows the student to change their information if they want. They can their name, email, cell number and security question. Student can’t change their username because it is unique and the files are being stored in a folder with same name.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 35: Online File Storage System In PHP

34

Figure 6 Edit profile for administrator

3.2.5. File ManagementFile management is the core component of the said system. It allows the students to manage their files. They can perform the following action on a file:

1. Rename2. Delete3. Download4. View Uploading Date5. View extension6. View ID7. View file name8. View size

The file manager is controlled using PHP sessions, each action can be performed by a single click and the student can see system messages in a verity of DIV CSS alerts.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 36: Online File Storage System In PHP

35

Figure 7 File manager for students

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 37: Online File Storage System In PHP

363.2.6. Back-End Admin PanelAdministration panel is the back bone of the system from where the administrator can control all the activities of the system. The admin panel must be highly secured because if the admin panel lacks security issues rest of the site must be unsecure. The panel consists of certain element explained briefly below and rest of them will be explains after these 5 in comprehensive details.

1. User management:User manager consists of the list of all users, whether they are active or not. Admin can control the user by means of graphical buttons, each users have their own username and email by which admin can differentiate each one. If admin want to ban/unban or activate/de-active any user he can simply done the job by a single click. Further users can be completely deleted by means of delete all action.

2. File managementLet the admin can view the files uploaded by different students, he can delete/rename the files without the permission of the user.

3. ExtensionsExtension panel allows the admin to add/remove file extensions, the extensions specified in this panel can be uploaded by the students, rest of the extension are not allowed like mp3, mp4 etc. All extensions having their respective size mentioned in the text box. The students are bound to upload the files within the specified rang of size.

4. ProfileIf admin want to change his name, email or other details, he can change in profile section.

5. PasswordAdmin can change their password using this section, admin must enter old password and new password twice in order to change the password. All the passwords are saved in form of MD5 in the database.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 38: Online File Storage System In PHP

37

Figure 8 Administration back-end

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 39: Online File Storage System In PHP

383.2.7. Newsletter SystemThe newsletter system allows the admin to send mass email to all the students of the system. The code fetches all the email to a queue and then send a single email to all the students. The system consists of latest WISIWYG editor.

WYSIWYG Editor:WYSIWYG implies a user interface that allows the user to view something very similar to the end result while the document is being created. In general WYSIWYG implies the ability to directly manipulate the layout of a document without having to type or remember names of layout commands. The actual meaning depends on the user's perspective, e.g.

WYSIWYG also describes ways to manipulate 3D models in stereochemistry, computer-aided design, 3D computer graphics and is the brand name of CAST Software's lighting design tool used in the theatre industry for pre-visualization of shows.

Figure 9 Sending newsetter to students

CUSIT Uploader V1.0 - http://cusit.edu.pk

DOWNLOADWYSIWYG IS FREE OPEN SOURCE SCRIPT, YOU CAN DOWNLOAD IT FROM

HTTP://WWW.OPENWEBWARE.COM/

Page 40: Online File Storage System In PHP

393.2.8. StatisticsThe statistic module is composed of some figure which is depicted from the values in the database about the students and files. In back-end the statistics shows

1. Total students2. Active/De-active students3. Block/Un-block4. Total files uploaded by all users5. Doc files6. Xls files7. PPt files8. Pdf files9. Txt files10. Quota

The said statistics is shown by means of charts; php chart enables us to show values in chart/graph format which is very helpful for visualization purposes.

Figure 10 Statistics in figures

Figure 11 Statistics using graph

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 41: Online File Storage System In PHP

403.2.9. News managerNews is also a core module in any online system that allows your users to know about the recent changes in your system. We also include news portion in our website and regularly updating with latest updates about the website and the services provided by us. News details are stored in the database and only headers are shown on the front-end by means of news ticker (marquee). If one wants to know about the detailed news; he can click on the specific header in order to show rest of the details.

Figure 12 Front-end news ticker

How to stop marquee on mouse hover and restart on mouse out?

<marquee onmouseover="this.stop();" onmouseout="this.start();" scrollamount="3" scrolldelay="20" style="font-size: x-small; color: #808080; width: 803px;"><p><?php echo $news; ?></p></marquee>

3.2.10. QuotaEach student must have their respective quota to upload files with in the specified size. On every upload the uploader.php will check whether the uploading file can’t exceed the quota limitation; in case of failure the uploader will stop uploading the file indicating red alert. The size of the quota is associated with each account of the students and can be re-configure from administration panel. Quota is calculated by the sum of all file sizes when uploading the files.

Figure 13 Assign quota to students

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 42: Online File Storage System In PHP

413.3. ValidationsValidation is the process in which we have to check whether the specified data entered by the user is valid or not; after checking the data then the process will be performed.

3.3.1. Validations displayThe error and notifications are controlled by means of secure sessions. The headers are moved toward the specified page after making the proper decision. All the notifications are decorated with CSS, for error the system will shows red notification with cross icon whereas for successful query it shows green strip along with green check icon.

CSS for red alert:

background:#522727;width:100%;border:thin #8b2d2d solid;font-size:x-small;-moz-border-radius: 9px;border-radius: 9px;

Figure 14 Red alert for error display

Figure 15 Green alert for success message

3.3.2. User loginThe user login area allows the student to logged in and upload the files. To check the validation whether the username and password is accurate, we made the following checks.

Username Unique. Greater than 4 characters and less than 10. Must be alpha-numeric in order to secure. White spaces not allowed and will be trim by means of

trim($_POST(“username”));The trim function will remove extra white spaces from left and right both sides of the string.

Numeric values not allowed. / and special character not allowed.

Password

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 43: Online File Storage System In PHP

42 Greater than 4 and less than 25 characters. Alpha-numeric for security. No white spaces allowed. / and special character not allowed.

3.3.3. UploaderUploader is the core component of the system where the student can upload the files to his area. The proper checks in uploader can prevent extra and large files uploading and downloading in order to save the bandwidth.Uploader having the following checks:

Size Student can upload file within the specified rang. Size must be greater than 0 KB, uploaded files less than 1KB will be discarded

automatically by means ofif($size<0 || $size>$quota){//discard}else{//upload}

Extension Student can upload only those extensions specified by the administrator, these

extensions are shown in uploader at the bottom by means of icons. Extensions outside the specified list will be discarded.

3.3.4. SessionsSecure and high checks on session can prevent guest and bots entry to the area, the system is completely protected from spam entries by means of sessions. When a student is logged in a session variable with username starts and operates until and unless the student logged out. If the session variable is empty it means the student is not authenticated and redirect him/her to the login page to log in or registers.

Code for checking authenticated users:

<?phpSession_start();If(empty($_SESSION[username])){//redirect to login.php}Else{//welcome}?>

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 44: Online File Storage System In PHP

433.3.5. RegistrationSecure and high checks in registration process are fruitful when you have lots of online members daily. The registration page consists of some mandatory checks given as follow.

Username Unique. Greater than 4 characters and less than 10. Must be alpha-numeric in order to secure. White spaces not allowed and will be trim by means of

trim($_POST(“username”));The trim function will remove extra white spaces from left and right both sides of the string.

Numeric values not allowed. / and special character not allowed.

Security question Allows the users to recover password. Must be greater than 4 and less than 10 characters.

Password Greater than 4 and less than 25 characters. Alpha-numeric for security. No white spaces allowed. / and special character not allowed. Encrypted using md5 algorithm

<?php$password = $_POST[password];$enc_pass = md5($password);?>

Email Must be Yahoo, Gmail, Ymail, Rocketmail or Hotmail mail. Email must be unique, checking using

<?phpInclude(“database.php”);$email = $_POST[email];$query = mysql_query(“select * from users where email=’$email’”);If($query>0){//email already taken.}Else{//register}?>

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 45: Online File Storage System In PHP

443.3.6. Administration level checksIt is often noticed that there are lots of possibilities that an administrator may enter invalid data. For the prevention of this problem; the system must be validated on back-end as well. If the values on back-end are not accurate; rest of the system might contains bundle of errors and exceptions. Following sections are highly checked using php functions to make the system transparent and clear from errors.

3.3.6.1. Quota restrictionChanging the quota/user will be managed by the administrator; the admin must have to enter numeric values rather than alphabets. The rang of quota lies from 1KB to 500MB; there is no possibility that the admin enters the quota out of rang by means of

Validation on quota:

<?php$quota = $_POST[quota];If($quota>50000 && $quota<1){//please enter quota site between 1KB to 500MB}Else{//change quota size.}?>

3.3.6.2. Newsletter ChecksNewsletter is an important assets of any online website; from where an admin can send mass mail to the users. If not managed properly causes some drawback. We have restrict newsletter via following

Subject Not empty

If(empty($_POST(subject))){//redirect to newsletter.php}Else{//check body}

Less than 50 character Excluding white space using trim already explain above. Numeric values not allowed. Alpha-numeric can be added to subject.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 46: Online File Storage System In PHP

45 Body

Not less than 25 characters. WYSIWYG editor prevent html tags editing

3.3.6.3. ExtensionsExtension is the core module of this system so we have to check the proper data flow of the extension in order to prevent spam uploading. Extensions are being managed by the administrator. Following are some checks to be performed before adding the extensions.

If not already added. Size must be mention in KB. Value of size must be numeric. Size value not empty Only specified extensions in selection box can be added. Streaming and large size extension not allowed.

How to check duplicate extensions?

<?phpInclude(“include/config.php”);$extension = $_POST[extension];$query = mysql_query(“select extension from extensions”);While($row=mysql_fetch_array($query)){$dbext = $row[extension];If($dbext==$extension){//extension already added}}

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 47: Online File Storage System In PHP

463.4. Data flow diagramsA data flow diagram (DFD) is a graphical representation of the "flow" of data through an information system. DFDs can also be used for the visualization of data processing (structured design).

On a DFD, data items flow from an external data source or an internal data store to an internal data store or an external data sink, via an internal process.

A DFD provides no information about the timing of processes, or about whether processes will operate in sequence or in parallel. It is therefore quite different from a flowchart, which shows the flow of control through an algorithm, allowing a reader to determine what operations will be performed, in what order, and under what circumstances, but not what kinds of data will be input to and output from the system, nor where the data will come from and go to, nor where the data will be stored (all of which are shown on a DFD).

It is common practice to draw the context-level data flow diagram first, which shows the interaction between the system and external agents which act as data sources and data sinks. On the context diagram the system's interactions with the outside world are modeled purely in terms of data flows across the system boundary. The context diagram shows the entire system as a single process, and gives no clues as to its internal organization.

This context-level DFD is next "exploded", to produce a Level 0 DFD that shows some of the detail of the system being modeled. The Level 0 DFD shows how the system is divided into sub-systems (processes), each of which deals with one or more of the data flows to or from an external agent, and which together provide all of the functionality of the system as a whole. It also identifies internal data stores that must be present in order for the system to do its job, and shows the flow of data between the various parts of the system.

Data flow diagrams (DFDs) are one of the three essential perspectives of the structured-systems analysis and design method SSADM. The sponsor of a project and the end users will need to be briefed and consulted throughout all stages of a system's evolution. With a data flow diagram, users are able to visualize how the system will operate, what the system will accomplish, and

CUSIT Uploader V1.0 - http://cusit.edu.pk

“Data flow diagrams were

proposed by Larry Constantine, the original developer of structured

design, based on Martin and Estrin's "data flow graph"

model of computation.

Page 48: Online File Storage System In PHP

47how the system will be implemented. The old system's dataflow diagrams can be drawn up and compared with the new system's data flow diagrams to draw comparisons to implement a more efficient system. Data flow diagrams can be used to provide the end user with a physical idea of where the data they input ultimately has an effect upon the structure of the whole system from order to dispatch to report. How any system is developed can be determined through a data flow diagram.

In the course of developing a set of leveled data flow diagrams the analyst/designers is forced to address how the system may be decomposed into component sub-systems, and to identify the transaction data in the data model. There are different notations to draw data flow diagrams (Yourdon & Coad and Gane & Sarson), defining different visual representations for processes, data stores, data flow, and external entities.

3.4.1. DFD representation

Data flow:Data flows show the movement of data in a specific direction from the source to the destination. It represents a packet of data. Indicate with an arrow given below.

Process:Processes show the operation performed on the data, which transform it from input to the output. The processes are represented with circle.

Sources:Sources and destination of the data are the external sources and destinations of data, which may be people, programs, organizations or other entities interacting with the system, but are outside its boundary.

Decision:Decision are taken on certain parameters, if the process is valid go to the next step else redirect to the specified step.

Figure 16 DFD representation

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 49: Online File Storage System In PHP

483.4.2. DFD For LoginThe following DFD will check whether the user is register or not, if the user is register it will start a session and redirect the user to user area.

If the username/password not found it means the user is not registered, that’s why the system will show an error message indicating invalid username or password.

Figure 17 DFD for login module

Note:The same login system will be repeated for administration as well.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 50: Online File Storage System In PHP

493.4.3. DFD for RegistrationThe following DFD representing the registration process for our system. In 2nd step the system will check whether the user is already registered by the same username or not, if his/her username already registered, it will show an error indicating that the username is already taken by someone else it will create a user in the database and shows success message.

Figure 18 DFD for registration process

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 51: Online File Storage System In PHP

503.4.4. DFD for UploaderThe most important and core module of the system is uploader, here is the DFD for uploader, first of all the system will check whether the user is authenticated or not, if successful the user will lead to uploader page, after selecting the file and click on upload button the system will check whether the quota of the said user is full or not in case of failure the system redirect the user to uploader indicating that the quota is full.

After that if quota is not full the system will check the file size whether the size exceed with the specified amount mention by the admin, in case of success the system then check that the specified file extension is allowed or not, if the extension is allowed it will upload the file and save into the database indicated success message.

Figure 19 DFD for uploader

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 52: Online File Storage System In PHP

51

3.5. Database designDatabase design is the process of producing a detailed data model of a database. This logical data model contains all the needed logical and physical design choices and physical storage parameters needed to generate a design in a Data Definition Language, which can then be used to create a database. A fully attributed data model contains detailed attributes for each entity.

The term database design can be used to describe many different parts of the design of an overall database system. Principally, and most correctly, it can be thought of as the logical design of the base data structures used to store the data. In the relational model these are the tables and views. In an object database the entities and relationships map directly to object classes and named relationships. However, the term database design could also be used to apply to the overall process of designing, not just the base data structures, but also the forms and queries used as part of the overall database application within the database management system (DBMS).

The process of doing database design generally consists of a number of steps which will be carried out by the database designer. Usually, the designer must:

Determine the relationships between the different data elements. Superimpose a logical structure upon the data on the basis of these relationships

3.5.1. Entity relationship diagramDatabase designs also include ER(Entity-relationship model) diagrams. An ER diagram is a diagram that helps to design databases in an efficient way. Attributes in ER diagrams are usually modeled as an oval with the name of the attribute, linked to the entity or relationship that contains the attribute.

Within the relational model the final step can generally be broken down into two further steps that of determining the grouping of information within the system, generally determining what are the basic objects about which information is being stored, and then determining the relationships between these groups of information, or objects. This step is not necessary with an Object database.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 53: Online File Storage System In PHP

52

Figure 20 ERD of the system

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 54: Online File Storage System In PHP

533.5.2. The design processDesigning a database consist of the following steps in order to get a full functional database. All the steps are described one by one.

3.5.2.1. Purpose of the databaseThe purpose of our database is that we can keep record of our users. Further it will store information about files uploaded by different users. We have to store only there references of the files; hard files will be saved on file system using FTP. Uploading files to database causes much problems like database size will be extremely large, there will be extra headache to restore the database.Another advantage to keeping data in the database is that we can store multiple news stories to the database and also control administrative functions.

3.5.2.2. Required information for databaseTo establish a database for the said system we need the following information to be gathered for the database.

1. Users2. Admin3. Files4. Extensions5. News6. Pages

3.5.2.3. Turns information into columnsAfter gathering required information, the next step is to turns your information into columns in details; it will show the fields of each table of the database.

1. UsersThe table is responsible to keep record of users.

Figure 21 User table

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 55: Online File Storage System In PHP

542. Admin

Admin table will provide information about administrator; the admin is the person who controls the whole site.

Figure 22 Admin table

3. FilesThis is the main table where the files uploaded by the user will be saved; the table can’t store files whereas the reference of the file like

Name ID Size Extension Path Date User

The uploaded files will be saved on the relative path on file system. The schema is design to store files within the folder as the name of the user; that’s why the name of the folder will be unique as the username is also unique. There will be no possibility of duplicate username and hence the folders must be unique.

Figure 23 Files table

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 56: Online File Storage System In PHP

554. Extensions

The table specifies the allowed extension for uploading. Only these extensions will be able to upload. The extensions are associated with unique ID.

Figure 24 Extension table

5. NewsAll news and updates will be stored in this table; identified with unique id. Latest news will be shown by means of date.

Figure 25 News table

6. PagesPages table is designed to store information about pages used in the system like about, terms and condition and faqs.

Figure 26 Pages table

3.5.2.4. Data dictionary (Shown in above tables)A data dictionary contains a list of all files in the database, the number of records in each file, and the names and types of each field. Most database management systems keep the data dictionary hidden from users to prevent them from accidentally destroying its contents.

Data dictionaries do not contain any actual data from the database, only book keeping information for managing it. Without a data dictionary, however, a database management system cannot access data from the database.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 57: Online File Storage System In PHP

56

CHAPTER 4

IMPLEMENTATION

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 58: Online File Storage System In PHP

574. IMPLEMENTATION

Following are the functionality of the system given step by step along with chunks of codes and snapshots. These are the practical implementation of the system. The system is highly developed and secure using various web-techniques will be explained in this chapter. We will take start from the administration panel.

4.1. Administrative functionsIn this chapter we will explain the functions and actions performed by the administrator on back-end. The functions are directly affected on front-end and also effected on the database.

4.1.1. User controlThis section allows the administrator to control the users by mean of different actions explained below.

The user list shows all users of the system whether they are active, ban, inactive or unban. The interface is decorated with icons and table in order the admin can arrange everything better.

Admin can perform the following actions in user list section Search by username, name and email Delete user Activate De-activate Block Un-block

Figure 27 User management for admin

Search User: When searching an account, click on any option from the radio button like email and enter the proper email like [email protected] and

press enter; it will show only the account related to this email.

Delete User: If one want to delete any user just click on the red icon next to the email portion in the table, the specified user will be delete. All the data

associated with this account will also be vanished.

Activate/Deactivate User: To activate any account without the manual confirmation of the user by email simply click on the yes button next to the

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 59: Online File Storage System In PHP

58delete icon in the table. When the user activated the status of the user also changed to active hence the icon will turned to cross indicating to de-active the user.

Block/Unblock User: To block a user from the system not to login; you can click on the Red Cross icon next to the activate icon in the table. The block

user can’t access his/her account until the admin unblock him/her. The status will also be changed with this action and the icon will turn to yes indicating to unblock the user.

4.1.2. Extension controlThe section allows the admin to add/delete extension in order the user can upload only the specified extensions. The admin must have to enter the size of the extension, if the text box for the size is empty, the system will refuse to add the extension.

Figure 28 Extension control

Add Extensions: To add any extension; choose from the list specified by <select></select> tag. It means you can only add these extensions. After

selecting the extension enter proper size of the extension in next text box and click on Add Extension. If the extension is already added the system will show red alert indicating that the extension is already added.

Delete Extension: To delete any extension just click on the red icon next to the size cell in the table for the specified icon. The system will show green message

indicating that the selected extension is deleted successfully.

4.1.3. Setting up quotaQuota is used that the user can upload only the specified size of data. The value of quota is saved in the database and when the user submits a file to upload. The system will check whether the file exceeds the quota size or not. In case of failure the system will show red message indicating that the size of the file is too much large crossing the quota. In case of success the file will be uploaded.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 60: Online File Storage System In PHP

59 Setting Up Quota: To set the new value for quota enter your limit and click on the button next to the text box. If the size of the quota is supposed to zero; the system will show red alert indicating that the specified size of the quota is invalid.

Figure 29 Quota manager

4.1.4. File managementFile management is used to manage files uploaded by the users. You can search files by name and by the users as well. The table shows the id, name, size and user of the file. If you want to delete any file just click on the Red Cross icon next to the size cell and the file will be deleted.

Figure 30 File manager for administrator

4.1.5. StatisticsThe statistics section help the admin to view the complete figures of the system including total users, active, de-active, block and unblock users. It also shows the files uploaded by the user. Another feature of the system is that it shows the statistics in graph as well.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 61: Online File Storage System In PHP

60

Figure 31 Graph statistics for administrator

4.1.6. Sending newsletterNewsletter is used to send a single email to all the user of your system. It helps in promoting your system and aware the users about any recent changes. To send a newsletter enters subject and body of the email and click on send button. Empty subject or body can’t be send.

Figure 32 Sending mass mail to the users

4.1.7. Adding newsNews section provides information about news already added or if admin want to add news to the system. The news will be stored in the database one by one and will be displayed as scrolled on the front-page.

Add News: To add news first of all enters title of the news in the text box and then briefly details of the story and click on add news. If the title or body

of the news story is empty the system will shows red alert indicating that you must enter valid title and body of the article.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 62: Online File Storage System In PHP

61Delete News: To delete any news article, just click on delete icon next to the news title in the table. The data will also be furnished from the database indicating green

message.

4.1.8. PagesAdmin has the rights to add and remove the external pages like about us, FAQ’s and terms. These pages are decorated with WYSIWYG editor which is already explained earlier in previous chapter. The pages will be stored in database and further fetch on the front-end.

4.2. User functionsAll the functions and operation associated with user is listed below in details. These are some of the distinct features of the system to keep record of the user data including uploaded files, profile and statistics. All of them will be explained one by one.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 63: Online File Storage System In PHP

62

Figure 33 User home page

“This is the user home page from where the user has to check the complete functionality of the system.

All of them are given below with snapshots and description.

”4.2.1. User LoginThe most upper layer of the system from which the authentication of the user will be checked is login. The user has to enter username and password for login. The details will be checked from the database.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 64: Online File Storage System In PHP

63

Figure 34 Login screen

4.2.2. Managing files After logging in the first step is to manage your uploaded files. In this section the user can delete and rename the files. All the mandatory information about the files are given in the file manager like the file name, extension, size and uploaded date. If a user wants to delete all the files just click on the button delete all in the bottom of the file manager.

Figure 35 File manager for students

Rename File: To rename any file just click on the rename icon next to delete icon in file manager. The system will show a text box for new name. Enter the new name for

the file and press enter. The file will be renamed.

Delete File: To delete any file just click on the red cross given after the uploaded date in the file manager. The system will show green message indicating that the file

has been delete successfully.Download File: The most commonly option used by the user is download file. To download any file just click on download icon next to rename icon in the file manager

and your file will be start downloading.

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 65: Online File Storage System In PHP

64Delete All Files: This option is used rarely, if a user wants to delete all the files from his/her account. It will delete the complete data of the user. All the files associated with the user will be vanished from the database as well as from the system files.

4.2.3. UploadingThis is the most core function of the system is that a user wants to upload files. After successful login the user has to click on upload icon given above. The file upload page will be appearing where the allowed extensions will be located at the bottom of the page indicating with

icons. Only these extensions are allowed to be uploaded. When a user submit a file and click on upload; the action page will check all the necessary validation and return an error or success message about the file. The references will be saved in the database whereas the file will be stored on the file system.

Figure 36 Main uploader

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 66: Online File Storage System In PHP

654.2.4. Updating profileUpdating profile section allows the user to view his/her profile. Further if user wants to change his/her information like full name or security question he can change them in profile section. Username can’t be change-able because it is associated with your account and when your

account is creating a folder with same name is also created in file system. As your username changes the folder name must be change but we know that username is unique in our system that’s why unable to change by the user once allotted.

Figure 37 Profile page for students

4.2.5. Change passwordIt is very necessary that a user want to change his/her password. For updating your password click on change password icon given above. The system will demand 3 text boxes. The first one indicates the old password, second is for new password and the last one is used for repeat

password. You must have to enter all of them in order to change password.

- Screenshot on next page

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 67: Online File Storage System In PHP

66

Figure 38 Change password screen

4.2.6. Checking statisticsThe user will be eager to view how much data is uploaded by him/her. For this purpose we have design a statistic page where the user can see how much files are being uploaded to the system. Statistics consists of some distinct details like total files uploaded by user, pdf files, doc files, xls and so on. The statistics is directly associated with the database values.

Figure 39 Files statistics

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 68: Online File Storage System In PHP

67

CHAPTER 5

TESTING

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 69: Online File Storage System In PHP

685. TESTING THE SYSTEM

Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test.[1] Software testing also provides an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects).

Software testing can also be stated as the process of validating and verifying that a software program/application/product:

Meets the business and technical requirements that guided its design and development;

Works as expected; and Can be implemented with the same characteristics.

5.1. SecurityThe most important concern in web-application is that they must be highly secured in order that the guests and spam can’t enter in the site to perform illegal and malicious activities. We have checked our system on various servers to check guest entry but due to the session variable initialization the guest and spam entry is not possible.

Following are some security checks performed after implementation:

5.1.1. SessionsSession can prevent the entry of a guest or spammer into the system. If the session variable for username is empty it means that the user is not authenticated and the system will redirect the user to the login page.

Figure 40 Session error display

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 70: Online File Storage System In PHP

695.1.2. AvailabilityWhen a user wants to register and the username is already taken; the system must have to response that the username is already taken by someone. If the said error doesn’t displays then the duplication of the username may be possible which cause to relieve availability.

Figure 41 User availibility testing

5.1.3. IntegrityA measure intended to allow the receiver to determine that the information which it is providing is correct. The system at login checks whether the specified information about the user is valid or not. The system checks both values and compares the user submission with database values. In case of failure the system refuses to allow the user to access files.

Figure 42 Entry checking

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 71: Online File Storage System In PHP

705.2. Usability

Usability testing is needed to check if the user interface is easy to use and understand. It is concerned mainly with the use of the application. The designed interface is designed in the most powerful industry standard graphic designing software Adobe Photoshop CS5 having the following features.

1. User friendly2. Light colors3. Representation with icons4. Error and success messages using CSS5. Navigations

Figure 43 Front-end

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 72: Online File Storage System In PHP

715.3. Test reports

5.3.1. Session error Login to the system Login fails Navigate to forgot password Page shows session error in line 2.

(Eliminated by removing empty spaces from the code).

5.3.2. News letter Admin login Navigate to newsletter page Sending newsletter. Only 1 user receive email.

(The mail function was declared outside while loop, that’s why the function send only the last user mail. The parenthesis was replaced after the mail function)

5.3.3. Overall statistics report

# Action Attempts Success Failure Percentage

1 Login 23 20 3 78%

2 Registration 5 5 0 100%

3 Uploading 10 8 2 80%

4 Downloading 87 87 0 100%

5 LAN access 5 5 0 100%

6 WAN access 34 30 4 92%

CUSIT Uploader V1.0 - http://cusit.edu.pk

Page 73: Online File Storage System In PHP

72Following are some references from which the pictures, icon and other information was gathered.

Websites:

www.iconfinder.com www.google.com www.php.net www.wampserver.com/en www.mysql.com

Softwares:

Adobe Photoshop CS5 Smart Draw WAMP Server 2.0 Microsoft Word Notepad

Fe-Amanillah[The END]

CUSIT Uploader V1.0 - http://cusit.edu.pk

References