+ All Categories
Home > Documents > Kristina Lundqvist ( @mdh.se) · PDF fileWeb technologies play a prominent role in the daily...

Kristina Lundqvist ( @mdh.se) · PDF fileWeb technologies play a prominent role in the daily...

Date post: 02-Mar-2018
Category:
Upload: vutu
View: 212 times
Download: 0 times
Share this document with a friend
62
1 Comparison of Web Development Technologies ASP.NET & PHP Master Thesis in Software Engineering Author: Ramesh Nagilla ([email protected] ) Supervisor: Frank Lüders ([email protected] ) Examiner: Kristina Lundqvist ([email protected] )
Transcript

1

 Comparison of Web Development Technologies ‐ ASP.NET & PHP  

                             Master Thesis in Software Engineering   

 

Author:  

Ramesh Nagilla ([email protected]

Supervisor:

Frank Lüders ([email protected])

Examiner:

Kristina Lundqvist ([email protected])

2

Abstract

Web applications play an important role for many business purpose activities in the modern world. It has become a platform for the companies to fulfil the needs of their business. In this situation, Web technologies that are useful in developing these kinds of applications become an important aspect. Many Web technologies like Hypertext Preprocessor (PHP), Active Server Pages (ASP.NET), Cold Fusion Markup Language (CFML), Java, Python, and Ruby on Rails are available in the market. All these technologies are useful to achieve the goals of Clients and business organizations. ASP.NET and PHP are the most competing out of all the technologies. Most of the companies and developers think that one is better than other. The main aim of this thesis is done by taking this point in to the consideration. A Photo Gallery application is developed using ASP.NET and PHP in order to compare the two Web development technologies. Many points are taken in to consideration in order to differentiate them and conclude which one is the better among the two technologies.  

3

                                       Acknowledgements 

I would like to thank my supervisor Frank Luders for his constant help, support and guidance during this thesis work. I also would like to thank my friends who have given me enough strength and support during this thesis.  

4

TableofContents1.Introduction........................................................................................................................................................8

1.1 Purpose of the document ............................................................................................................... 8 

1.2 Problem Statement ......................................................................................................................... 8 

1.3 Method followed to solve  .............................................................................................................. 8 

1.4 Target Audience .............................................................................................................................. 8 

1.5 Web Application.............................................................................................................................. 8 

1.6 Report Outline ................................................................................................................................ 9

2.Background.......................................................................................................................................................10

3.RelatedWork....................................................................................................................................................114.FieldsofWebapplications...........................................................................................................................11

5.CompetitiveWebtechnologies...................................................................................................................11

6. Photo Gallery Application functionalities ....................................................................................... 13 

6.1 Registration ................................................................................................................................... 13 

6.2 Log in ............................................................................................................................................. 14 

6.3 Photo Gallery  ............................................................................................................................... 15 

6.4 Manage Categories ....................................................................................................................... 16 

6.5 Upload Photos ............................................................................................................................... 17 

6.6 Add Comments ............................................................................................................................. 18 

7. Database ........................................................................................................................................ 19 

8. Implementation in ASP.NET ........................................................................................................... 20 

8.1 ASP.NET ......................................................................................................................................... 20

8.2 .NET Framework ............................................................................................................................ 20 

8.3 SQL Server 2008 ............................................................................................................................ 21 

8.4 ASP.NET development server ....................................................................................................... 22 

8.5 Visual Web Developer 2010 Express ............................................................................................ 22 

8.6 Master Pages................................................................................................................................. 23 

8.7 ASP.NET Content Pages ................................................................................................................ 24 

 8.7.1 MasterPage.master.cs .............................................................................................................. 24 

 8.7.2 Index.aspx.cs ............................................................................................................................. 24 

 8.7.3 login.aspx.cs .............................................................................................................................. 25 

 8.7.4 forgotpassword.aspx.cs ............................................................................................................ 25 

 8.7.5 changepassword.aspx.cs ........................................................................................................... 25 

 8.7.6 myhome.aspx.cs ........................................................................................................................ 26 

 8.7.7 manage_categories_user.aspx.cs ............................................................................................. 26 

5

 8.7.8 photoupload.aspx.cs ................................................................................................................. 26 

8.7.9 photogallery.aspx.cs .................................................................................................................. 27 

8.7.10 feedback.aspx.cs ...................................................................................................................... 27 

9. Implementation in PHP .................................................................................................................. 28 

 9.1 PHP ................................................................................................................................................ 28 

9.2 WAMP ........................................................................................................................................... 28 

9.3 Apache Server  .............................................................................................................................. 29 

9.4 MySQL ........................................................................................................................................... 30 

9.5 DreamWeaver ............................................................................................................................... 32 

9.6 PHP Content Pages ........................................................................................................................ 32 

 9.6.1 index.php .................................................................................................................................. 32 

 9.6.2 login.php ................................................................................................................................... 33 

 9.6.3 forgotpassword.php .................................................................................................................. 34 

 9.6.4 changepassword.php ................................................................................................................ 34 

 9.6.5 photogallery.php ....................................................................................................................... 34 

 9.6.6 manage_categories_user.php .................................................................................................. 35 

 9.6.7 photoupload.php ...................................................................................................................... 35 

 9.6.8 edit_description.php ................................................................................................................. 36 

 9.6.9 add_comment.php .................................................................................................................... 36 

 9.6.10 feedback.php .......................................................................................................................... 36 

10. Comparison between ASP.NET and PHP ....................................................................................... 36 

10.1 Cost ............................................................................................................................................. 40 

10.2 Operating System ........................................................................................................................ 41 

10.3 Speed  ......................................................................................................................................... 41 

10.4 Language Support ....................................................................................................................... 41 

10.5 Editors ......................................................................................................................................... 41 

10.6 Database compatibility ............................................................................................................... 41 

10.7 Coding ......................................................................................................................................... 42 

10.8 Platform Connectivity ................................................................................................................. 42 

10.10 Support ..................................................................................................................................... 42 

10.11 Tools .......................................................................................................................................... 42 

10.12 Space on the hard disk .............................................................................................................. 42 

10.13 Generating the design code automatically ............................................................................... 43 

10.16 Master Pages ............................................................................................................................ 43 

10.17 Data Controls ............................................................................................................................ 43 

6

10.18 Validation Controls ................................................................................................................... 43 

10.19 Security ..................................................................................................................................... 44 

11.  Conclusion ................................................................................................................................... 43 

12. Future Work ................................................................................................................................. 44 

13. Bibliography ................................................................................................................................. 45 

14. Appendix ...................................................................................................................................... 47 

 

  

 

7

Tableoffigures1. A typical Web ............................................................................................................................. 09 2. Various fields of Web applications..............................................................................................11 3. Usage statistics of Web technologies..........................................................................................12 4. Registration screenshot .............................................................................................................. 13 5. Log in screenshot ........................................................................................................................ 14 6. Photo Gallery screenshot ............................................................................................................ 15 7. Manage Categories screenshot ................................................................................................... 16 8. Upload Photos screenshot .......................................................................................................... 17 9. Add Comments ........................................................................................................................... 18 10. Diagram for database .................................................................................................................. 19 11. ASP.NET Architecture ................................................................................................................ 21 12. Visual Studio Working Environment ........................................................................................ 22 13. Structure of files in Visual Studio .............................................................................................. 23 14. WAMP screenshot ...................................................................................................................... 29 15. Usage statistics of Web servers..................................................................................................30 16. PHPMyAdmin screenshot .......................................................................................................... 31 17. Dreamweaver screenshot ........................................................................................................... 32 18. Default ASP.NET Website .......................................................................................................... 37 19. Structure of files for default ASP.NET Website ........................................................................ 38

8

1. Introduction

1.1 PurposeoftheDocumentThis thesis is an effort to fulfil the requirements of Mälardalen University’s Master in Software Engineering course thesis (CDT 504) in Advanced level. This allowed me to do a project in which I have to compare two Web technologies. The final part of the course is this report in which I have written all the experiences and results from this project while analyzing both the Web technologies.   1.2 ProblemStatement

Web technologies play a prominent role in the daily technical needs of almost every Business. Companies and developers choose many Web Technologies available in the market for developing their products. Two of the most competing technologies in this field are ASP.NET and PHP. Many say that the one is better that another in these two according to their own ideas and views.  By this, many are thinking to select the one that is best to implement their product. This is the problem that I am going to deal with in this thesis.  

1.3 Methodfollowedtosolvetheproblem

To achieve the goal, I have created a Web application in both the above specified technologies that looks similar in all the aspects. By doing this I got my own opinion about these two technologies. Then I tried to explain a solution to this existing problem in my own way by considering experience that I got in dealing with both the technologies. 

1.4 TargetAudienceAudience for this thesis are particularly those who want to know the most of positives and negatives from the technologies ASP.NET and PHP. Reading this thesis does not really require too much of expertise in these fields, although it’s good if they have some prior basic knowledge.   1.5 “WebApplication”–DefinitionA web application is the one that utilizes web and browser technologies to perform one or more tasks over a network, through a web browser [1]. Simply it is much more than a website. A web browser in a way uses the Web application to connect the networked tools along with the systems. These Web applications are stored on the Web servers and tools in it include PHP, ASP.NET, databases and other. They store all their data on the server and because of this there is no need for the users to spend extra on hard drives that lead to the installation.   

9

              Figure 1: A typical Web   1.6 ReportOutlineReport starts in the next chapter two with a background about the technologies and problem statement in this thesis report.  In chapter three, there are topics that will let the readers know about the use of Web technologies. Chapter four gives competitive description among the different Web technologies with a pictorial representation.   The chapter five have some important functionalities description of the Web application. The chapter six is about the database of Web application. Chapter seven consists of the ASP.NET description and its implementation part. Chapter eight is similar to the previous chapter except for the change of technology from ASP.NET to PHP.  Chapter nine have many topics that are focused towards the comparison of two technologies. Chapter ten will let the readers understand the feature differences between two technologies. Chapter eleven deals with the conclusion, followed by chapter twelve about the future work. The last two chapters thirteen and fourteen are references and Appendix of the thesis.  

10

2. BackgroundWeb applications play an important role in all kinds of Business platforms. Most of the business is running mainly because of the web applications. Web applications have become popular as they are very useful in day‐to‐day developing, maintenance and support activities of many small and big organizations. Web applications make the things easy and simple. Many things can be taken care with the help of Web application. Web application has become a part of life for everybody for completing many of their personal and professional tasks in the modern busy World.  

Numerous technologies are used by different Web development platform companies to develop various kinds of interesting and useful Web applications. There are so many web applications that are already in use and some more are in the process of development. Google Apps, Microsoft Office Live and many are the most famous Web applications.  

Some of the famous technologies are PHP, ASP.NET and Java server Pages. These three technologies are useful for the software developers for creating the dynamically generated web pages. There are also other technologies like ColdFusion Mark‐up Language, Perl and Python. ColdFusion is helpful for the development of rich Internet applications with advanced features. Practical Extraction and Reporting Language (PERL) is a dynamic high level general purpose programming language. Python is a computer programming language and also a set of software tools and libraries that was originally developed by Guido Van Rossum [14].  

As of now, the most competing technologies from the listed are the Microsoft ASP.NET and Hypertext Preprocessor PHP. Irrespective of the size, many companies are using these two technologies and producing very effective and technically advanced products. Business Clients are also very satisfied with both these technologies usage as they are fulfilling all the requirements that they need to meet.  

The big difference with the two technologies comes into picture when it comes to time, maintenance, resources, money, security, profit and many other. Small companies mostly prefer to use PHP as it is an open source that is provided for free. PHP project budget is also comparatively low than that of Microsoft ASP.NET. Big companies mostly use ASP.NET even though it is more costly when compared to the PHP.  The clients and companies that are using ASP.NET have their own set of reasons for using this technology. They are ready to buy even though it not a free source like PHP. These things make much difference and confusion among clients and new developers.  

Business Clients who are new or have different strategy plans of their business need to know which one to select according to their infrastructure, capital and resources. These are one set of people that are in confusion on which technology they need to go.  The other set of the people are actually the new developers who want to pursue their career in these domains of Web.  These two have an important purpose to look forward in this thesis and decide on the technology they want to go ahead according to their professional personalities.  

 

11

3. RelatedWork

Previously the students of MDH University compared the two technologies ASP.NET and PHP. They built a real estate web application using Active Server Pages (ASP.NET) and Eclipses Helios for PHP developers with same functional requirements. Their thesis concludes that they found the ASP.NET is more efficient and reliable while PHP is a simple scripting language. The paper also tells that the built in tools of ASP.NET helps in the faster development of code when compared to PHP (19). 

4. FieldsofWebApplicationsWeb applications are useful in many areas of business and other needs. Given below is the list of categories where in the Web technologies are useful.  

 

                                                    

 

 

 

 

                                            

Figure 2: Various fields of Web applications 

There are many Web technologies available in the market as of now. Every Web technology can deliver the same functionalities required for an application in its own style.  Considering this aspect no Web technology is less in delivering the required functionalities.  

5. CompetitiveWebTechnologies  

Some of the prominent technologies that are mostly used in developing and implementing Web applications are ASP.NET, PHP, ColdFusion, Perl, Python, J2EE, Ruby on Rails and many more. Please check the given below table for the usage of different Web technologies in the present market.  

Web Applications

Business Technology Travel Health Government Shopping Others

12

  

                       Fig 3: Usage statistics of Web technologies (16) 

Statistics are showing that PHP is in the top position as it is used by more than 24692359 Websites. The second position is taken by ASP.NET which is used by more than 19365837 Websites. Rest of the technologies are being used by some other Websites.  

By looking at the count of the Website, it is very clear that PHP takes the number one place in this aspect. The counts of its Websites are numerously more than any other Web technology. The choice of technology depends upon the personal choice. Many may consider PHP as it is free to use. But the ASP.NET which is in second position has number of users even though it is paid.  Definitely ASP.NET and PHP are competitive with one another in the market at present as of now.  

I have created a Web application called “Photo Gallery” in both the technologies. I have implemented the same functionalities in both the technologies for this application. The design of the Website is similar in both the technologies so that they look familiar in different views. Please see the application functionalities in the next chapter.  

13

6. FunctionalityofthePhotoGalleryApplicationThis section describes about the application that is implemented in this thesis. I choose an application called “Photo Gallery” for the purpose of achieving goals in this thesis. The requirements of the Photo Gallery application are as follows:  

Application must support the user accounts  Both the authenticated and anonymous users can visit the Website and view every other user 

photo  All the users must be able to create categories  The categories have names that are associated with it and useful to organize a user photo  User should provide the title, category and description of the photo in order to upload it  Authenticated users can add comments under the photo  Anonymous users can only view the comments   User should be able to view a particular photo and can filter them by category  A feedback page where in everybody can send their comments 

The implementation part is completely done and the descriptions of the functionalities are explained below along with the particular Web page screen shots.  

6.1Registration

                                                   Figure 4: Registration screenshot 

Registration option is present in the right side of home page in Website. It helps the visitors/anonymous users of website to get registered and become the user of Website. There is no need to navigate to another page as the registration option is in the first page itself. In order to register, you need to fill out the options username, password, email id, security question and 

14

answers. After filling the entire form you just need to click on the button create user. Then the user will become a registered user. This option is also available in the top right corner of the Home Page. 

6.2Login

                                     Figure 5: Login screenshot

 

Log in option is for the authenticated users who are already registered in the Photo Gallery website. The log in option is located on the top right corner of the home page. Users have to click on it and then they will be navigated to a separate page. Users are prompted to enter their email id and password and then click on the log in button down by these two options. Then the user will be able log in to the Website.  There are also the other options in this page. They are forgot password which is exactly present under the log in button. This one helps the users when they forgot their password. There is also other option underneath it which is again the registration option for the anonymous users.  

15

6.3PhotoGallery

                                          Figure 6: Photo Gallery screenshot

Photo Gallery is the main area of focus in this Web application. The left panel of this page has all the user names with in a table called “Photos of All Users”.  This has the list of registered users with a serial number and the user name. Then the remaining section of the page has all the photos available with their titles and the option “Add Comment” under every photo. These photos are the ones that are already uploaded by the users of this Web application. Both the anonymous and authenticated users can view the photos of all the users in this page.  Exactly on the top right corner of these photos panel, there is a drop down menu of the categories that states “Select Category” where in an user can select the Category of the Photos he/she want to see. There is another option next to it called as “View all”. Clicking this one you can see all the photos that are uploaded by all the users irrespective of the categories that exist in Website. 

16

 

6.4ManageCategories

                                           Figure 7: Manage Categories screenshot

Manage Categories is another Web page in the photo gallery website.  The main intention in creating this page creation is to let the authenticated users create their own categories. Because the users have to upload their photos by selecting the category they want to upload the photos according to the requirements.  In order to access this page, user needs to be logged in to their profile and if they want to add a category, they need to type in the text box which is present in the page. Then click the add option, now the user can see the category that is added by him/her in the table that is present down exactly below the text box. The table have all the categories names along with the serial numbers. 

17

6.5UploadPhotos

                                                    Figure 8: Upload Photos screenshot

This Web page is helpful to the authenticated users to upload their photos. A user needs to be logged in for accessing this page. If the users want to upload photos, then they need to fill or give the options that are need to be filled in this page. First of all, they need to select the category in which they want to upload their photo, after that they have to give the title for that particular photo. A description should be given in the next option and then users have to browse their photo from the “choose file” option. After they find their photo file they need to click on the upload photo. Then their photo is uploaded and it will be displayed in the table below with the related information.  The information table have the details of the photo with its serial number, Category Name, Title, Description, Date Added and the photo. The left panel of this page also have another table with the Categories name that already exist in this Website.  

18

6.6AddComments

                                    Figure 9: Add Comments screenshot

Add comments page is used for the purpose of commenting on a particular photo. It comes active when a user feels to comment on a certain photo. Anonymous users cannot comment on the photo of the registered users. Only the authenticated users can comment on each photo of the Website. To comment on a photo, the user need to click on add comment option below the photo which will navigate to the page which looks similar to the above figure. There is a text box to write down the comments, users just need to write the comments and then click on submit button. Then the comments are added for that particular photo.

19

7. DatabaseThis is the section that has the details of the database that I used in the Web application.  There are five tables in this database. They are category, comment, feedback, photo details and users.   

tbl_Category – This table is useful in storing the categories that are created by the users and also stores the existing categories that are already created by different users.  

tbl_Comment – This table stores the comments that are made by users for the photos in the Photo Gallery menu 

tbl_feedback – This table consists of the feedbacks that are sent by the users and visitors of the Website.  

tbl_photo_dtls – This table consists of the details of the photo that are uploaded by user. This consists of Photo name, description, Category.  

tbl_users – This table consists of the information about the users.   

 

 

                                   Figure 10: Diagram for the database  

20

8.ImplementationinASP.NETThis chapter is entirely focused on the .NET implementation part of Web application. Detailed explanation about the technologies that are used and the content pages are described in the next sections of this chapter.   

8.1ASP.NET

ASP.NET is a modern generation Web technology that is used for the development of Web sites. It was released by Microsoft Corporation. ASP.NET stands for Active Server Pages.NET and also known as server side programming language.  It is a part of .NET framework itself. It consists of many set of programming classes that are designed to satisfy many kinds of programming needs [2]. ASP.NET can be called as a Modern generation Web technology from the Microsoft.  Requirements of an ASP.NET project are Web designing language(HTML), Client side scripting language(JavaScript), Programming language(C#.NET / VB.NET) and the Web Server(IIS / ASP.NET Development Server).   

ASP.NET Website lists that there are millions of applications that are built with ASP.NET. Few applications that are in the list include Stack overflow, US Airways, The British Museum, Bing, Xbox 360, MSNBC and many. 

8.2.NETFramework

This is a framework developed by Microsoft and runs primarily on Microsoft Windows. The first version of the .NET framework was released in February 2002. For this thesis, I have used the .NET framework 3.5 which was released in November, 2007.  .NET framework model provides the facility to develop and execute the different kinds of applications in an integrated environment of Visual studio.NET. .NET framework has Common Language Runtime (CLR). This CLR handles different kinds of services such as language integration, security and memory management. .NET framework provides a language called Microsoft Intermediate Language (MSIL) and this is an independent language and platform. Programs are allowed to be developed in any .NET based language by the MSIL.  CLR can recognize the MSIL and it can compile and execute the codes of MSIL by using the JIT (Just‐In‐Time) compiler that is located in the client/local machines [5]. 

 

 

 

21

 

 

Figure 11: ASP.NET Architecture

8.3SQLServer2008The SQL Server is a Relational Database Management System that is designed to run on various platforms ranging from laptops to different large multi processor servers. In Websites, SQL server is used as backend system. SQL Server helps to administrate the database and programming tasks with its number of helpful tools. SQL Server is more robust. It is mostly used as a Server Database System even though it runs on the desktop systems [10].  The database name used in this Web application is Photo Album. Language Integrated Query (LINQ) is used in order to access the data from the database. There is another folder called App_Code in the solution explorer where the data classes are created.    Steps for creating a database connection in SQL server are as follows:   

Launch the Visual Studio Web Developer Express  Right click the database connection in the solution explorer  Select the option “create a new SQL server database”  Provide the server credentials  Provide the server name and click ok  

VB/C#,C++...

Common Language Specification

ASP.NET Web forms 

Data and XML

Base Classes

Common Language Runtime

Visu

al S

tud

io.N

ET

22

8.4ASP.NETdevelopmentserver

ASP.NET development server is developed by Microsoft. It is in‐built in visual studio and supports only ASP.NET Websites. It was introduced along with the Visual studio 2005. It can be called as personal web server. It uses different ports for different web sites. The port number will be generated at the run time. It is built to run the ASP.NET Web pages under the local host [15]. 

8.5 VisualWebDeveloper2010express

This is a free Visual Studio Web applications development environment for building and testing the next generation standard‐based Web services and applications [3]. Visual studio is an integrated development environment produced by Microsoft for .NET software. .NET framework in it supports many programming languages by allowing interoperability [18]. 

 

                   Figure 12: Visual Studio working environment  

The advantages of Visual Web Developer Express are as follows:  

An editor that helps the developer to work with CSS, HTML in all the view(Source, Design and Split) 

Debugging support for JavaScript, ASP.NET and C#. 

Strong built in support for FTP‐based web deployment and database deployment. 

IntelliSense feature for syntax highlighting and also the auto‐compilation that will help in improving the productivity. 

Helps in creating and deploying the quality Web applications quickly and easily. 

Have a rich design surface 

23

Have an ability to test the developed web applications immediately with the integrated Web server [3]. It is a freeware development environment including the components frameworks, Web server and database 

 

Figure 13: Structure of files in Visual Studio 

8.6MasterPages

Consistent design in a Website helps the visitors feel comfortable around the Website. By using a master page, the development team can give the users a global way approach to the each and every Web page [4].  

Steps to create a master page are as follows:  

I. Select the solution explorer in Visual Studio, Right click it  II. Click the add new item III. Select Visual C# from the Installed templates that are on the left side IV. Select the Master Page from the list beside it V. Name the Master page at the down VI. Click add, then the master page is created  

Master pages behave like the normal pages with in the Visual Studio Web developer express. We can add the Html and server controls to it and can manage both in the mark‐up and design view. The master page is not a true page itself. It only serves as a template for the other pages in the Site [4].

24

8.7ASP.NETContentPages

8.7.1MasterPage.master.cs

This page is concentrated on the user log in and log out functionalities. Sessions are maintained after the users are logged in. When the users logged out, the sessions are abandoned and the pages will be redirected to the home page.  

protected void Page_Load(object sender, EventArgs e) { if (Session["userId"] == null) { Response.Redirect("Login.aspx"); } else { if (Session["username"] != null) { lblwecome.Text = " Welcome " + Session["username"].ToString() + " "; }              

     8.7.2Index.aspx.cs

This page has the information about the Website and the registration option for the anonymous users where the new users have to enter the details of name, email, password and security credentials. It also has the log in option for the authenticated users which will lead them to the manage categories and profile pages.   

        if (dt.Rows.Count == 0) { string insert = "insert into tbl_users (name, email, password, confirmpassword, securityquestion, securityanswer, createddate,status) values ('" + globalFunctions.checkText(txtusername.Text) + "','" +globalFunctions.checkText( txtemail.Text) + "','" + txtpwd.Text + "','" + txtconfimpwd.Text + "','" + txtsecurityqust.Text + "','" + txtsecurityansw.Text + "','" + DateTime.Now.ToString() + "',0)"; dbFunctions.processQuery(insert); Session["name"] = txtusername.Text; string strGetUid = "Select user_id from tbl_users where email='" + txtemail.Text + "' and name='" + txtusername.Text + "'"; string strUId= dbFunctions.getSinglevalue(strGetUid); }       

25

8.7.3Login.aspx.cs

This page prompts the user to log in with the user email and the password. A user can successfully log in after this. If the password is not the correct, then the users can see a message “invalid password”.  

if (dt.Rows.Count != 0) { if (txtpwd.Text == dt.Rows[0]["password"].ToString()) { Session["userId"] = dt.Rows[0]["user_id"]; Session["username"] = dt.Rows[0]["name"].ToString(); Response.Redirect("manage_categories_user.aspx"); } else { globalFunctions.msg("invalid password", this); }  

 

8.7.4Forgotpassword.aspx.cs

This page helps as an option to the user when he/ she forget their password. Users have to enter few details in forgot password page, and then the password will be sent to their e‐mail id.  

8.7.5Changepassword.aspx.cs

This page is responsible in changing the password for an account. The user is prompted to enter the details in this page like email id, current password, new password and then the password will be changed.  

protected void btnchgpawd_Click(object sender, EventArgs e) { string str = "select * from tbl_users where password='" + globalFunctions.checkText(txtcurrpass.Text) + "' and email='" + (txtemail.Text) + "'"; DataTable dt=dbFunctions.getTable(str); if(dt.Rows.Count >0) { string strupdate = "update tbl_users set password='" + globalFunctions.checkText(txtnewpass.Text) + "',confirmpassword='" + txtnewconfim.Text + "' where email='" + txtemail.Text + "'"; dbFunctions.processQuery(strupdate); globalFunctions.msg ("Your password modified successfully “, this); Response.Redirect ("login.aspx"); }

         

26

8.7.6 Myhome.aspx.cs This page is the home for the users who logged in. This comprises of the options change password and profile deletion. The users can click on whatever option they want to use, then this page will navigate to the respective page.  

8.7.7 Manage_categories_user.aspx 

This page helps the user to add their categories to the photo gallery.  This is possible only when the user is logged in. The users can type in the name they want and click on add. Then the category name is added to the tbl_category and users can see it in the same page.  

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { filldata(); } } protected void btnadd_Click(object sender, EventArgs e) { string insert = "insert into tbl_category (category_name, user_id) values ('" +globalFunctions.checkText( txtcat.Text) + "'," + Session["userId"] + ")"; dbFunctions.processQuery(insert); globalFunctions.msg(" password you are successfully added category name", this); filldata(); clear(); }  

8.7.8 Photoupload.aspx.cs This page helps the users to add their photos. For uploading the photos, users have to follow certain steps and fill in some details. Users have to browse the file path and set it. Then the users have to fill in the details like photo name, description, and category. Then click on add which will upload the photo to the Website. Everybody can see these uploaded photos in the Website along with the details that are given by user when it was uploaded. 

if (imageupload.HasFile) { string strFilePath = Path.GetExtension(imageupload.FileName); if (strFilePath == ".jpg" || strFilePath == ".jpeg" || strFilePath==".png" ) { string fname = System.IO.Path.GetFileName(imageupload.FileName); thumbimage = fname; string filepath = MapPath("Gallery/" + thumbimage); imageupload.SaveAs(filepath);

27

string insert = "insert into tbl_photo_dtls(user_id,user_name,category_id,category_name,photo_title,photo_description,photo_path,uploadeddate)values(" + Session["userId"] + ",'" + Session["username"] + "'," + ddlcatname.SelectedValue + ",'" + ddlcatname.SelectedItem + "','" + globalFunctions.checkText(txttitle.Text) + "','" + globalFunctions.checkText(txtdesc.Text) + "','" + thumbimage + "','" + DateTime.Now.ToString() + "')"; dbFunctions.processQuery(insert); string query = "select * from tbl_photo_dtls where User_id='" + Session["userId"] + "' and category_id='" + ddlcatname.SelectedValue + "' order by photo_id desc"; DataTable dt = dbFunctions.getTable(query); if (dt.Rows.Count > 0) { grdcatefull.DataSource = dt; grdcatefull.DataBind(); } clear(); }

 8.7.9 Photogallery.aspx.cs 

This page is useful for everyone even though they are not registered. This page will let every visitor and user to check out all the photos that are uploaded in the Website until that time.      

8.7.10 Feedback.aspx.cs 

This page is useful to send a feedback or comment about the Website.  Whomsoever want to submit the feedback, they just need to fill in few details like name, email and message and then click on the submit button. The successfully sent message will appear to the user who sent the feedback at the same instance immediately after click the submit button.  

protected void btnsubmit_Click(object sender, EventArgs e) { string fed = "insert into tbl_feedback(name,email,message)values('" + globalFunctions.checkText(txtname.Text) + "','" + globalFunctions.checkText(txtmailinfo.Text) + "','" + txtcomment.Text + "')"; dbFunctions.processQuery(fed); globalFunctions.msg(" Your feedback has been sent successfully ", this); clear();

28

9.ImplementationinPHP9.1PHP

PHP is a scripting language originated early in 1995 by a software development contractor named Rasmus Lerdorf.  It developed as one of the best larger scripting languages around the globe. [6].  PHP is an open‐source scripting language for creating the dynamic Web content. PHP is one of the fastest scripting languages around the globe. PHP is easy to use. Many scripts take long time to compile and execute but it is nullified with the use of PHP code caches. PHP is possible to use Integrated Development Environments (IDE’s).  In PHP 4.0 they improved resource handling, given object oriented support, native session handling, COM/DCOM support, native java support, Perl compatible regular expression (PCRE) library. Like this we can see several other versions improving a lot supportive initiatives [7].  Most of the Website is using PHP. Some of the prominent Websites that are using PHP are Face book, Oracle and Yahoo.  

9.2WAMP

WAMP server is a web development platform on windows allowing you to create dynamic web applications with Apache and MySQL [8]. 

 

29

 

                                         Figure 14: WAMP screen shot 

It helps the developers to create Web applications by providing the in‐built Apache, PHP and MySQL database. PhpMyAdmin allows managing the database easily. WAMP have all these features inbuilt in it which will help the developers to make the development faster. 

9.3ApacheServer

Apache HTTP server was released in 1995. It is a powerful and flexible Web server. It is actively being developed. It is developed and maintained by Apace Software Foundation. Apache server is used in PHP implementation. It has the features to run virtually on all the computer platforms. In the beginning it used to run primarily on a UNIX based web server. But now, Apache runs on all the flavours of UNIX and also on Windows platform [11]. In this project, I did not installed Apache Server separately as it comes in default with the WAMP.  

Apache users have a lot of support from its Website. The usage of Apache is more when it comes to usage when compare with the other servers. The given below figure shows a pictorial representation of servers usage.  

 

30

 

                        Fig 15: Usage statistics of Web Servers [17] 

Above figure shows the comparison between the Apache server and the other type of servers.  

Apache server is the number one server that is used by many companies. Its usage percentage is 65.6 which is more than a half of the total percent. The main reason would be that it is easy and flexible to use. Next most used server is IIS with a percentage of 18. Rest of the servers share the remaining percentage of usage.  

9.4MySQL

MySQL is an open source software that is possible for anyone to use. Everybody can download the MySQL software from Internet for free. SQL stands for Structured Query Language which is a standardised language used to access the databases.  This is a relational database that stores data in separate tables which adds flexibility [20]. This is a very robust and fast relational database management system. MYSQL server controls the access to project data and makes sure that multiple users can work with it parallel with fast access. It also ensures that only the authorised user can have the access privileges [21].  

Many of Multi National Companies (MNC’s) and fast growing organizations use MySQL to save money, time keeping their high volume, critical business systems, and packaged software including industry leaders like Yahoo, Google, Twitter and Wikipedia [9].  

MySQL is easy to use and have a high performance along with the reliability. MySQL can run on 20 different platforms. Time and memory can be saved by using the MySQL.  

Given below is the code that is used for connecting MySQL database in the project:  

31

if(HOST_NAME!=LOCAL_HOST_NAME){

define ("DB_SERVER", "");

define ("DB_USER", "");

define ("DB_PASSWORD", "");

define ("DB_NAME", "");

}

else{

define ("DB_SERVER", "localhost");

// define ("DB_USER", "photoalbum");

define ("DB_USER", "root");

// define ("DB_PASSWORD", "photoalbum");

define ("DB_PASSWORD", "");

define ("DB_NAME", "photoalbum");

}

                                        Figure 16: PHPMyAdmin screenshot 

 

32

 

 

9.5Dreamweaver

Dreamweaver is a tool that is created by Adobe for creating the dynamic websites. It is a development and management program for the Websites [12].  

                                  Figure 17: Dreamweaver screenshot 

9.6PHPContentPages

This section consists of the PHP pages in the Photo gallery application. The screenshots are not provided for these pages as they are identical with the above given ASP.NET pages.  

9.6.1Index.php

This page is the home page of the application in PHP. It displays the welcome information along with the menu. There is panel in the right side of this page for the visitors to register in the Website. Users have to fill in the data like name, email, password along with the security question and answers. Then by clicking on the create user they are registered in the Website.  

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

$created_date=date("Y-m-d H:i:s");

33

$sql = "INSERT INTO tbl_users(name,email,password,confirmpassword,securityquestion,securityanswer,createddate) VALUES('".$_POST["username"]."','".$_POST["email"]."','".$_POST["password"]."','".$_POST["confirmpassword"]."','".$_POST["securityquestion"]."','".$_POST["securityanswer"]."','$created_date')";

//echo $sql;

//$resqry=mysql_query($sql) or die(mysql_error());

if(mysql_query($sql)){

$msg="You have Successfully Registered with photoalbum.com";

//$this->MemberId = mysql_insert_id();

//$this->MemberLogin("register");

}

 

9.6.2Login.php

This page handles the log in functionality for the registered users. This page prompts the users to enter the username and password in order to log in. After logging in, this page will be redirected to the profile page with the user options in the Website. 

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

$emailid=$_POST['emailid'];

$pwd=$_POST['password'];

//$_SESSION['email']=$emailid;

$sql = "SELECT name,user_id,email

FROM tbl_users WHERE email='$emailid' AND password='$pwd'";

$rs = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($rs) > 0){

$res=mysql_fetch_assoc($rs);

$dbname=$res['name'];

$_SESSION['uid']=$res['user_id'];

$_SESSION['email']=$res['email'];

$_SESSION['username']=$res['name'];

34

//print_r($_SESSION);

//die;

header('location:myhome.php');

}

9.6.3Forgotpassword.php

This page comes in handy when the user forgot their password. This Page helps the users to retrieve the password when they have forgotten.   

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

include_once INCLUDE_PATH."mailers/welcomemailer.php";

$sql = "SELECT user_id, email, name, password

FROM ".USER_TABLE."

";

$sql .= " WHERE email='".$_POST["email"]."'";

$rs = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($rs) > 0){

$arrData = mysql_fetch_assoc($rs);

}

   

9.6.4Changepassword.php

This page helps the user to change the password by entering the required information in that page. 

9.6.5Photogallery.php

This page displays the photos of all users in the website. This is not only restricted to the users for viewing it. Any visitor can view the photo gallery in the Website.    

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

$category=$_POST['category'];

$selqry="select photo_path from".PHOTO_TABLE."where category_id ='$category'";

$exec=mysql_query($selqry) or die(mysql_error());

$res=mysql_fetch_assoc($exec);

35

}

 

9.6.6Manage_categories_user.php

This will help the users to manage their categories. They can add the categories and also can select any category available in the Website in order to upload their photos.  

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

$category=$_POST['category'];

$userid=$_SESSION['uid'];

$checkcatqry="select category_id from tbl_category where category_name='$category' ";

$checkexe=mysql_query($checkcatqry) or die(mysql_error());

$num=mysql_num_rows($checkexe);

if($num==0){

$catinsert="insert into tbl_category(category_name ,user_id) values('$category','$userid')";

$qryexec=mysql_query($catinsert) or die(mysql_error());

}

if($qryexec){

$msg="Category has been Added";

}else{

$msg="Category already exists";

}

}

9.6.7Photoupload.php

This page helps the user to upload their photos. User should provide few details that are in this page in order to upload the photo.

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

if(move_uploaded_file($_FILES['photo']['tmp_name'],"uploads/".$_FILES['photo']['name'])){

$msg="upload complete";

36

}

9.6.8Edit_description.php

This page helps the user to edit the description in the photo upload page 

9.6.9Add_comment.php

A registered user can comment on any photo with the use of this add comment page.  

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

$photoid=$_GET['photoid'];

$comment=$_POST['comment'];

$addcomment="insert into tbl_comment(comment_text,user_id,photo_id) values('$comment','$uid','$photoid')";

$qryexec=mysql_query($addcomment) or die(mysql_error());

if($qryexec){

$msg="Comment added Successfully";

}

}

9.6.10Feedback.php

This page is for the purpose of sending the feedback. All the visitors and users can send the feedback using this form.  

10.ComparisonbetweenASP.NETandPHPfromadeveloper’sperspectiveChoosing the best technology among these two is a challenging task for many. I have tried to select the one from these two from my experience and many other factors.  The method of choosing one of them may depend upon different reasons. Some may think of the things like cost, platform and other may think of features and security.  

Many may select ASP.NET because of its good features and the comfortable platform features. Mostly small companies or for small projects many may consider PHP because of its easily adoptable nature. If we see in technical, they both perform the same thing with different approaches and the personalities. We can follow the one whichever is the most similar to the style of our own.  

37

Each of this technology motivates the developers and companies to select their choice. But, to consider more these motivating factors are much needed for new developers. If you want to create a Website or a new project there is a process in visual studio to be followed and it is given below:  

Creating a Website in ASP.NET 

1. Launch Microsoft Visual Studio 2. Click on File 3. Click on New Website from the File menu 4. Select your choice of language from the Installed templates 5. You can select either Visual C# or Visual Basic according to your choice 6. In the right side panel, click on ASP.NET Website 7. In the down, give the name for your Website 8. Click ok 9. You can see that the project is created  10.  On the right side panel the developer can see the relevant folders and files  11. Click on run 12. You can see that your Website is already running on ASP.NET Web development server.  

Given below is the screen shot of the Website just we have created. There are menu options “Home” and “About” with the name of the Website on the top of the page. There is an option to “Log In” for the users at top right corner of the page. And then there is also the same option with an option to “Register” in the main window part of the Website.  

 

 

      Figure 18: Default ASP.NET Website in Visual Studio  

38

 

            

 

 

 

Figure 19: Structure of files in default project 

You can see from the above procedure that a Website is created without any difficulties. These are the simple steps that can be followed and understood by all the new developers. The total Website with the needed options and file structure are created.  As I am mostly concentrating the comparison considering the new developers who want to pursue their career on the Web technologies, I am trying to explain this example.   

In the process of this creation of website, you can see one thing that the entire Website is create without writing a single line of code both in the design and the implementation part. This is an easy process where in a new developer will not get any confusion and moreover he/she understands the process step by step quickly. Developers should not get confused or they should not go to a state where they think “What to do?” Many developers will be in confusion in what way they have to proceed to create the Website. Some may think that they have to start design; some may thing that they have to start the database and by that they can complete the implementation part.  

Taking my own Web application Photo gallery into consideration, the process of creating it is easier than that of in PHP.  This is because of the development environment and the tools that are made built‐in Visual Studio by Microsoft. In PHP, you don’t have this facility. You have to do many things separately and integrate them in order to run the application. In ASP.NET, there is a possibility of creating the basic Web application without the use of code and once when you are done with it. You can start thinking about the next stop. You can create a database or browse the already existing database with the help of the SQL server that is in the Visual Studio itself.   I followed these things entirely in this process. I created a database along with the relations inside the project with the help of SQL Server. When it comes to the design part, I took CSS file that can 

39

be taken from the Visual Studio and created the design. Next, I created the content pages that I need for this Website and named them. Then I wrote the code for the functionalities that are going to be implemented in the photo gallery application. This is the best part in the Visual Studio when we want to write the code.  IntelliSense will provide the array of options that will make the references of language accessible easily [13]. The interesting thing to note here is the IntelliSense feature which is useful in the implementation of auto completion. IntelliSense serves as documentation for the functions, methods and variable names using the reflection. This helps the developers to write the code without the waste of time as it will show the options of what to write so that developers can select the appropriate. This will make the things easy, decrease the time of developing. These all features made me feel like that I have everything ready in Visual Studio so that I don’t have to look outside for additional tools or editors.  These are the main reasons why that I felt developing in ASP.NET feels better and takes you to a new level as a developer because at the same time you can do many challenging things with the programming techniques that you can do.  

As we completed the overview of ASP.NET development process, now we can look what we have in PHP development side. First of all, I estimated the tools and editors I need for the development of my application.  I had to use Apache server, MySQL. After a little search over the Internet, I found out an option called WAMP Server. WAMP have all the features that are required for the development process except for one that is in the Visual Studio. That is the IDE where we have to write the code and design. Then I have taken Adobe Dreamweaver. We can write the coding part in the PHP files of Dreamweaver and same in the case of CSS files also. The process of development in this is entirely different to Microsoft Visual Studio. Developer had to create database and its relations for the project in PHPMyAdmin. Then the development and design part was done with the file in Dreamweaver. There is an option to access the files of the project folder and the PHPMyAdmin in the local host which is accessed with the help of the WAMP. In order to run the Website, click on the project folder and then the Website will start functioning. When it comes to the coding, Dreamweaver also have IntelliSense which is helpful in writing the logic and conditions of the programs. This is the whole of process of PHP where we have to do different things on various platforms and integrate them in order to run. This process is entirely easy for well experienced and high‐end developers. But, in the case of new developers it is not so easy when compared with Microsoft Platform. In this way, ASP.NET is motivating for the developers when compared with the PHP. ASP.NET is like a ready cake to eat for the new Web developers, where in PHP is the place where you have to cook everything yourself in order to eat it.  

If you start considering the other factors to choose that which is best there are many. But again it depends upon the personality of the developer who chooses one among these two. Some may feel that PHP is a better technology than Asp.Net. Given below are purely based upon my ideas and experiences. I explored most of things from the project I have done and tried to explain them below by comparing them with many factors. Let us see them below:  

 

 

40

Given below table is for an easy understanding of the differences between ASP.NET and PHP. 

Features  ASP.NET PHP

Cost  Need to buy Free

Speed  Yes  No 

Language Support  Many No

Editors  Visual Studio Zend, Eclipse, Code Lobster, Adobe Dreamweaver, Net Beans, Context, etc., 

Database Compatibility  MS‐SQL, MySQL MS‐SQL, MySQL 

Coding   325 lines of code for main functionalities 

386 lines of code for main functionalities 

Platform Connectivity  Windows Many (Windows, LINUX, UNX)

Support  Updates are available from Microsoft 

More support from PHP forum/blog 

Tools  Available inside the Visual Studio 

Have to gather from the third party 

Space  23MB 3MB

Designing code  Automatic Manual

Data Controls  Yes  No

Validation Controls  Yes  No

Table: Feature differences between ASP.NET and PHP 

 

 

10.1 Cost 

ASP.NET is a technology by Microsoft. Companies have to buy the ASP.NET products from Microsoft. PHP is an open source technology.  It can be used without any cost. I strongly believe that many new developers will go for PHP instead of ASP.NET. Considering that the technology is free many may get attracted to it as they don’t have to pay anything to get the PHP tools. Small companies that are getting outsourced projects in many countries may also select PHP as their budget and resources are limited. That’s why I think the selection of PHP may be done mostly on criteria of free availability.  On the other side, Microsoft ASP.NET is not free and one has to buy the product in order to use it. Big companies and some new developers will get started by this to 

41

develop their web applications. Microsoft provides worth of the features through the web platform Visual Studio.  

10.2 Operating System  

ASP.NET applications are developed initially to run on the platform of Microsoft Windows. But if the related framework is added, it will run on the UNIX platform also. PHP is a platform independent. It runs on many operating systems like Windows, LINUX, UNIX and others.  

10.3 Speed 

ASP.NET has objected oriented programming approach. All ASP.NET applications are compiled. In ASP.NET the code will be turned to machine specific instructions. When you run the application it runs as the compiled code. This is different in case of PHP as it is an interpreted language. You have to run the applications directly from the code. The interpreted programs should be reduced to machine instructions while it is running which is different in the case of ASP.NET as it is directly focused toward running the machine specific instructions. Even though there is a difference in terms of execution, there are no significant speed difference in between ASP.NET and PHP.  

10.4 Language Support 

ASP.NET applications can be written in many Object oriented languages. ASP.NET has support from multiple languages. ASP.NET applications can be developed / written in the languages like C#, C++, VisualBasic.NET, Java, Python, Perl, etc., PHP is a scripting language and it does not have multiple language support.  

10.5 Editors 

ASP.NET is developed in the environment of the IDE Visual Studio. PHP have many options when it comes to the editors. PHP is editor independent and can use many. Because of PHP platform independency there are many editors for Windows, Linux and the other commercial editors. PHP editors list include many IDE’s like Zend, Eclipse, Code Lobster, Adobe Dreamweaver, Net Beans, Context, etc., 

10.6 Database Compatibility 

Mostly, ASP.NET application uses MS‐SQL which is integrated with the Visual Studio. Database creation is very simple and easy to create tables and relationships. Database diagrams are automatically achieved. MS‐SQL should be purchased by the developer in order to use it. Most of the PHP projects use MySQL for the connectivity of database in PHP. It is very much easy to use and also free of cost. Also both MS SQL and MySQL databases can be used in the two web technologies ASP.NET and PHP.  

 

 

 

42

10.7 Coding 

ASP.NET coding is not easy to understand when compared with the PHP. ASP.NET programs are written in object oriented languages for which a developer needs to work a little bit to understand the program. The understanding capacity of the developers varies. But, it is a must to have the knowledge of understanding the object oriented language to understand the ASP.NET applications. PHP applications are easy to understand as there is no need for developer to work hard for understanding it. This is possible because the PHP is a scripting language and easy to understand.  

When you consider the lines of code, the lines of code written in PHP are more than the ASP.NET. The Photo gallery applications developed for this comparison also have more lines of code in PHP than ASP.NET. The main functionalities of the project have 325 lines of code in ASP.NET when the PHP have 386. This is only for the important functionalities of the project. But when you see the design part then there will be more lines of code in PHP than ASP.NET. This showed that PHP project will have more number of lines in coding part when compared with PHP.   

10.8 Platform Connectivity 

We can run PHP applications on different platforms like Microsoft Windows, UNIX and Linux. But, this is not same in the case of ASP.NET applications. ASP.NET applications run on Windows platform. If we have to run ASP.NET applications on the other platforms like Linux, then there is a need to install the server that is compatible with it. 

10.9 Support 

In case of support there is a lot from Microsoft. They make the updates available to all that are using their product. That makes easy to upgrade and install the other supportive things with the help of Microsoft automatic updates.  In PHP, all the developers need to know about the updates from PHP forum.  

10.10 Tools 

Microsoft Visual Studio has all the tools built‐in that are needed for the application development. Where as in PHP, there is not facility like that.  

10.11 Space on the hard disk 

In the Photo gallery application, ASP.NET application has taken much space on the hard disk where in the PHP application took very less. The size of the ASP.NET application for Photo Gallery is 23.2 MB while the PHP is 3MB. That means ASP.NET application took almost 20MB more than the PHP application.  

10.12 Generating the design code automatically 

Designing part is essential for the outlook of any Website. This part takes more time usually as the developers need to take care about the design much in order to attract the Client and the users. ASP.NET makes it easy as we can generate the necessary tags from the Microsoft Visual 

43

Studio. Drag and drop technique will help the developer save much time instead of writing tags specially. In PHP, the designer need to type each and every tag for the design part which obviously consume more time than the ASP.NET.  But this generation of design code in Visual Studio is only an advantage if there are no corresponding tools for PHP.  

10.13 Master Pages 

These are very useful in maintaining the common design in the Website. It avoids the repetition of the content that is common in multiple pages. There is nothing such as Master pages in PHP, but there is a scope to implement similar kind of functionality in PHP by the use of a technique called templating. But, this templating is possible by taking the help of third party engines. Master page in ASP.NET is available in the Visual Studio IDE itself which makes things easy that that of the templating in PHP. 

10.14 Data Controls 

Data Controls that are available in ASP.NET are useful in display codes of database without writing it manually. In PHP, this can be done by writing the code manually. 

10.15 Validation Controls 

Completely most helpful feature where in there is no need to write the JavaScript code. It avoids the JavaScript for implementing the validations. There is no such kind of facility like this in PHP. Developers have to write the JavaScript code.  

10.16 Security 

ASP.NET has several models of the security and some techniques to make sure to safeguard the confidential data. PHP also offer some required measures for ensuring the security of data. But it is not best in this feature when compared with ASP.NET. This is the reason why lot of big and government organizations use ASP.NET considering this security factor. 

11.Conclusion

According to the things I have observed and the experience I got from this thesis, I strongly believe that it is not an easy decision to choose the best from these two technologies. Both can do the same things, delivers same functionalities according to their own style of working. Professionals have more scope of developing new things and can undertake new challenges in PHP. ASP.NET is very good when it comes to large applications as there are lot of options available in it to move the phase of development faster. Rich Interfaces are the easy thing that you can get from ASP.NET which is harder in PHP. Language independency makes ASP.NET available to many developers as in PHP the development should be done only with its own language. It is better to go with ASP.NET for the large projects as it has a strong platform Visual Studio which supports and provides many tools that are required. PHP will be useful for both small and large projects. Small projects are more comfortable in PHP than the large projects comparatively. Improvement in tools and controls will lead PHP to handle large projects more easily like in ASP.NET.  

44

12.FutureworkPossible future works are to be done to the Photo gallery application. For now, the users are able to update the photos. In future, there may be a possible feature like adding videos can be implemented. The registered users will be able to upload their own videos or from other source in the Website.  

While coming to the comparison, there are some frameworks in PHP like Cake PHP, Yii, Zend and many others. Comparison will be made in between the .net framework and the listed frameworks of PHP. Also the comparison can be done by taking the add‐ons and plug‐ins from both the technologies. And the comparison of Security features in both the technologies is also a possible work to do in the future.   

 

 

 

45

13.Bibliography

1. Webapp(2012). what-is-a-web-app-heres-our-definition/. Retrieved January 27, 2012, from http://web.appstorm.net/general/opinion/what-is-a-web-app-heres-our-definition/

2. Walther, S. (2004). Asp.Net Unleashed. In S. Walther, Asp.Net Unleashed (pp. 10-13). Sams publishing.

3. vwd. (2012, 03 28). Retrieved 03 23, 2012, from asp.nnet: http://www.asp.net/vwd

4. Imar Spaanjaars (2012), Beginning ASP.NET 4 in C# and VB, Wiley publishing, USA

5. Bai, Y. (2010). Practical Programming with Visual C#.NET. New Jersey: John Wiley & Sons.

6. Hudson, P. (2006). PHP in a Nutshell. Sebastopol: O'Reilly Media.

7. Gilmore, W. J. (2010). Beginning PHP and MySQl. New York: Paul Manning .

8. WAMP (2012). wampserver, Retrieved 04 12, 2012, from http://www.wampserver.com/en/

9. MySQL (2012). MySQL. Retrieved 04 10, 2012, from mysql: http://www.mysql.com/about/

10. about_sql_server. (2012). Retrieved 03 11, 2012, from quackit: http://www.quackit.com/sql_server/sql_server_2008/tutorial/about_sql_server.cfm

11. Apache. (2012). Retrieved 04 26, 2012, from uar.net: ftp://ftp.uar.net/pub/e-books/Apache%20Server%202%20Bible%20-%20HUNGRY%20MINDS.pdf

12. Dreamweaver cs5.5. (2012). Sebastopol: O'Reilly Media.

13. Microsoft (2012). Using IntelliSense. Retrieved 05 20, 2012 from http://msdn.microsoft.com/en-us/library/hcw1s69b(v=vs.71).aspxDonaldson, T. (2009). Python Second Edition. Berkeley: Peachpit.

14. Donaldson, T. (2009). Python Second Edition. Berkeley: Peachpit.

15. VisualStudio(2012). Retrieved 05 13, 2012, from msdn.microsoft.com: http://msdn.microsoft.com/en-us/library/58wxa9w5(v=vs.80).aspx

16. ASP.NET. (2012). Retrieved 03 25, 2012, from http://trends.builtwith.com: http://trends.builtwith.com/framework/ASP.NET

17. Webserver (2012). Retrieved 03 17, 2012, from http://w3techs.com: http://w3techs.com/technologies/overview/web_server/al l

18. Randolph, Nick Gardner, David Anderson, Chris (2010), Professional Visual Studio 2010, Wrox Publishers, USA.

19. Mrudula, Sneha Prabha Chandran(2011),Related Work from http://www.idt.mdh.se/utbildning/exjobb/files/TR1165.pdf 20. Micheal "Monty" Widenius, David Axmark, and My SQL AB, Retrieved 24 01 2013, from

46

http://books.google.co.in/books?hl=en&lr=&id=9c- pkLaNmqoC&oi=fnd&pg=PR9&dq=my+sql+&ots=G-rxeOW-k8&sig=31wvk57Xo9_de38g_TMweoo6Htw#v=onepage&q=my%20sql&f=false

21. Luke Welling, Laura Thomson, PHP and MY SQL, Retrieved 08 02 2013, from http://books.google.co.in/books?hl=en&lr=&id=fGzifMim4qYC&oi=fnd&pg=PA1&dq=my+sql+&ots=mCeGVV2gE9&sig=hU16yHX1WtOfj1FTDeH_0ZiZAZo#v=onepage&q=my%20sql&f=false

14. Appendix

A1. MasterPage 

This page maintains the design of the application. Consists of log in and log out functionalities.  

public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { if (Session["userId"] == null) { Response.Redirect("Login.aspx"); } else { if (Session["username"] != null) { lblwecome.Text = " Welcome " + Session["username"].ToString() + " "; } else {

47

lblwecome.Text = " Welcome" + Session["name"].ToString() + " "; } } } protected void lnklogout_Click(object sender, EventArgs e) { Session.Abandon(); Response.Redirect("index.aspx"); } }

A2. Index 

This one has the option to register along with the log in option. Index page is also useful to manage the categories and their profile.   

 public partial class index : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } lblnameno.Visible = false; } protected void btnreg_Click(object sender, EventArgs e) { string str = "select email from tbl_users where email='" + txtemail .Text+ "' "; DataTable dt = dbFunctions.getTable(str); if (dt.Rows.Count == 0) { string insert = "insert into tbl_users (name, email, password, confirmpassword, securityquestion, securityanswer, createddate,status) values ('" + globalFunctions.checkText(txtusername.Text) + "','" +globalFunctions.checkText( txtemail.Text) + "','" + txtpwd.Text + "','" + txtconfimpwd.Text + "','" + txtsecurityqust.Text + "','" + txtsecurityansw.Text + "','" + DateTime.Now.ToString() + "',0)"; dbFunctions.processQuery(insert); Session["name"] = txtusername.Text; string strGetUid = "Select user_id from tbl_users where email='" + txtemail.Text + "' and name='" + txtusername.Text + "'"; string strUId= dbFunctions.getSinglevalue(strGetUid); if(strUId!=null) { Session["userId"] = strUId; } Response.Redirect("~/manage_categories_user.aspx"); clear();

48

} else { lblnameno.Visible = true; lblnameno.Text = "Please give onther Email_ID "; } } protected void btncancel_Click(object sender, EventArgs e) { txtusername.Text="" ; txtemail.Text=""; txtpwd.Text =""; txtconfimpwd.Text="" ; txtsecurityqust.Text=""; txtsecurityansw.Text = ""; lblnameno.Visible = false; } protected void linklogin_Click(object sender, EventArgs e) { Response.Redirect("~/login.aspx"); } public void clear() { txtusername.Text = ""; txtemail.Text = ""; txtpwd.Text = ""; txtconfimpwd.Text = ""; txtsecurityqust.Text = ""; txtsecurityansw.Text = ""; } }  

A3. Photogallery 

Lets every user to check out all the photos available in the gallery. 

public partial class photogallery : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { fillusernmae(); // GetCommnets(); fillimages(); } } public void fillimages() { string dlimg = "select * from tbl_photo_dtls order by photo_id desc"; DataTable ddl = dbFunctions.getTable(dlimg);

49

if (ddl.Rows.Count > 0) { DLCategory.DataSource = ddl; DLCategory.DataBind(); ddlfillallcategorys(); } } public void ddlfillallcategorys() { string strddl = "select category_name,category_id from tbl_category order by category_id desc"; DataTable dt = dbFunctions.getTable(strddl); if (dt.Rows.Count > 0) { ddlcategory.Items.Clear(); ddlcategory.Items.Add(new ListItem("----------Select Category----------", "0")); ddlcategory.DataSource = dt; ddlcategory.DataBind(); } } public void GetCommnets( string strPhotoId) { int pid = Convert.ToInt32(ViewState["cateid"]); string strGetCommnetsQuery = "select A.name,B.comment_text from tbl_users A inner join tbl_comment B on A.user_id=B.user_id where B.Photo_id='" + strPhotoId + "' order by comment_id desc "; DataTable dtComments = dbFunctions.getTable(strGetCommnetsQuery); GridviewCommnets.DataSource = dtComments; GridviewCommnets.DataBind(); } protected void ddlfillname() { int pid=Convert.ToInt32( ViewState["cateid"]); string strddl = "select category_name,category_id from tbl_photo_dtls where user_id=" + pid; DataTable dt = dbFunctions.getTable(strddl); if (dt.Rows.Count > 0) { ddlcategory.Items.Clear(); ddlcategory.Items.Add(new ListItem("----------Select Category----------", "0")); ddlcategory.DataSource = dt; ddlcategory.DataBind(); } else { ddlcategory.Items.Clear();

50

ddlcategory.Items.Add(new ListItem("----------Select Category----------", "0")); ddlcategory.DataSource = null; ddlcategory.DataBind(); } } public void fillusernmae() { string strcate = "select * from tbl_users order by user_id desc"; DataTable dt = dbFunctions.getTable(strcate); if (dt.Rows.Count > 0) { usergrid.DataSource = dt; usergrid.DataBind(); } } protected void usergrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select") { int id = int.Parse(e.CommandArgument.ToString()); ViewState["cateid"] = id; //LinkButton name = (LinkButton)categrid.Rows[id].FindControl("category_name"); string strcate = "select * from tbl_users where user_id=" + id; DataTable dt = dbFunctions.getTable(strcate); if (dt.Rows.Count > 0) { fillimagegrid(); ddlfillname(); } else { globalFunctions.msg("No Records Found ", this); //usergrid.DataSource = null; //usergrid.DataBind(); } } } public void clear() { DLCategory.DataSource = null; DLCategory.DataBind(); ddlcategory.SelectedIndex = 0; }

51

public void fillimagegrid() { if (ViewState["cateid"] != null) { int pid = Convert.ToInt32(ViewState["cateid"]); string query = "select * from tbl_photo_dtls where user_id=" + pid; DataTable dt = dbFunctions.getTable(query); if (dt.Rows.Count > 0) { DLCategory.DataSource = dt; DLCategory.DataBind(); } else { globalFunctions.msg("No Data Found ", this); DLCategory.DataSource = null; DLCategory.DataBind(); } } else { globalFunctions.msg("Select Categoey Name ", this); } } protected void lnkviewall_Click(object sender, EventArgs e) { string query = "select * from tbl_photo_dtls order by photo_id desc"; DataTable dt = dbFunctions.getTable(query); if (dt.Rows.Count > 0) { DLCategory.DataSource = dt; DLCategory.DataBind(); } ddlcategory.Items.Clear(); string strddl = "select Category_name,Category_id from tbl_category"; DataTable dt1 = dbFunctions.getTable(strddl); if (dt1.Rows.Count > 0) { ddlcategory.Items.Add(new ListItem("----------Select Category----------", "0")); ddlcategory.DataSource = dt1; ddlcategory.DataBind(); } } protected void ddlcategory_SelectedIndexChanged(object sender, EventArgs e) {

52

if (ddlcategory.SelectedValue != "0") { int pid = Convert.ToInt32(ddlcategory.SelectedValue); string query = "select * from tbl_photo_dtls where category_id=" + pid; DataTable dt2 = dbFunctions.getTable(query); if (dt2.Rows.Count > 0) { DLCategory.DataSource = dt2; DLCategory.DataBind(); } } } protected void DLCategory_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName.ToString() == "AddComment") { string PhotoId = e.CommandArgument.ToString(); ViewState["photoid"] = PhotoId; string strSelectQuery = "Select * from tbl_photo_dtls where photo_id=" + PhotoId; DataTable dtGetPhoto = dbFunctions.getTable(strSelectQuery); imgComment.ImageUrl = "Gallery/" + dtGetPhoto.Rows[0]["photo_path"].ToString(); pnlpopup.Visible = true; lblPid.Text = PhotoId; ModalPopupExtender1.Show(); GetCommnets(PhotoId); } } protected void DLCategory_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string image = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "photo_path")); HtmlImage imggallery = (HtmlImage)e.Item.FindControl("imgGallery"); imgComment.ImageUrl = "Gallery/" + image; } } protected void btnUpdate_Click(object sender, EventArgs e) { //if (Session["userid"] != null) //{

53

// string strInserrtQuery = "Insert into tbl_comment(comment_text,photo_id) values('" + globalFunctions.checkText(txtComment.Text) + "','" + lblPid.Text + "')"; // int count = dbFunctions.processQuery(strInserrtQuery); // if (count > 0) // { // txtComment.Text = ""; // //globalFunctions.msg("Comment Added Sucessfully....", this); // ModalPopupExtender1.Hide(); // GetCommnets(); // } //} //else //{ Response.Redirect("login.aspx"); // } } }  

A4. Photoupload 

Users can add their photos along with the details, description and category.  

 public partial class photoupload : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlfill(); fillcategrid(); fillimagegrid(); fillimages(); } } public void fillimages() { string dlimg = "select * from tbl_photo_dtls"; DataTable ddl = dbFunctions.getTable(dlimg); if (ddl.Rows.Count > 0) { grdcatefull.DataSource = ddl; grdcatefull.DataBind(); } } protected void ddlfill()

54

{ string strddl = "select * from tbl_category order by category_id"; DataTable dt = dbFunctions.getTable(strddl); if (dt.Rows.Count > 0) { ddlcatname.Items.Clear(); ddlcatname.Items.Add(new ListItem("------Select Category------","0")); ddlcatname.DataSource = dt; ddlcatname.DataTextField="category_name"; ddlcatname.DataValueField="category_id"; ddlcatname.DataBind(); //ddlcatname.Items.Insert(0, "------Select Category------"); } } protected void btnupload_Click(object sender, EventArgs e) { if (btnupload.Text == "Upload Photo") { Addimages(); } } public void Addimages() { string thumbimage = ""; if (imageupload.HasFile) { string strFilePath = Path.GetExtension(imageupload.FileName); if (strFilePath == ".jpg" || strFilePath == ".jpeg" || strFilePath==".png" ) { string fname = System.IO.Path.GetFileName(imageupload.FileName); thumbimage = fname; string filepath = MapPath("Gallery/" + thumbimage); imageupload.SaveAs(filepath); string insert = "insert into tbl_photo_dtls(user_id,user_name,category_id,category_name,photo_title,photo_description,photo_path,uploadeddate)values(" + Session["userId"] + ",'" + Session["username"] + "'," + ddlcatname.SelectedValue + ",'" + ddlcatname.SelectedItem + "','" + globalFunctions.checkText(txttitle.Text) + "','" + globalFunctions.checkText(txtdesc.Text) + "','" + thumbimage + "','" + DateTime.Now.ToString() + "')"; dbFunctions.processQuery(insert);

55

string query = "select * from tbl_photo_dtls where User_id='" + Session["userId"] + "' and category_id='" + ddlcatname.SelectedValue + "' order by photo_id desc"; DataTable dt = dbFunctions.getTable(query); if (dt.Rows.Count > 0) { grdcatefull.DataSource = dt; grdcatefull.DataBind(); } //globalFunctions.msg("you are successfully Uploaded Photo ", this); clear(); } else { globalFunctions.msg("Please select the jpg or jpeg or png files only ", this); } } } public void fillimagegrid() { string query = "select * from tbl_photo_dtls where User_id='" + Session["userId"] + "' order by photo_id desc "; DataTable dt = dbFunctions.getTable(query); if (dt.Rows.Count > 0) { grdcatefull.DataSource = dt; grdcatefull.DataBind(); } else { globalFunctions.msg("Select Categoey Name ", this); } } public void fillcategrid() { string strcate = "select * from tbl_category"; DataTable dt = dbFunctions.getTable(strcate); if (dt.Rows.Count > 0) { categrid.DataSource = dt; categrid.DataBind(); } }

56

protected void categrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select") { int id = int.Parse(e.CommandArgument.ToString()); ViewState["cateid"] = id; //LinkButton name = (LinkButton)categrid.Rows[id].FindControl("category_name"); string strcate = "select * from tbl_photo_dtls where category_id=" + id+" order by photo_id desc"; DataTable dt = dbFunctions.getTable(strcate); if (dt.Rows.Count > 0) { //categrid.DataSource = dt; //categrid.DataBind(); //fillimagegrid(); grdcatefull.DataSource = dt; grdcatefull.DataBind(); } else { globalFunctions.msg("No Records Found ", this); grdcatefull.DataSource = null; grdcatefull.DataBind(); } } } public void clear() { txttitle.Text=""; txtdesc.Text=""; ddlcatname.SelectedIndex =0; } } 

B1. Index  

This is the home page of PHP application.  

<?php

define ("INCLUDE_PATH", "./");

error_reporting(0);

session_start();

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

$created_date=date("Y-m-d H:i:s");

57

$sql = "INSERT INTO tbl_users(name,email,password,confirmpassword,securityquestion,securityanswer,createddate) VALUES('".$_POST["username"]."','".$_POST["email"]."','".$_POST["password"]."','".$_POST["confirmpassword"]."','".$_POST["securityquestion"]."','".$_POST["securityanswer"]."','$created_date')";

//echo $sql;

//$resqry=mysql_query($sql) or die(mysql_error());

if(mysql_query($sql)){

$msg="You have Successfully Registered with photoalbum.com";

//$this->MemberId = mysql_insert_id();

//$this->MemberLogin("register");

} else{

$msg="Registration Failed";

}

}

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

$catname=$_POST['seacrhtext'];echo $catname;

$searchqry="select category_name from tbl_category where category_name='$catname'";echo $searchqry;

$qryexe=mysql_query($searchqry) or die(mysql_error());

if(mysql_num_rows($qryexe)==0){

echo "No Photos with such Category.Search for another Category";

}

}

?>

B2. Photogallery 

Displays the photos of every user and can be viewed by all the visitors.  

<?php

define ("INCLUDE_PATH", "./");

error_reporting(0);

58

require_once INCLUDE_PATH."lib/inc.php";

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

$category=$_POST['category'];

$selqry="select photo_path from".PHOTO_TABLE."where category_id ='$category'";

$exec=mysql_query($selqry) or die(mysql_error());

$res=mysql_fetch_assoc($exec);

}

function GeneratePageNo($intPageNo, $intTotalProfiles){

for($i=$intPageNo; $i >= $intPageNo - 5; $i--){

$arrPageNo[] = $i;

if($i==1){

break;

} }

$arrPageNo = array_reverse($arrPageNo);

for($i=$intPageNo+1; $i <= $intPageNo + 5; $i++){

if($i>ceil($intTotalProfiles/10)){

break;

}

$arrPageNo[] = $i;

}

return $arrPageNo;

}

?>  

B3. Photoupload 

The page in which user can upload his/her photos.  

<?php

session_start();

define ("INCLUDE_PATH", "./");

error_reporting(0);

59

require_once INCLUDE_PATH."lib/inc.php";

session_register("uid");

$uid = $_SESSION['uid'];

//user id

//print_r($_SESSION);

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

if(move_uploaded_file($_FILES['photo']['tmp_name'],"uploads/".$_FILES['photo']['name'])){

$msg="upload complete";

}

//user id

$userid=$_GET['id'];

//insert upload path and title name into photo tables

$path="uploads/".$_FILES["photo"]["name"];

$desc=$_POST['description'];

$categoryname=$_POST['category'];

$phototitle=$_POST['title'];

$uploadeddate= date("Y-m-d H:i:s");

$sqluploadphoto="insert into tbl_photo_dtls(user_id,user_name,category_name,photo_title,photo_description,photo_path,uploadeddate) values('$uid','$username','$categoryname','$phototitle','$desc','$path','$uploadeddate')";

//echo $sqluploadphoto;

60

$exec=mysql_query($sqluploadphoto) or die(mysql_error());

//$qry="insert into tbl_photo_dtls(photo_description,photo_path) values('$desc','$path')";

//echo "$qry";

//$qryexec=mysql_query($qry) or die(mysql_error());

//if($qry){

// $msg="Photo has been uploaded successfully";

//}

//else{

// $msg="Photo uploading failed";

//}

}

?>

B4. Add_comment 

A registered user can comment using this page. 

 

<?php

// if(isset($_POST['Create'])){

// $name = $_POST['Name'];

// $desc = $_POST['Description'];

// $uid = $_SESSION['Uid'];

//

// if(!file_exists("Users/$uid")){

// mkdir("Users/$uid",0755);

// mkdir("Users/$uid/$name",0755);

// }else{

// mkdir("Users/$uid/$name",0755);

// }

61

// $in = "INSERT INTO md_albums(Name, Description, UserId) VALUES('$name','$desc',$uid)";

// mysql_query($in);

// }

define ("INCLUDE_PATH", "./");

error_reporting(0);

require_once INCLUDE_PATH."lib/inc.php";

$uid = $_SESSION["uid"];

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

$photoid=$_GET['photoid'];

$comment=$_POST['comment'];

$addcomment="insert into tbl_comment(comment_text,user_id,photo_id) values('$comment','$uid','$photoid')";

$qryexec=mysql_query($addcomment) or die(mysql_error());

if($qryexec){

$msg="Comment added Successfully";

//header('location:manage_categories_user.php');

}

}

function getuserdets($uid) {

$userdet="select name from tbl_users where user_id=$uid";

$getuser=mysql_query($userdet) or die(mysql_error());

while($resultusr = mysql_fetch_array($getuser)) {

$username[] = $resultusr["name"];

}

echo $username[0];

}

62

function getphotodets($uid) {

$photodet="select photo_path from tbl_photo_dtls where photo_id=$uid";

$getphoto=mysql_query($photodet) or die(mysql_error());

while($resultphoto = mysql_fetch_array($getphoto)) {

$photopath[] = $resultphoto["photo_path"];

}

return $photopath[0];

}

?>


Recommended