You are on page 1of 140

A Project Report on

Social Networking Site


Submitted By

Sumik.A.Chakka Anupam.Mishra Ateeque.Shaikh


Year 2010-2011 Under Guidance of Prof.B Lal

In partial fulfillment of the requirement for quaifying Bsc (I.T.) Semester VI Examination

Western College of Commerce & Business Management


Sanpada, Navi Mumbai 400 705

-1-

Vishweshwar Education Societys

Western College of Commerce & Business Management


Plot No.2, Sector-9, Sanpada, Navi Mumbai 400 705

Affliated to University of Mumbai

CERTIFICATE
This is to certify that Project entitled _____________________________________ Undertaken at the _______________________________________________________ by Mr.____________________________ Seat No. _____________ in partial fulfillment of B.Sc (Information Technology) degree Semester VI Examination as syllabus of the University of Mumbai for academic year 2010-2011. It is further certified that she has completed all required phases of the Project.

Signature of Internal Guide HOD/Coordinator

Signature of

College Seal

Signature of External Guide Examiner

Signature of Internal

Preface

-2-

The project Social Networking is a way which allows facilitating communication, collaboration, and content sharing across networks of contacts. We have developed this project in ASP.Net and SQLServer, which are the effective web development tool and a open source. In this project, all the operation is carried out between the server and client machine. In existing systems the features like emails, blogs, chat, etc are provided by different sites. Thus, It becomes difficult for the user to use all these features at a time in the existing system .We have successfully tried to eliminate such problem and drawbacks of the existing system. This report provides the brief idea of how this web site was created and how to use it. Making it user friendly was our main ideal while developing the System. Here we, the member of project that take the privilege of the introducing the project.

Acknowledgement
It is with great pleasure that we present our first venture in real life application of computing in the form of project work. It has proved very helpful with respect to program developing techniques. We

-3-

acknowledge our sincere gratitude to all those who helped us to make this project a success. First, we extend our sincere thanks to the Principal Dr. G K Gupta and our guide & faculty Prof. Ritul Verma and Prof. B Lal for their cooperation and guidance throughout the course and briefed us from time to time a normal support and overcoming our anxiety to perform in this project. We express our gratitude to all the faculty members of IT department who turned our knowledge in field of IT in the real world. We also give thanks to those who helped us directly or indirectly during our project. We would also like to thank the computer laboratory staff for allowing us to see computers, internets and print facility at all times. Last but not least we would like to thank to my family and friends for their constant moral support.

INDEX
SR. NO.
CONTENTS OVERVIEW SYNOPSIS 1 ANALYSIS PHASE A) SITE SPECIFICATION ABOUT THE WEBSITE OBJECTIVES OF THE SITE SCOPE OF THE SITE USER OF THE SITE 1.TYPES OF USERS URL B) FEASIBILITY STUDY OPERATIONAL

PAGE NO. 7 8 12 12 12 12 13 13 14 16 16

-4-

TECHNICAL ECONOMICAL C) REQUIREMENT SPECIFICATION HARDWARE AND SOFTWARE REQUIREMNET PROJECT SCHEDULE 1. GNATT CHART 2. PERT TOOLS AND TECHNOLOGIES USED DEVELOPMENT METHODOLOGY 2

17 17 18 18 19 19 20 21 24 26 26 27 28 48 49

DESIGN PHASE
E-R DIAGRAM INFORMATION STRUCTURE SYSTEM FLOWCHART SITEMAP IMPLIMENTATION PHASE CODING SCREEN LAYOUT PUBLISHING THE WEBSITE UPLOADING TECHINQUES TESTING TESTING CONSIDERATIONS VARIOUS TYPES OF TESTING MAINTAINANCE OF THE WEBSITE FAQS (ONLINE USER MANUAL) FUTURE ENHANCEMENTS ANNEXURE DATA DICTIONARY LIST OF ABBREVATIONS REFERENCES

4 5

6 7 8 9

134 134 136 136 136 140 141 143 144 142 147 146

-5-

OVERVIEW
Social Networking Sites allow users to manage, build and represent their social networks online. They are usually (but not always) made up of other individuals; they might also include the profiles of events, companies, even political parties. They may let you add anyone in the network as your "friend" or contact, or they might ask for all connections to be agreed by both parties. They typically support the public display of networks - although they may offer privacy restrictions, or facilitate closed communities. Social networking sites are often perceived by their users as closed environments, where members talk to other members.

SYNOPSIS
1. INTRODUCTION

-6-

Social Networking Services (SNS) are changing the ways in which people use and engage with the internet and with each other. Young people particularly are quick to use the new technology in ways which increasingly blur the boundaries between their online and offline activities. Social networking services are also developing rapidly as technology changes with new mobile dimensions and features. Children and young people, who have grown up taking the internet and mobile technologies for granted, make up a significant segment of the beta generation, - the first to exploit positive opportunities and benefits of new and emerging services, but also the first to have to negotiate appropriate behaviors within new communities, and to have to identify and manage risk. Social Networking Sites allow users to manage, build and represent their social networks online. They are usually (but not always) made up of other individuals; they might also include the profiles of events, companies, even political parties. They may let you add anyone in the network as your "friend" or contact, or they might ask for all connections to be agreed by both parties. They typically support the public display of networks - although they may offer privacy restrictions, or facilitate closed communities.

2. Need of Social Networking


Loneliness is being cited as causing low-grade peripheral inflammation which, in turn, is linked to inflammatory diseases such as diabetes, cardiovascular disease, and autoimmune disorders (e.g. rheumatoid arthritis, lupus).Lack of social connection or loneliness is also associated with increased risk of cardiovascular disease. Loneliness is found to be a unique predictor of age-related differences in systolic blood pressure. The modern lifestyle is so hectic that it has become difficult to maintain social relationships by personally visiting friends and relatives. However, this does not mean that you cannot interact with them or have to stop all kinds of socializing as the modern technological developments has provided the facility of sitting at home and maintaining the social relations with the help of the computer and the internet. The social

-7-

networking sites have become the ideal source of social media that not only helps you to keep in touch with the people you know but also gives you the opportunity to develop new acquaintances with the help of this social network. Businesspersons who are engaged in online business have realized the importance of this online social media as they have accepted the fact that the social network sites are the best place for the promotion of their service and products if they want to flourish their online business. Thus, to help people to interact with their friend or make friends.And also to help the bussiness men to sale their product we are proving Social Networking Service to them through our websites.

3. Real World Application


Social networking platforms give nonprofits a forum for meeting like-minded organizations and potential supporters, and provide a medium for spreading their messages beyond the immediate community. While many people regard social networking tools as a fun diversion, some nonprofits are leveraging them to accomplish serious goals, such as increasing their visibility, helping constituents find jobs, and raising awareness about time-sensitive issues. We can use SNS to help the users to clear their doubts. Also to make the people aware by providing any social cause information. It has not taken long for social networking sites to become prevalent amongst the youth. We are also including the feature like to block any user who do abuse thing in our web site.

-8-

4. Features and Benefits of Social Networking Websites


Most social networking websites are supported by paid advertisements that appear on member pages. Because of this, most social networking websites do not carry membership charges and offer free services to all users. What does that mean? The features and benefits of social networking websites are available to companies with any budget! ShareFeature: Personal profiles. Create and customize a profile with certain content such as name, location, interests, website links, and more. Benefit: Share your story, success, services and products with the community on your social networking website. ShowFeature: Personal user image. Upload a user image to represent you on the social networking website. Benefit: The social community can put a face with your name, and come to recognize you based on your familiar avatar. SocializeFeature: Communicate with text-based comments. Many social networks allow you to communicate with friends either by private e-mail-like correspondence, public message board-like posts, or both. Benefit: Stay in touch with contacts, reach out to new people, and show the community you care about company-to-client communication! The Goal of Social Networking Websites

-9-

Social networking websites are designed to allow members to connect and communicate with one another - so features of these sites foster interaction, activity, and of course, community.

ANALYSIS PHASE
A) SITE SPECIFICATION
1. ABOUT THE SITE As we know that, a social network service focuses on building and reflecting of social networks or social relations among people, e.g., who share interests and/or activities. A social network service essentially consists of a representation of each user (often a profile), his/her social links, and a variety of additional services. Thus, using our project we are providing such services to our users so that they can enjoy those services in a single site i.e. Dosti. Throughout our project user can: make their profile, search for their friends, checkout their(friends/users) profile, add them(users) in their friends(contact) list, they can Private Message each other, comment into their profile, share their photos, Block unwanted users from watching/interacting with them.

2. OBJECTIVES OF THE SITE This website is developed for convenience of the all users. It provides complete flexibility for users to share information with their friends. The users can remain in touch with their friends all the time. The users can find their old friends.

3. SCOPE OF THE SITE

- 10 -

To overcome the limitations of the current system and to increase the working efficiency of the system, we decided to include all features together in single system. The main aim of our proposed system was to allow the users to enjoy all the activities like commenting, private messaging, albums, etc in one single system. 4. USERS OF THE SITE A) TYPES OF USERS: NATVE USERS: Users who visit the site just for merely gathering information. These users are those who lack programming language. These kinds of users are very large in number as net surfing is the popular hobby of the people around these days. FREQUENT USERS: These users have some knowledge about the sites so they visit frequently with the urge to know something new or keep themselves abreast of the latest happenings and updates rushing in from their friends. E.g. Registered Users POWER USERS: These are those users who actually handle the site for the purpose for which it has been designed for. These people have a very good knowledge about the website and its programming can fulfill the requirements that are to be fulfilled by the professional users. E.g. Admin. 5. URL Uniform Resource Locator (URL), locates the document to be retrieved when a user clicks on hyper text links. URL is similar to file name expect that, in this case, the file can be on the same machine or a different machine on the network. In its current strict technical meaning, a URL is a URI (Uniform Resource Identifier) that, in addition to identifying a resource, provides a means of locating the resource by describing its primary access mechanism.

- 11 -

The file retrieval methods vary, depending on the type of the document to be retrieved. A URL needs always points to a document but can also point to a query, image or the result of command. It is the reference address of the document used on the internet. URL must be specific. URLs are typically entered into the address or location bar of a web browser. Hypertext Transfer Protocol (HTTP) is a communications protocol used to transfer or convey information on the World Wide Web. Its original purpose was to provide a way to publish and retrieve HTML hypertext pages. The URL describes where something is and how it will be retrieved. The how is specified by the protocol for example, HTTP. The where is specified by the machine name, the directory name, and the filename. Slashes and other characters are used to separate the parts of the address into machine-readable pieces. The basic structure of URL is:

Protocol: //site address/directory/filename


A Client who wants to access a document needs an address. To facilitate the access of documents throughout the world, HTTP uses the concept of Locators. The Uniform Resource Locator (URL) is a standard for specifying any kind of information on the Internet. The URL defines four things: Methods Host Computer port and Path. The methods are nothing but the protocol what it uses to retrieve the information. The host is the computer where the information is located, although the name of the computer can be alias web pages are usually begins with www. This is not mandatory, however as the host can be any name given to the computer they host the web page. The URL optionally can contain the port number of the server. If the port is included, it should be inserted between the host and path, and it should be separated from the host by colon like

- 12 -

http://www.dosti.com
Path is the pathname of the file where the information is located. The path can itself contain slashes that are used to separate the directories from the subdirectories and files. The proposed url for this website constructed for remaining in touch with your friends and other contacts: http://localhost/

B) FEASIBILITY STUDY
Feasibility study is an activity that verifies whether a project can be started and successfully completed. Is the process by which feasibility is measure? The objective of assessing feasibility is to determine whether a development project has a reasonable chance of success. It is the process of selecting the best system that meets the following requirements i.e.: The user has recognized a need. User requirements are determined and the problem has been defined. An initial investigation is launched to study the existing system and verify the problem. The analyst has verified the objective constraints and required output. OPERATIONAL FEASIBILITY It is a measure of how well the solution will work in the organization. It is a measure of how people feel about the system. It measures the urgency of the problem or acceptability of a solution.

There are two aspects of operational feasibility to be considered: Is the problem worth solving? How do the end user and management feel about the problem? As the website provides the information which are self explanatory, the user finds that the site will be operationally feasible. The problem statement and the solution steps are designed in a very easy way by following user oriented interfaces.

- 13 -

TECHNICAL FEASIBILITY A new system brings a new technology into a company. As the system is dynamic, the flow of data will be done automatically with the help of SQL queries. Updates to the site will be done as and when required by the administrators. Technical Feasibility looks at what practical and reasonable. It addresses three major issues Is the proposed technology practical? Do we currently possess the necessary technology? Do we have expertise and is the schedule reasonable? ECONOMICAL FEASIBILITY Economical feasibility is a measure of the cost effectiveness of a project or a solution. We are using ASP.Net and SQLServer which are provided by most of the Companies around the world for a low cost.There is currently no need of investment of money as there are companies which provide free hosting too which have a good reputation and a good service.More likely if the cost increases then AD Blocks on the site will help us procure it. COST BENEFIT ANALYSIS Open source application are used Free premium hosting (sponsered by ittechsoftware) Free domain hosting

C) REQUIREMENT SPECIFICATION

Hardware And Software Requirement


The hardware and software requirements from user point of view for our website are:-

- 14 -

Minimum Hardware Requirement:FOR FOR SERVER:COMPUTER: INTEL PENTIUM OR COMPATIBLE, 550 MHZ OR HIGHER MEMORY: 256 MB (512 MB RECOMMENDED) 100MB HARD DISK SPACE CLIENT:COMPUTER: INTEL PENTIUM OR COMPATIBLE, 550 MHZ OR HIGHER 64 MB RAM (RECOMMENDED: 128 MB RAM OR GREATER) 52 MB HARD DISK SPACE

Minimum Software Requirement:FOR SERVER: APACHE 1.3.X (2.0.63 RECOMMENDED) VISUAL STUDIO 2008 SQLSERVER 2005

FOR CLIENT: WEB BROWSER

PROJECT SCHEDULE
1. GANTT CHART
Planned Time

- 15 -

2. PERT Network Diagram


Site specificati on

- 16 -

(9) Start Plannin g (11 ) Feasibility study (8) Design (14 )

Requirement s (3)

Publish (6) Sto p Documentatio n (10 ) Testing (12 ) Implementation (55 )

TOOLS AND TECHNOLOGIES USED


The following software technologies used exhaustively in the site are:

SOFTWARES:
1. Web Browser:

- 17 -

The Web Browser is the software that accesses the web pages from the server. The server responses the web pages in the form of the HTML pages. 2. Web Server: A web server can be referred to as software that manages web pages and makes them available to the clients computer via a local network or through the Internet. In case of the Internet, the web server and the browser are usually on two different machines, probably many miles apart. However, in more local situation, we might set up a machine that runs the web server software, and then use a browser on the same machine to look at its web pages.

TOOLS:
Text Editor: The features in Text Editor, makes it easier to design pages, improve site and asset management, allows one to create HTML pages and also editing of number of documents becomes easier using Notepad.

TECHNOLOGIES:changes dne till here only


HTML (Hypertext Markup Language): HTML is used to create a document a web page. HTML is open non proprietary, cross platform compatible language. HTML means Hyper Text Mark-up Language. Hyper Text is used to link information on related topics over the internet. Hyper text is non liner way of organizing information. Jumping from one related topic to another and quickly finding information and returning to starting point or moving onto some other topic. A Mark-Up Language is a structure thats lets you identify common section of a document such as heading, paragraph and list. ASP.NET PHP: Hypertext Preprocessor is a widely used, general-purpose scripting language that was originally designed for web development to

- 18 -

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. As a general-purpose programming language, PHP code is processed by an interpreter application in command-line mode performing desired operating system operations and producing program output on its standard output channel. It may also function as a graphical application. PHP is available as a processor for most modern web servers and as standalone interpreter on most operating systems and computing platforms.

SQL SQL is primarily an RDBMS and therefore ships with no GUI tools to administer SQL databases or manage data contained within. Users may use the included command-line tools, or downloadSQL Frontends from various parties that have developed desktop software and web applications to manage SQL databases, build database structure, and work with data records. The official SQL Workbench is a free integrated environment developed by SQL AB, that enables users to graphically administer SQL databases and visually design database structure. SQL Workbench replaces the previous package of software, SQL GUI Tools. Similar to other third-party packages but still considered the authoritative SQL frontend, SQL Workbench lets users manage the following: * Database design & modeling * Replacing MySQL Query Browser * Database administration replacing SQL Administrator SQL Workbench is available in two editions, the regular free and open source Community Edition which may be downloaded from the SQL website, and the proprietary Standard Edition which extends and improves the feature set of the Community Edition.

- 19 -

DEVELOPMENT METHODOLOGY:dne
Incremental Model

EXPLAINATION

The incremental build model is a method of software development where the model is designed, implemented and tested incrementally (a little more is added each time) until the product is finished. It involves both development and maintenance. The product is defined as finished when it satisfies all of its requirements.

- 20 -

The basic idea behind iterative enhancement is to develop a software system incrementally, allowing the developer to take advantage of what was being learned during the development of earlier, incremental, deliverable versions of the system. Learning comes from both the development and use of the system, where possible key steps in the process are to start with a simple implementation of a subset of the software requirements and iteratively enhance the evolving sequence of versions until the full system is implemented. At each iteration, design modifications are made and new functional capabilities are added.

DESIGN PHASE
E-R Diagram
Relation Ship
M: Many 1: One

Entities

Attribute Profile_Id

Level E-Mail Id l First Name Send/ Reciev e

Profile_Id
M 1

Friend Request Member List

1 1 Contai n

Have

- 21 -

1 Last Name 1 Password

Users
M

Profile_Id 1

Profile_Id Have Has Have


M M

1 1 About me Phone no Relation_ Status Language DOB

Have
M

Comment

Report

Private User Id Message From Id Msg Id Inbox User Send Reason Content Time
M

Profile Id User name Reason Date Reported by

Information Structure

Religion Have 1 Web site is built basic structural themes. These fundamental Update Profile architectures govern the navigational interface of the web site and mold Location Fromthe uses mental models of how the information is organized. Five Admin Warning essential structures can be used to build a web site: Album Delete Profile Date Linear: Its the type of sequential flow of the website. Tutorial: it consists of the sub topics as chapters. Web: It is the website which can return to home page at any time. Hierarchical: It consists of a main page which can link to any of the pages. Cluster: It is structure of both web and hierarchical structure. Catalog: It is basically used for the shopping cart system.

Login Id

- 22 -

SYSTEM FLOW

Users

User Details

Users

Edit Profile

- 23 -

Users

Search User

Friend_ Requests

Add User

Friend_ Requests

Friend Request Attendance

Blogs Blog List Attendance

Albums Album Attendance

- 24 -

Delete User Users Attendance

FLOWCHART
START

UserID & Password

Registration Form

Is Valid

NO

Try Again Check values filled

NO

Try Again

- 25 -

YES

Forgot Password

YES

Successful

HM

FP
RETURN

FP

I nput Secr N um ber et or N am e

Is Valid Secret Number or Name

NO

Tr Agai y n

YES

N ew Passw ord Ret i r ved - 26 -

RETURN

HM

Home Page

NAV

Edit Profile

Changed Profile

RETURN

NAV - 27 -

PR

FDR

AB

Blogs

LO

ML

CM

PR

FR

CM

AB

IB

Blogs

FR

- 28 -

Is Friend

YES Remove Friend

NO
Friend Removed

Add Friend

Friend Added

RETURN

CM

Check Users Own Comment s

NO

Print Comment s

YES Comments

Print Comment s

- 29 -

Reply

Delete

Repled

Deleted

RETURN

AB

Check Users Own Album

NO

Show Albums

YES Process Album

Upload Album

Show Albums

- 30 -

Album Uploaded

Print Description

RETURN

Blogs

Is update

NO Error message

YES Blog not update

Blog display

- 31 -

RETURN

ML

Display MemberLis t

Input from User

Is Blocked

YES

You Are Blocked

- 32 -

NO
RETURN

FRD

Friend Request

Is there Any Request

NO

No Request Made

YES Request Made

Accept/ Delete - 33 Request-

NO

Delete Request

YES Accept Request

No Request Made

Friend Added

RETURN

LO

Logout

Successful

STOP

- 34 -

DFD DIAGRAM

- 35 -

Context Level Diagram

- 36 -

DFD IN DETAIL:

The DFD is short for Data Flow Diagram. It represents how the data flows in the processes.

- 37 -

THE CONVENTIONS OF DFD:

PROCESS

DATA FLOW EXTERNAL AGENT

DATA STORE

DFD Fragments
0th Level Diagram

- 38 -

Insert user detail

Anonymu s

Get User Detail

Dosti (Registratio n)

Store user Detail

Retrieve User Detail

USER S

1ST Level Diagram

- 39 -

Insert profile detail

Store profile Detail

USER Get Profile Detail

Edit Profile

USER S

Retrieve Profile Detail

Insert UserName

Check UserName

USER
Get UserName Profile

Search Users
Retrieve UserName

USERS

USER

Get UserName Profile Wait for Acceptance

ADD User

Request To be Friend

Request sent

FRIEND_ REQUESTS

- 40 -

4
Get Requests

USER
Insert Approvance Details

Friend Requests

Retrieve Requests Made

Store
Approvance Details

FRIENDS

Insert blog Detail

5
BLOGS

Store blog Detail

USER

Blogs
Retrieve Blog Detail

Get blogs details

Insert Detail

6
Albums

Store Detail

USER
Get Detail

album
Retrieve Detail

- 41 -

2ND Level Diagram

2.1
Admin
Insert web Detail

Upgrade

Store Web Detail

newtable

- 42 -

3RD Level Diagram 3.1.1


Admin

Warn Users

Warnings

3.1.1
Admin

Edit User

Users

3.1.3
Admin

Delete User

Users

- 43 -

SITEMAP
Dosti

HOME PROFILE MEMBER LIST FRIEND REQUEST COMMENT ALBUM BLOGS EDIT USERS PROFILE

LOGOUT

- 44 -

IMPLEMENTATION PHASE
CODING AND SCREEN LAYOUTS

Master page
MasterPage.master.cs:using using using using using using System; System.Collections.Generic; System.Linq; System.Web; System.Web.UI; System.Web.UI.WebControls;

public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { } }

MasterPage.master :<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dosti Connection</title> <link href="CSS/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <table width="960" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td> <img src="Images/space.gif" width="1" height="8" /> </td> </tr> <tr> <td>

- 45 -

<table width="960" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="400" align="left" valign="middle"> <img src="Images/Logo.png" alt="Dosti Connection" width="400" height="84" /> </td> <td align="right" valign="middle"> <table width="385" border="0" cellspacing="0" cellpadding="0"> <tr> <%-- <td class="searchpeople" align="center" valign="middle"> <label> <input type="text" name="textfield" id="textfield" class="textbox" value="Email Address" /> </label> </td> <td width="7"> &nbsp; </td> <td width="77" align="right" valign="middle"> <label> <asp:ImageButton type="submit" name="button" id="button" value="" class="search" /> </label> </td> <td width="36"> &nbsp; </td>--%> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> <img src="Images/space.gif" width="2" height="20" /> </td> </tr> <tr> <td align="right"> <asp:LinkButton ID="LinkButton1" Text ="HOME" runat="server" PostBackUrl="~/Home.aspx"></asp:LinkButton> <asp:LinkButton ID="LinkButton2" Text =" Edit Profile" runat="server" PostBackUrl="~/EdittProfile.aspx"></asp:LinkButton> <%--<asp:Label ID="lblN" runat="server" Visible="false" style="zindex: 107; left: 14px; position: absolute; top: 63px" ></asp:Label>--%> <asp:LinkButton ID="LinkButton4" Text =" Join Chat" runat="server" PostBackUrl="~/Default_Chat.aspx"></asp:LinkButton> <asp:LinkButton ID="LinkButton5" Text =" Blog" runat="server" PostBackUrl="~/BlogList.aspx"></asp:LinkButton>

- 46 -

<asp:LinkButton ID="LinkButton3" Text ="Sign Out" runat="server" PostBackUrl="~/Default.aspx"></asp:LinkButton> </td> </tr> <tr> <td> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </td> </tr> </table> <div id="footer"> </div> </form> </body> </html

Default.aspx:-

- 47 -

Default.aspx:<%@ Page Language="C#" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dosti Connection</title> <link href="CSS/Main_stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <script type="text/javascript" language="javascript"> window.onload = blurStart; function blurStart() { blurTxtEmail(); blurTxtPassword(); blurtxtFirstName(); blurtxtLastName(); blurtxtLoginName(); blurtxtPassword2();

- 48 -

blurtxtConPass(); blurTxtDOB();

function clearTxtEmail(textBoxID) { document.getElementById('TxtEmail').value = ""; } function clearTxtPassword(textBoxID) { document.getElementById('TxtPassword').value = ""; } function cleartxtFirstName(textBoxID) { document.getElementById('txtFirstName').value = ""; } function cleartxtLastName(textBoxID) { document.getElementById('txtLastName').value = ""; } function cleartxtLoginName(textBoxID) { document.getElementById('txtLoginName').value = ""; } function cleartxtPassword2(textBoxID) { document.getElementById('txtPassword2').value = ""; } function cleartxtConPass(textBoxID) { document.getElementById('txtConPass').value = ""; } function clearTxtDOB(textBoxID) { document.getElementById('TxtDOB').value = ""; }

function blurTxtEmail(textBoxID) { if (document.getElementById('TxtEmail').value == "") { document.getElementById('TxtEmail').value = "Email Address"; } } function blurTxtPassword(textBoxID) { if (document.getElementById('TxtPassword').value == "") { document.getElementById('TxtPassword').value = "Password"; } } function blurtxtFirstName(textBoxID) { if (document.getElementById('txtFirstName').value == "") { document.getElementById('txtFirstName').value = "First Name";

- 49 -

} } function blurtxtLastName(textBoxID) { if (document.getElementById('txtLastName').value == "") { document.getElementById('txtLastName').value = "Last } }

Name";

function blurtxtLoginName(textBoxID) { if (document.getElementById('txtLoginName').value == "") { document.getElementById('txtLoginName').value = "Your Email"; } function blurtxtPassword2(textBoxID) { if (document.getElementById('txtPassword2').value == "") { document.getElementById('txtPassword2').value = "Password"; } } function blurtxtConPass(textBoxID) { if (document.getElementById('txtConPass').value == "") { document.getElementById('txtConPass').value = "Password"; } } function blurTxtDOB(textBoxID) { if (document.getElementById('TxtDOB').value == "") { document.getElementById('TxtDOB').value = "Date of } } }

Birth";

</script> <table width="960" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td height="168" align="left" valign="middle"> <table width="960" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="400" align="left" valign="middle"> <img src="Images/Logo.png" alt="Dosti Connection" width="400" height="84" /> </td> <td align="right" valign="middle"> <table width="478" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="6"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>

- 50 -

<td width="182" align="left" valign="middle"> <b>Email </b> </td> <td align="left"

valign="middle">

<b>Password </b> </td> </tr> </table></td> </tr> <tr> <td width="175" align="center" valign="middle" class="textboxbg"> <asp:TextBox ID="TxtEmail" runat="server" Onblur="return blurTxtEmail();" CssClass="textbox"></asp:TextBox> <%--<label> <input type="text" name="textfield" id="textfield" class="textbox" value="Email Address" /> </label>--%> </td> <td width="7" align="left" valign="middle"> &nbsp; </td> <td width="175" align="center" valign="middle" class="textboxbg"> <asp:TextBox ID="TxtPassword" runat="server" Onblur="return blurTxtPassword();" CssClass="textbox" TextMode="Password"></asp:TextBox> <%--<label> <input type="text" name="textfield" id="textfield" class="textbox" value="Password" /> </label>--%> </td> <td width="7" align="left" valign="middle"> &nbsp; </td> <td width="77" align="right" valign="middle"> <asp:ImageButton ImageUrl="~/Images/Login.jpg" ID="Login" runat="server" OnClick="Login_Click" /> </td> <td width="37" align="left" valign="middle"> &nbsp; </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr>

- 51 -

<td align="left" valign="middle"> <table width="960" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="Home_Connection"> Connect with your College Friends & Share your knowlege with your Friends!!! </td> <td width="454" align="left" valign="top"> <table width="454" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <img src="Images/Registration_head.gif" width="454" height="102" /> </td> </tr> <tr> <td height="410" align="center" valign="top" bgcolor="#edecec"> <table width="364" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="30"> &nbsp; </td> </tr> <tr> <td align="center" valign="middle" class="signup_bg"> <asp:TextBox ID="txtFirstName" runat="server" Onblur="return blurtxtFirstName();" CssClass="textbox1"></asp:TextBox> <asp:RequiredFieldVal idator ID="rfv_txtFirstName" runat="server" ControlToValidate="txtFirstName" ErrorMessage="Fir st Name is Required." SetFocusOnError="true" ValidationGroup="RegisterLogin"> <img src="Images/alert.gif" alt="First Name is Required." title="First Name is Required." /> </asp:RequiredFieldVa lidator> <%--<input type="text" name="textfield" id="textfield" class="textbox1" value="First Name" />--%> </td> </tr> <tr> <td> <img src="Images/space.gif" width="1" height="10" /> </td> </tr> <tr>

- 52 -

<td align="center" valign="middle" class="signup_bg"> <asp:TextBox ID="txtLastName" Onblur="return blurtxtLastName();" runat="server" CssClass="textbox1"></asp:TextBox> <%--<input type="text" name="textfield" id="textfield" class="textbox1" value="Last Name" />--%> </td> </tr> <tr> <td> <img src="Images/space.gif" width="1" height="10" /> </td> </tr> <tr> <td align="center" valign="middle" class="signup_bg"> <asp:TextBox ID="txtLoginName" Onblur="return blurtxtLoginName();" runat="server" CssClass="textbox1" OnTextChanged="tx tLoginName_TextChanged"></asp:TextBox> <%--<input type="text" name="textfield" id="textfield" class="textbox1" value="Your Email" />--%> </td> <td> <asp:Label ID="lblCheck" Text=" " runat="server"></asp:Label> </td> </tr> <tr> <td> <img src="Images/space.gif" width="1" height="10" /> </td> </tr> <tr> <td align="center" valign="middle" class="signup_bg"> <asp:TextBox ID="txtPassword2" Onblur="return blurtxtPassword2();" runat="server" CssClass="textbox1" TextMode="Passwor d"></asp:TextBox> <%--<input type="text" name="textfield" id="textfield" class="textbox1" value="Password" />--%> </td> </tr> <tr> <td> <img src="Images/space.gif" width="1" height="10" /> </td> </tr>

- 53 -

<tr> valign="middle" class="signup_bg"> <td align="center" <asp:TextBox ID="txtConPass" Onblur="return blurtxtConPass();" runat="server" CssClass="textbox1" TextMode="Passwor d"></asp:TextBox> <%--<input type="text" name="textfield" id="textfield" class="textbox1" value="Confirm Password" />--%> </td> </tr> <tr> <td> <img src="Images/space.gif" width="1" height="10" /> </td> </tr> <tr> <td align="center" valign="middle" class="signup_bg"> <asp:TextBox ID="TxtDOB" Onblur="return blurTxtDOB();" runat="server" CssClass="textbox1" ></asp:TextBox> <%--<input type="text" name="textfield" id="textfield" class="textbox1" value="Date of Birth" />--%> </td> </tr> <tr> <td> <img src="Images/space.gif" width="1" height="10" /> </td> </tr> <tr> <td align="center" valign="middle" class="signup_bg"> <%--<label> <select name="select" id="select" class="select1"> <option>Slect Your Gender</option> <option>Male< /option> <option>Femal e</option> </select> </label>--%> <asp:DropDownList ID="ddlMaleFemale" runat="server" CssClass="select1"> <asp:ListItem Selected="True" Value="value" Text="Male"></asp:ListItem> <asp:ListItem Value="Female" Text="Female"></asp:ListItem> </asp:DropDownList> </td>

- 54 -

</tr> <tr> <td> &nbsp; </td> </tr> <tr> <td align="left"

valign="middle">

<asp:ImageButton ImageUrl="~/Images/SignUp_btn.gif" ValidationGroup="RegisterLogin" ID="Signup" runat="server" OnClick="Signup_Click" /> </td> </tr> <tr> <td> &nbsp; </td> </tr> </table> </td> </tr> </table> </td> <td width="10" align="left" valign="middle"> &nbsp; </td> </tr> </table> </td> </tr> <tr> <td align="left" valign="middle"> &nbsp; </td> </tr> <tr> <td align="left" valign="middle"> <table width="960" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="496" align="left" valign="top" style="padding: 0 40px 20px 40px;"> Join us! Registration is 100% free and easy. Once registered - you have the opportunity to browse thousands of profiles with photos and to answer those you find interesting. </td> <td> &nbsp; </td> </tr> </table> </td> </tr> </table> </form> </body>

- 55 -

Default.aspx.cs:using using using using using using using using using

System; System.Collections.Generic; System.Linq; System.Web; System.Web.UI; System.Data; System.Data.SqlClient; System.Web.UI.WebControls; System.Configuration;

public partial class _Default : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; protected void Page_Load(object sender, EventArgs e) { TxtEmail.Attributes["OnClick"] = "clearTxtEmail(this.id)"; TxtPassword.Attributes["OnClick"] = "clearTxtPassword(this.id)"; txtFirstName.Attributes["OnClick"] = "cleartxtFirstName(this.id)"; txtLastName.Attributes["OnClick"] = "cleartxtLastName(this.id)"; txtLoginName.Attributes["OnClick"] = "cleartxtLoginName(this.id)"; txtPassword2.Attributes["OnClick"] = "cleartxtPassword2(this.id)"; txtConPass.Attributes["OnClick"] = "cleartxtConPass(this.id)"; TxtDOB.Attributes["OnClick"] = "clearTxtDOB(this.id)"; } public void login() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select Login_Name,BackGround,Password,MyRole from tbl_SN_Profile", con); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { if (TxtEmail.Text == dr["Login_Name"].ToString() && TxtPassword.Text == dr["Password"].ToString()) { // FormsAuthentication.RedirectFromLoginPage(TxtEmail.Text, TxtPassword.Text); string Name = dr["Login_Name"].ToString(); string role = dr["MyRole"].ToString();

- 56 -

//

} } } dr.Close(); con.Close();

Session["Login_Name"] = Name; Session["logname"] = Name; Session["bg"] = dr["BackGround"].ToString(); if (role == "admin") { Response.Redirect("HomeAdmin.aspx"); } else { Response.Redirect("Home.aspx"); }

} protected void Login_Click(object sender, ImageClickEventArgs e) { login(); } protected void Signup_Click(object sender, ImageClickEventArgs e) { registrationfrm(); } public void registrationfrm() { if (txtLoginName.Text != "" && lblCheck.Text == "") { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); string role = "user"; string bg = "bg.jpg"; cmd = new SqlCommand("insert into tbl_SN_Profile(First_Name,Last_Name,Login_Name,Password,MyRole,BackGround ) values('" + txtFirstName.Text + "','" + txtLastName.Text + "','" + txtLoginName.Text + "','" + txtPassword2.Text + "','" + role + "','" + bg + "')", con); cmd.ExecuteNonQuery(); con.Close(); Session["Login_Name"] = txtLoginName.Text; Session["bg"] = bg; Response.Redirect("Home.aspx"); } else if (txtLoginName.Text == "") { lblCheck.Visible = true; lblCheck.Text = "Please Enter Login Name"; } else {

- 57 -

} // lblCheck.Visible = false;

lblCheck.Visible = true; lblCheck.Text = "Please Enter another Id";

} protected void txtLoginName_TextChanged(object sender, EventArgs e) { lblCheck.Text = ""; con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select Login_Name from tbl_SN_Profile where Login_Name='" + txtLoginName.Text + "'", con); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { if (txtLoginName.Text == dr["Login_Name"].ToString()) { lblCheck.Visible = true; lblCheck.Text = "Id Already Exist"; //txtLoginName.Text = ""; txtLoginName.Focus(); } }

} dr.Close(); con.Close(); } }

Home.aspx:-

- 58 -

Home.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Home</title> <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" /> <link href="CSS/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <table width="960" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td> <img src="Images/space.gif" width="1" height="8" /> </td> </tr> <tr> <td> <table width="960" border="0" cellspacing="0" cellpadding="0"> <tr>

- 59 -

<td width="400" align="left" valign="middle"> <img src="Images/Logo.png" alt="Dosti Connection" width="400" height="84" /> </td> <td align="right" valign="middle"> <table width="385" border="0" cellspacing="0" cellpadding="0"> <tr style="display: none;"> <td class="searchpeople" align="center" valign="middle" style="display: none;"> <label> <input type="text" name="textfield" id="textfield" class="textbox" value="Email Address" /> </label> </td> <td width="7"> &nbsp; </td> <td width="77" align="right" valign="middle" style="display: none;"> <label> <input type="submit" name="button" id="button" value="" class="search" /> </label> </td> <td width="36"> &nbsp; <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <asp:Panel ID="Panel1" runat="server" Height="345px" Style="zindex: 100; left: 5px; position: absolute; top: 146px" Width="783px"> <asp:Image ID="imgPhoto" runat="server" Style="z-index: 100; left: 7px; position: absolute; top: 10px" Height="151px" Width="151px" /> <asp:Label ID="lblWelcome" ForeColor="#FE8102" runat="server" Style="z-index: 101; left: 177px; position: absolute; top: 10px" FontBold="True"></asp:Label> <asp:Label ID="lblInterest" runat="server" ForeColor="#056fc9" Style="z-index: 102; left: 176px; position: absolute; top: 264px" FontBold="True"></asp:Label> <asp:Label ID="lblAge" runat="server" ForeColor="#056fc9" Style="z-index: 103; left: 177px; position: absolute; top: 41px" FontBold="True"></asp:Label> &nbsp;

- 60 -

<asp:LinkButton ID="LinkButton1" runat="server" Style="zindex: 104; left: 10px; position: absolute; top: 170px" Width="109px" PostBackUrl="~/Scrapbook.aspx" ForeColor="#056fc9">Scrap Book</asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat="server" Style="zindex: 105; left: 8px; position: absolute; top: 191px" PostBackUrl="~/PhotoGallery.aspx" ForeColor="#056fc9" Width="112px">PhotoGallery</asp:LinkButton> <asp:GridView ID="grdSearch" HeaderStyleBackColor="transparent" runat="server" AutoGenerateColumns="False" OnRowDataBound="grdSearch_RowDataBound" OnRowUpdating="grdSearch_RowUpdating" BorderStyle="None" BackColor="Transparent" BorderColor="#CCCCCC" BorderWidth="1px" CellPadding="4" Width="349px" ForeColor="#056fc9" GridLines="Horizontal" UseAccessibleHeader="False" Style="z-index: 106; left: 4px; position: absolute; top: 299px"> <Columns> <asp:TemplateField> <HeaderTemplate> Search Result's</HeaderTemplate> <ItemTemplate> <asp:Label ID="lblNum" runat="server" Text='< %#bind("Num") %>' Visible="false"></asp:Label> <asp:Label ID="lblLogName" runat="server" Text='<%#bind("Login_Name") %>' Visible="false"></asp:Label> <asp:Image ID="imgPhoto" runat="server" Width="100px" Height="100px" ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:GridView ID="grdSearchInside" Width="150" runat="server" AutoGenerateColumns="false" BorderStyle="None" BackColor="transparent" HorizontalAlign="Left"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label ID="lblTextProName" ForeColor="#056fc9" runat="server" Text="First Name : "></asp:Label> <asp:Label ID="lblFirstName" ForeColor="#056fc9" runat="server" Text='<%#bind("First_Name") %>'></asp:Label><br /> <asp:Label ID="Label1" runat="server" ForeColor="#056fc9" Text="Last Name : "></asp:Label> <asp:Label ID="lblLastName" runat="server" ForeColor="#056fc9" Text='<%#bind("Last_Name") %>'></asp:Label><br /> <asp:Label ID="Label2" runat="server" ForeColor="#056fc9" Text="Age : "></asp:Label> <asp:Label ID="lblAges" runat="server" ForeColor="#056fc9" Text='<%#bind("Age") %>'></asp:Label><br />

- 61 -

<asp:Label ID="Label3" runat="server" ForeColor="#056fc9" Text="Location : "></asp:Label> <asp:Label ID="lblLocation" runat="server" ForeColor="#056fc9" Text='<%#bind("Location") %>'></asp:Label><br /> <asp:Label ID="Label4" runat="server" ForeColor="#056fc9" Text="Gender : "></asp:Label> <asp:Label ID="lblGender" runat="server" ForeColor="#056fc9" Text='<%#bind("Gender") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:Button ID="btnAddFrnd" runat="server" Text="Add as a friend" CommandName="update" /><br /> <asp:Label ID="lblAlFrnd" runat="server"></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> <FooterStyle BackColor="#CCCC99" ForeColor="Black" /> <PagerStyle BackColor="#056fc9" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="#056fc9" /> <HeaderStyle BackColor="Transparent" Font-Bold="True" ForeColor="#056fc9" /> </asp:GridView> <asp:Label ID="lblReligion" runat="server" Font-Bold="True" ForeColor="#056fc9" Style="z-index: 107; left: 176px; position: absolute; top: 104px"></asp:Label> <asp:Label ID="lblCity" runat="server" Font-Bold="True" ForeColor="#056fc9" Style="z-index: 108; left: 176px; position: absolute; top: 169px"></asp:Label> <asp:Label ID="lblHomeTown" runat="server" Font-Bold="True" ForeColor="#056fc9" Style="z-index: 109; left: 176px; position: absolute; top: 201px"></asp:Label> <asp:Label ID="lblCountry" runat="server" Font-Bold="True" ForeColor="#056fc9" Style="z-index: 110; left: 176px; position: absolute; top: 232px"></asp:Label> <asp:Label ID="lblLanguage" runat="server" Font-Bold="True" ForeColor="#056fc9" Style="z-index: 111; left: 176px; position: absolute; top: 135px"></asp:Label> <asp:Label ID="lblGender" runat="server" Font-Bold="True" ForeColor="#056fc9" Style="z-index: 112; left: 175px; position: absolute; top: 71px"></asp:Label> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" ForeColor="#056fc9" OnRowDeleting="GridView1_RowDeleting" OnRowUpdating="GridView1_RowUpdating" Style="z-index: 113; left: 460px; position: absolute; top: 12px"> <Columns>

- 62 -

<asp:TemplateField HeaderText="Friend Request" HeaderStyle-Font-Bold="true"> <ItemTemplate> <asp:ImageButton ID="imgProfile" runat="server" Width="100px" Height="100px" ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' OnClick="imgProfile_Click" /> <asp:Label ID="lblDisplay" runat="server" Text="From"></asp:Label> <asp:Label ID="Label7" runat="server" Text='< %#bind("RequestFrom") %>' Visible="false"></asp:Label> <asp:Label ID="lblFrom" runat="server" Text='<%#bind("First_Name") %>'></asp:Label> <asp:Button ID="btnYes" runat="server" Text="Yes" CommandName="update" /> <asp:Button ID="btnNo" runat="server" Text="No" CommandName="delete" /> <%-<asp:LinkButton ID="lnkProfile" runat="server" Text="See Profile" ForeColor="white" OnClick="lnkProfile_Click"></asp:LinkButton> --%> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:LinkButton ID="LinkButton4" runat="server" ForeColor="#056fc9" PostBackUrl="~/ChangeBackGround.aspx" Style="z-index: 115; left: 8px; position: absolute; top: 210px" Width="130px">Change Background</asp:LinkButton> </asp:Panel> <asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" Style="z-index: 101; left: 92px; position: absolute; top: 90px" Width="167px" BackColor="Transparent" DynamicHorizontalOffset="2" Font-Bold="True" FontNames="Georgia" Font-Size="Larger" ForeColor="#056fc9" Height="34px" StaticSubMenuIndent="10px"> <Items> <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> <asp:MenuItem Text=" | "></asp:MenuItem> <asp:MenuItem NavigateUrl="~/Default_Chat.aspx" Text="Join Chat" Value="JoinChat"> </asp:MenuItem> <asp:MenuItem Text=" | "></asp:MenuItem> <asp:MenuItem NavigateUrl="~/BlogList.aspx" Text=" Blog" Value="Blog"></asp:MenuItem> <asp:MenuItem Text=" | "></asp:MenuItem> <asp:MenuItem NavigateUrl="~/EdittProfile.aspx" Text="Edit Profile" Value="Edit Profile"> </asp:MenuItem> </Items> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticSelectedStyle BackColor="#5D7B9D" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="#056fc9" />

- 63 -

<DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <StaticHoverStyle BackColor="#FE8102" ForeColor="#056fc9" /> </asp:Menu> <asp:Panel ID="Panel2" runat="server" Height="24px" Style="zindex: 102; left: 813px; position: absolute; top: 33px" Width="289px"> <asp:TextBox ID="txtSearch" runat="server" BorderStyle="Ridge" Style="z-index: 100; left: 0px; position: absolute; top: 0px" Width="207px"></asp:TextBox> <asp:Button ID="btnSearch" runat="server" BorderStyle="Ridge" OnClick="btnSearch_Click" Style="z-index: 102; left: 220px; position: absolute; top: 1px" Text="Search" BackColor="#FE8102" Font-Bold="True" ForeColor="White" /> </asp:Panel> &nbsp; <asp:Panel ID="Panel4" runat="server" Height="235px" Style="zindex: 103; left: 810px; position: absolute; top: 96px" Width="338px"> <table width="338" border="0" style="margin-top: 3px;" cellspacing="0" cellpadding="0"> <tr> <td> <img src="Images/Friend.gif" width="338" height="37" /> </td> </tr> <tr> <td class="fiendbg" align="center"> <div class="friendlist"> <asp:DataList ID="DataList2" runat="server" Style="z-index: 123; left: 0px; position: absolute; top: 3px" RepeatDirection="Horizontal" RepeatColumns="3" Width="338px" BorderColor="#AEADAD" BorderStyle="Solid" Height="205px" BorderWidth="1px"> <ItemTemplate> <asp:ImageButton ID="rpimage" runat="server" Width="60px" Height="60px" AlternateText='<%# Eval("First_Name") %>' ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' OnClick="rpimage_Click" /><br /> <asp:Label ID="rpLblName" runat="server" Width="60" Style="text-align: center" Font-Bold="True" ForeColor="#004EAA" Text='< %#bind("First_Name") %>'></asp:Label> <asp:Label ID="rplblLogName" runat="server" Visible="false" Text='<%#bind("Login_Name") %>'></asp:Label> </ItemTemplate> <SeparatorTemplate> <hr size="2px" /> </SeparatorTemplate> </asp:DataList> </div>

- 64 -

</td> </tr> </table> </asp:Panel> <asp:Label ID="Label5" runat="server" Font-Bold="True" Style="zindex: 104; left: 812px; position: absolute; top: 64px; text-align: center" Text="Friend List" Width="232px" ForeColor="#056fc9" Font-Names="Georgia" Font-Size="XLarge"></asp:Label> &nbsp;&nbsp; <asp:Panel ID="Panel3" runat="server" Height="34px" Style="zindex: 105; left: 378px; position: absolute; top: 14px" Width="334px" Visible="False"> &nbsp; <asp:Button ID="btnYes" runat="server" Style="z-index: 100; left: 254px; position: absolute; top: 3px" Text="YES" OnClick="btnYes_Click" /> <asp:Button ID="btnNO" runat="server" ForeColor="Black" Style="z-index: 101; left: 300px; position: absolute; top: 3px" Text="NO" OnClick="btnNO_Click" /> <asp:Label ID="lblReq" runat="server" ForeColor="#056fc9" Style="z-index: 103; left: 6px; position: absolute; top: 6px"></asp:Label> </asp:Panel> <asp:Label ID="Label6" runat="server" Style="z-index: 106; left: 8px; position: absolute; top: 94px" Visible="False"></asp:Label> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; <asp:Label ID="lblN" runat="server" Visible="false" Style="zindex: 107; left: 14px; position: absolute; top: 63px"></asp:Label> <asp:LinkButton ID="LinkButton3" runat="server" ForeColor="#FE8102" PostBackUrl="~/Default.aspx" Style="z-index: 108; left: 11px; position: absolute; top: 75px;"><strong>Sign Out</strong></asp:LinkButton> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

- 65 -

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div> </form> </body> </html>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

Home.aspx.cs:using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class Home : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; string AddFrnd=""; protected void Page_Load(object sender, EventArgs e) { //if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) //{ // body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); //} ////if (Session["bg"].ToString() == "NULL") ////{ //// body1.Attributes["background"] = "Photos/bg.jpg"; ////} //else //{ // body1.Attributes["background"] = "Photos/bg.jpg"; //} if (!IsPostBack) { lblN.Text= Session["Login_Name"].ToString(); Session["Changed"] = false; // Login_Name = Session["Login_Name"].ToString();

- 66 -

Data(); //PagedDataSource pageds=new PagedDataSource(); //pageds.DataSource = Frnd(); //pageds.AllowPaging = true; //pageds.PageSize = 4; //int curpage; //if(! Microsoft.VisualBasic.Information.IsNothing(Request.QueryString["Page"])) //{ // curpage = Convert.ToInt32(Request.QueryString["Page"]); //} //else //{ // curpage = 1; //} //pageds.CurrentPageIndex = curpage - 1; //lblCurrpage.Text = "Page: " + curpage.ToString(); //if (! pageds.IsFirstPage ) //{ // lnkPrev.PostBackUrl = Request.CurrentExecutionFilePath + "?Page=" + (curpage - 1); //} //if (!pageds.IsLastPage) //{ // lnkNext.PostBackUrl = Request.CurrentExecutionFilePath + "?Page=" +( curpage + 1); //} DataList2.DataSource = Frnd(); DataList2.DataBind(); CheckReq(); } } public void CheckReq() { //Label6.Text = ""; con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ToString(); con.Open(); cmd = new SqlCommand("select a.First_Name,a.Photo, b.RequestFrom from tbl_SN_Profile a join tbl_SN_Request b on a.Login_Name=b.Requestfrom where b.RequestTo='" + lblN.Text + "'", con); //cmd = new SqlCommand("select First_Name from tbl_Profile where Login_Name in (select RequestFrom from tbl_Request where RequestTo='" + lblN.Text + "')", con); dr = cmd.ExecuteReader(); //if (dr.HasRows) //{ // while (dr.Read()) // { // Panel3.Visible = true; // lblReq.Text = "Friend Request From " + dr["RequestFrom"].ToString(); // Label6.Text = dr["RequestFrom"].ToString(); // }

- 67 -

//} //else //{ // Panel3.Visible = false; //} GridView1.DataSource = dr; GridView1.DataBind(); dr.Close(); con.Close(); } public SqlDataReader Frnd() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ToString(); con.Open(); cmd = new SqlCommand("select Login_Name,First_Name,Photo from tbl_SN_Profile where Login_Name in(select AddFrnd from tbl_SN_Frnd where UserLogName='" + lblN.Text + "') ", con); dr = cmd.ExecuteReader(); return dr; } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where Login_Name='" + lblN.Text + "'", con); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { imgPhoto.ImageUrl = "~/Photos/" + dr["Photo"].ToString(); lblWelcome.Text = "Welcome, " + dr["First_Name"].ToString(); lblAge.Text = "Age : " + dr["Age"].ToString(); lblInterest.Text = "Interested In : " + dr["Interest"].ToString(); lblCity.Text = "City : " + dr["Location"].ToString(); lblCountry.Text = "Country : " + dr["Country"].ToString(); lblHomeTown.Text = "HomeTown : " + dr["HomeTown"].ToString(); lblLanguage.Text = "Language : " + dr["Language"].ToString(); lblReligion.Text = "Religion : " + dr["Religion"].ToString(); lblGender.Text = "Gender : " + dr["Gender"].ToString(); } } dr.Close(); con.Close(); } protected void btnSearch_Click(object sender, EventArgs e)

- 68 -

{ con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); //cmd = new SqlCommand("select a.Login_Name,a.Photo,a.Num,a.First_Name,a.Last_Name,a.Location,b.AddFrnd from tbl_profile a join tbl_Frnd b on a.Login_Name!=b.UserLogName where First_Name like '%" + txtSearch.Text + "%' or Last_Name like '%" + txtSearch.Text + "%' or Location like '%" + txtSearch.Text + "%' and MyRole<>'admin'", con); if (txtSearch.Text.Contains(",")) { string str = txtSearch.Text; string[] str1 = str.Split(new char[] { ',' }); //flag = true; cmd = new SqlCommand("select * from tbl_SN_profile where First_Name like '%" + str1[0] + "%' or Last_Name like '%" + str1[0] + "%' or Location like '%" + str1[1] + "%' and MyRole<>'admin' and Login_Name<>'" + lblN.Text + "' ", con); } else { cmd = new SqlCommand("select * from tbl_SN_profile where First_Name like '%" + txtSearch.Text + "%' or Last_Name like '%" + txtSearch.Text + "%' and MyRole<>'admin' and Login_Name<>'" + lblN.Text + "'", con); } dr = cmd.ExecuteReader(); grdSearch.DataSource = dr; grdSearch.DataBind(); //grdSearch.HeaderRow.Visible = false; } protected void grdSearch_RowDataBound(object sender, GridViewRowEventArgs e) { Label lb = (Label)e.Row.FindControl("lblNum"); GridView gr = (GridView)e.Row.FindControl("grdSearchInside"); if (gr != null) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where Num='" + lb.Text + "'", con); dr = cmd.ExecuteReader(); gr.DataSource = dr; gr.DataBind(); gr.HeaderRow.Visible = false; } } //protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) //{ // Label lb = (Label)e.Item.FindControl("lblNum");

- 69 -

// GridView gr = (GridView)e.Item.FindControl("grdSearchInside"); // if (gr != null) // { // con = new SqlConnection(); // con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); // cmd = new SqlCommand("select * from tbl_profile where Num='" + lb.Text + "'", con); // dr = cmd.ExecuteReader(); // gr.DataSource = dr; // gr.DataBind(); // gr.HeaderRow.Visible = false; // } //} protected void grdSearch_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lb = (Label)grdSearch.Rows[e.RowIndex].FindControl("lblLogName"); Label lb1 = (Label)grdSearch.Rows[e.RowIndex].FindControl("lblAlFrnd"); con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); SqlCommand cmd1 = new SqlCommand("select * from tbl_SN_Frnd where UserLogName='" + lblN.Text + "' and AddFrnd='" + lb.Text + "'", con); dr=cmd1.ExecuteReader(); if (dr.HasRows) { //while (dr.Read()) //{ lb1.Text="Already added as a friend"; //} dr.Close(); } else { dr.Close(); SqlCommand cmd2 = new SqlCommand("select * from tbl_SN_Request where RequestFrom='" + lblN.Text + "' and RequestTo='" + lb.Text + "'", con); dr=cmd2.ExecuteReader(); if(dr.HasRows) { lb1.Text="Awaiting for response!!!"; } else { dr.Close(); cmd = new SqlCommand("insert into tbl_SN_Request(RequestFrom,RequestTo)values('" + lblN.Text + "','" + lb.Text + "')", con); cmd.ExecuteNonQuery(); }

- 70 -

} con.Close(); //DataList2.DataSource = Frnd(); //DataList2.DataBind();

protected void rpimage_Click(object sender, ImageClickEventArgs e) { ImageButton img = sender as ImageButton; if (img != null) { DataListItem rp = img.NamingContainer as DataListItem; if (rp != null) { Label lblLoginName = (Label)rp.FindControl("rplblLogName"); Session["logname"] = lblLoginName.Text; } } Response.Redirect("frndHomePage.aspx"); } protected void btnYes_Click(object sender, EventArgs e) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("insert into tbl_Frnd(UserLogName,AddFrnd)values('" + lblN.Text + "','" + Label6.Text + "')", con); cmd.ExecuteNonQuery(); SqlCommand cmd2 = new SqlCommand("insert into tbl_Frnd(UserLogName,AddFrnd)values('" + Label6.Text + "','" + lblN.Text + "')", con); cmd2.ExecuteNonQuery(); SqlCommand cmd1 = new SqlCommand("delete from tbl_Request where RequestTo='" + lblN.Text + "'", con); cmd1.ExecuteNonQuery(); con.Close(); CheckReq(); DataList2.DataSource = Frnd(); DataList2.DataBind(); } protected void btnNO_Click(object sender, EventArgs e) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("delete from tbl_Request where RequestTo='" + lblN.Text + "')", con); cmd.ExecuteNonQuery(); con.Close(); } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) {

- 71 -

Label lblfrom = (Label)GridView1.Rows[e.RowIndex].FindControl("Label7"); con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("insert into tbl_SN_Frnd(UserLogName,AddFrnd)values('" + lblN.Text + "','" + lblfrom.Text + "')", con); cmd.ExecuteNonQuery(); SqlCommand cmd2 = new SqlCommand("insert into tbl_SN_Frnd(UserLogName,AddFrnd)values('" + lblfrom.Text + "','" + lblN.Text + "')", con); cmd2.ExecuteNonQuery(); SqlCommand cmd1 = new SqlCommand("delete from tbl_SN_Request where RequestTo='" + lblN.Text + "' and RequestFrom='" + lblfrom.Text + "'", con); cmd1.ExecuteNonQuery(); con.Close(); CheckReq(); DataList2.DataSource = Frnd(); DataList2.DataBind(); } protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Label lblfrom = (Label)GridView1.Rows[e.RowIndex].FindControl("lblFrom"); con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("delete from tbl_SN_Request where RequestTo='" + lblN.Text + "'", con); cmd.ExecuteNonQuery(); con.Close(); CheckReq(); } //protected void lnkProfile_Click(object sender, EventArgs e) //{ // LinkButton img = sender as LinkButton; // if (img != null) // { // GridViewRow rp = img.NamingContainer as GridViewRow; // if (rp != null) // { // Label lblLoginName = (Label)rp.FindControl("Label7"); // Session["logname"] = lblLoginName.Text; // } // } // Response.Redirect("frndHomePage.aspx"); //} protected void imgProfile_Click(object sender, ImageClickEventArgs e) { ImageButton img = sender as ImageButton; if (img != null) {

- 72 -

} Response.Redirect("frndHomePage.aspx");

GridViewRow rp = img.NamingContainer as GridViewRow; if (rp != null) { Label lblLoginName = (Label)rp.FindControl("Label7"); Session["logname"] = lblLoginName.Text; }

} protected void LinkButton3_Click(object sender, EventArgs e) { } }

Default_chat.aspx:-

- 73 -

Default_chat.aspx:<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile ="~/MasterPage.master" CodeFile="Default_Chat.aspx.cs" Inherits="Default_Chat" %> <asp:Content ID ="masterpage" ContentPlaceHolderID="ContentPlaceHolder1" runat ="server"> <body> <TABLE id="Table1" style="Z-INDEX: 101; LEFT: 268px; POSITION: absolute; TOP: 196px" cellSpacing="1" cellPadding="1" width="300" border="0"> <TR> <TD> <asp:Label id="Label1" runat="server">Channel</asp:Label></TD> <TD> <asp:TextBox id="TB_Channel" runat="server"></asp:TextBox> <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage=" * Required" ControlToValidate="TB_Channel"></asp:RequiredFieldValidator></TD> </TR> <TR> <TD> <asp:Label id="Label2" runat="server">Username</asp:Label></TD>

- 74 -

<TD> runat="server"></asp:TextBox> <asp:TextBox id="TB_Username" <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="* Required" ControlToValidate="TB_Username"></asp:RequiredFieldValidator></TD> </TR> <TR> <TD></TD> <TD> <asp:Button id="BT_Enter" runat="server" Text="Join Chat" onclick="BT_Enter_Click"></asp:Button></TD> </TR> </TABLE> </body> </asp:Content>

Default_chat.asp.cs:using using using using using using

System; System.Collections.Generic; System.Linq; System.Web; System.Web.UI; System.Web.UI.WebControls;

public partial class Default_Chat : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void BT_Enter_Click(object sender, EventArgs e) { Response.Redirect("ChatWin.aspx?Channel=" + TB_Channel.Text + "&User=" + TB_Username.Text); } }

ChatWin.aspx:-

- 75 -

ChatWin.aspx:<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeFile="ChatWin.aspx.cs" Inherits="ChatWin" %> <asp:Content ID ="masterpage" ContentPlaceHolderID="ContentPlaceHolder1" runat ="server"> <table id ="ss" cellpadding ="0" cellspacing <tr> <td valign="top"> ="0">

<asp:DataList ID="DataList2" runat="server" > <ItemTemplate> <asp:ImageButton ID="rpimage" runat="server" Width="60px" Height="60px" AlternateText='<%# Eval("First_Name") %>' ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' OnClick="rpimage_Click" /><br /> <asp:label ID="rpLblName" runat="server" Width="60" Style="text-align: center" Font-Bold="True" ForeColor="#056FC9" Text='< %#bind("First_Name") %>'></asp:label> <asp:label ID="rplblLogName" runat="server" visible="false" Text='<%#bind("Login_Name") %>'></asp:label> </ItemTemplate> <SeparatorTemplate> <hr size="2"/> </SeparatorTemplate>

- 76 -

</asp:DataList> </td > <td>&nbsp;</td> <td align="right"> <table id="Table6" cellSpacing="0" cellPadding="0" width="456" align="center" border="0"> <TR> <TD width="8" height="8"><IMG height="8" src="orange1.gif" width="8"></TD> <TD bgColor="orange" height="22" rowSpan="2" width="224" vAlign="bottom"><STRONG>Chatroom</STRONG></TD> <TD vAlign="bottom" align="right" width="224" bgColor="orange" height="22" rowSpan="2"></TD> <TD width="8" height="8"><IMG height="8" src="orange2.gif" width="8"></TD> </TR> <TR> <TD bgColor="orange" height="14"><IMG height="14" src="assets/imgs/spacer.gif" width="1"></TD> <TD bgColor="orange" height="14"><IMG height="14" src="assets/imgs/spacer.gif" width="1"></TD> </TR> </table> <table id="Table3" cellSpacing="0" cellPadding="1" border="0" align="center" bgColor="orange"> <TR> <TD> <iframe style="BORDER-RIGHT: orange 2px solid; BORDER-TOP: orange 2px solid; BORDER-LEFT: orange 2px solid; WIDTH: 450px; BORDER-BOTTOM: orange 2px solid; HEIGHT: 250px; BACKGROUNDCOLOR: #ffffcc" src="TheChatScreenWin.aspx">Chat</iframe> </TD> </TR> <TR> <TD align="right"> Message: <asp:TextBox id="TB_ToSend" runat="server" Width="300px" tabIndex="1"></asp:TextBox> <asp:Button id="BT_Send" runat="server" Text="Send" Width="80px" CssClass="button1" tabIndex="2" onclick="BT_Send_Click"></asp:Button> </TD> </TR> </td> </tr> </table> </table> </asp:Content>

ChatWin.aspx.cs:using using using using using System; System.Collections.Generic; System.Linq; System.Web; System.Data.SqlClient;

- 77 -

using System.Web.UI; using System.Web.UI.WebControls; using System.Configuration; public partial class ChatWin : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; string AddFrnd = ""; protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { if (Request.Params["Channel"] != null) Session["ChatChannel"] = Request.Params["Channel"].ToString(); else Session["ChatChannel"] = "1";

} }

DataList2.DataSource = Frnd(); DataList2.DataBind();

public SqlDataReader Frnd() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ToString(); con.Open(); cmd = new SqlCommand("select Login_Name,First_Name,Photo from tbl_SN_Profile where Login_Name in(select AddFrnd from tbl_SN_Frnd where UserLogName='" + Session["Login_Name"].ToString() + "') ", con); dr = cmd.ExecuteReader(); return dr; } public string GetChatPage() { return ("TheChatScreenWin.aspx"); } protected void BT_Send_Click(object sender, EventArgs e) { string sChannel = ""; string sUser = ""; if ( Request.Params["Channel"] != null ) sChannel = Request.Params["Channel"].ToString(); else sChannel = "1";

- 78 -

if ( Request.Params["User"] != null ) sUser = Request.Params["User"].ToString(); else { Random pRan = new Random(); int iNum = pRan.Next(9); sUser = "Annonymouse" + iNum; } if ( TB_ToSend.Text.Length > 0) {

SuperJockey.PageModule.Chat.AddMessage(sChannel,sUser,TB_ToSend.Text); TB_ToSend.Text = ""; } }

protected void rpimage_Click(object sender, ImageClickEventArgs e) { ImageButton img = sender as ImageButton; if (img != null) { DataListItem rp = img.NamingContainer as DataListItem; if (rp != null) { Label lblLoginName = (Label)rp.FindControl("rplblLogName"); Session["logname"] = lblLoginName.Text; } } Response.Redirect("frndHomePage.aspx"); } }

- 79 -

BlogList.aspx:-

BlogList.aspx:-

<%@ Page language="c#" Inherits="DotNetBlog.BlogList" MasterPageFile="~/MasterPage.master" CodeFile="BlogList.aspx.cs" %> <asp:Content ID ="blog" ="server"> ContentPlaceHolderID="ContentPlaceHolder1" runat

<table cellpadding ="0" cellpadding="0" border"0"> <tr> <tr> <td> <asp:label id="Label1" runat="server">Dosti Blog</asp:label> </td> <td> <asp:button id="btnOpenEntry" runat="server" onclick="btnOpenEntry_Click"></asp:button> </tr> </td> </table> <asp:table id="BlogTable" runat="server" Height="16px" Width="432px" GridLines="None"></asp:table> Text="Comments"

- 80 -

</asp:Content>

BlogList.aspx.cs:using using using using using using using using using using using System; System.Collections; System.ComponentModel; System.Data; System.Drawing; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls; System.IO;

namespace DotNetBlog { /// <summary> /// Summary description for BlogList. /// </summary> public partial class BlogList : System.Web.UI.Page { protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (IsPostBack) { } else {

// initialize Blog and read it into a dataset DataSet ds = ReadBlogIntoTable(); // if we created a new entry, append it to the // and save it to the xml file if ( (bool)Session["Changed"]) { AppendComments(ds); WriteXmlComments(ds); Session["Changed"] = false; }

BlogList

WebControls.Table } }

// Dynamically build the blog into a RebuildTableView(ds);

DataSet ReadBlogIntoTable() { return ReadXmlComments(); } private DataSet ReadXmlComments() { // construct the DataSet

- 81 -

DataSet ds = new DataSet(); // form the server path of the feedback database string filename = Server.MapPath(".\\") + // if the file exists, read data set the blog database into the

"comments.xml";

if (File.Exists(filename)) { ds.ReadXml(filename); } else { // otherwise we need to create a new new in// Database table from scratch DataTable theTable = new DataTable("Comments"); ds.Tables.Add(theTable);

memory

// add a name, time, title, and blog columns to our mock-up blog database theTable.Columns.Add("Name", Type.GetType("System.String")); theTable.Columns.Add("Time", Type.GetType("System.DateTime")); theTable.Columns.Add("Title", Type.GetType("System.String")); theTable.Columns.Add("Blog", Type.GetType("System.String")); } return ds; } private void WriteXmlComments(DataSet ds) { string filename = Server.MapPath(".\\") + "comments.xml"; ds.WriteXml(filename); } /// <summary> /// Append comments to xml file /// </summary> /// <param name="ds"></param> void AppendComments(DataSet ds) { // create a new DataRow DataRow dr = ds.Tables["Comments"].NewRow(); // Populate the row from the text boxes filled by the user dr[0] dr[1] dr[2] dr[3] = = = = Session["Name"]; DateTime.Now; Session["Title"]; Session["Blog"];

// add the row to the DataSet

- 82 -

ds.Tables["Comments"].Rows.InsertAt(dr, 0); WriteXmlComments(ds); } void RebuildTableView(DataSet ds) { string previousUser = ""; // track previous // loop through each row in the data set and create // the row on the web page in a web table foreach (DataRow dr in ds.Tables[0].Rows) { // add title (use a single column) TableRow tr = new TableRow(); tr.Cells.Add(new TableCell()); // change title color slightly tr.Cells[0].ForeColor = Color.Navy; tr.Cells[0].Width = 400; make the text title big and purple tr.Cells[0].Text = "<FONT SIZE=5 COLOR=purple FACE=Rockwell><B>" + dr[2].ToString() + "</B></FONT>"; this.BlogTable.Rows.Add(tr); // add blog in a single column and span 2 columns tr = new TableRow(); tr.Cells.Add(new TableCell()); tr.Cells[0].Width = 550; tr.Cells[0].ColumnSpan = 2; tr.Cells[0].Text = dr[3].ToString(); this.BlogTable.Rows.Add(tr); // add user who posted and date (use two tr = new TableRow(); tr.Height = 50; tr.HorizontalAlign = HorizontalAlign.Left; tr.VerticalAlign = VerticalAlign.Bottom; tr.Cells.Add(new TableCell()); tr.Cells.Add(new TableCell()); tr.Cells[0].Text = "Posted by " + //

columns in the row)

dr[0].ToString();

DateTime postTime = DateTime.Parse(dr[1].ToString()); tr.Cells[1].HorizontalAlign = HorizontalAlign.Right; tr.Cells[1].Text = String.Format("<i>{0}</i>", postTime.ToString("MMM dd, 2005 @ hh:mm")); this.BlogTable.Rows.Add(tr); // add separtor graphic and span 2 columns tr = new TableRow();

- 83 -

tr.Cells.Add(new TableCell()); tr.Cells.Add(new TableCell()); tr.Cells[0].ColumnSpan = 2; this.BlogTable.Rows.Add(tr); string imageFile = this.ResolveUrl( @".\images\separator.jpg"); System.Web.UI.WebControls.Image separator = new System.Web.UI.WebControls.Image(); separator.ImageUrl = imageFile; separator.Width = 600; separator.Height = 32; separator.Visible = true; tr.Cells[0].Controls.Add(separator); tr.Cells[0].HorizontalAlign = HorizontalAlign.Center; } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { } #endregion protected void btnOpenEntry_Click(object sender, System.EventArgs e) { Response.Redirect("BlogEntry.aspx"); } } }

- 84 -

BlogEntry.aspx:-

BlogEntry.aspx:<%@ Page language="c#" Inherits="DotNetBlog.BlogEntry" MasterPageFile="~/MasterPage.master" CodeFile="BlogEntry.aspx.cs" %> <asp:Content ID ="blog" ="server"> ContentPlaceHolderID="ContentPlaceHolder1" runat

7.1">

<%--<HEAD> <title>BlogEntry</title> <meta name="vs_snapToGrid" content="False"> <meta name="vs_showGrid" content="False"> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET

<meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD>--%> <body> <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="584" border="1"> <TR> <TD style="WIDTH: 171px; HEIGHT: 246px">

- 85 -

<b> Post Blog: </b> </TD> <TD style="HEIGHT: 246px"> <asp:TextBox id="txtBlog" runat="server" Height="234px" Width="427px" TextMode="MultiLine"></asp:TextBox></TD> </TR> <TR> <TD style="WIDTH: 171px; HEIGHT: 25px" align="right"><STRONG>Name:</STRONG></TD> <TD style="HEIGHT: 25px"> <asp:TextBox id="txtName" runat="server" Width="191px"></asp:TextBox></TD> </TR> <TR> <TD style="WIDTH: 171px; HEIGHT: 28px" align="right"><STRONG>Blog Title:</STRONG></TD> <TD style="HEIGHT: 28px"> <asp:TextBox id="txtTitle" runat="server" Width="426px"></asp:TextBox></TD> </TR> <TR> <TD style="WIDTH: 171px"></TD> <TD> <asp:Button id="btnSubmit" runat="server" Width="78px" Text="Submit" onclick="btnSubmit_Click" ValidationGroup="save"></asp:Button> <asp:Button id="btnClear" runat="server" Width="78px" Text="Clear" CausesValidation="False" onclick="btnClear_Click"></asp:Button>&nbsp; <asp:HyperLink id="BlogLink" runat="server" Height="22px" Width="96px" NavigateUrl="BlogList.aspx">Back to Blog</asp:HyperLink></TD> </TR> </TABLE><%-<asp:ValidationSummary id="ValidationSummary1" style="Z-INDEX: 102; LEFT: 320px; POSITION: absolute; TOP: 421px" runat="server" ValidationGroup="save"></asp:ValidationSummary> <asp:RequiredFieldValidator id="RequiredFieldValidator3" style="Z-INDEX: 103; LEFT: 600px; POSITION: absolute; TOP: 424px" runat="server" ErrorMessage="Please fill in a blog." ControlToValidate="txtBlog" Display="None" ValidationGroup="save"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator id="RequiredFieldValidator1" style="Z-INDEX: 104; LEFT: 647px; POSITION: absolute; TOP: 466px" runat="server" ErrorMessage="Please fill in your name." ControlToValidate="txtName" Display="None" ValidationGroup="save"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator id="RequiredFieldValidator2" style="Z-INDEX: 105; LEFT: 659px; POSITION: absolute; TOP: 398px" runat="server" ErrorMessage="Please fill in a title." ControlToValidate="txtTitle" Display="None" ValidationGroup="save"></asp:RequiredFieldValidator>

- 86 -

--%> </body> </asp:Content>

BlogEntry.aspx.cs:using using using using using using using using using using

System; System.Collections; System.ComponentModel; System.Data; System.Drawing; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls;

namespace DotNetBlog { /// <summary> /// Summary description for BlogEntry. /// </summary> public partial class BlogEntry : System.Web.UI.Page { protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { } #endregion protected void btnSubmit_Click(object sender, System.EventArgs e) { // record the blog data in the Session State Session["Title"] = this.txtTitle.Text; Session["Blog"] = this.txtBlog.Text; Session["Name"] = this.txtName.Text;

- 87 -

Session["Changed"] = true; // redirect backt to the main blog page this.Response.Redirect("BlogList.aspx");

} e)

protected void btnClear_Click(object sender, System.EventArgs { this.txtTitle.Text = ""; this.txtBlog.Text = ""; this.txtName.Text = ""; this.Response.Redirect("BlogEntry.aspx"); } } }

//

- 88 -

EdittProfile.aspx:-

EdittProfile.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EdittProfile.aspx.cs" Inherits="EdittProfile" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Edit Profile</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel1" runat="server" Height="479px" Style="zindex: 100; left: 373px; position: absolute; top: 94px" Width="547px"> <table style="width: 521px; height: 493px"> <tr> <td align="right" style="color: white; width: 268px;"> First Name : </td> <td style="width: 269px">

- 89 -

&nbsp;&nbsp;<asp:TextBox ID="txtFirstName" runat="server" Width="200px"></asp:TextBox></td> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Last Name : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:TextBox ID="txtLastName" runat="server" Width="200px"></asp:TextBox></td> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Age : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:TextBox ID="txtAge" runat="server" Width="200px" MaxLength="3"></asp:TextBox></td> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Gender : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:DropDownList ID="ddlGender" runat="server" Width="200px"> <asp:ListItem>Male</asp:ListItem> <asp:ListItem>Female</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Languages i speak : </td> <td style="width: 269px"> &nbsp;&nbsp; <asp:Textbox ID="txtLanguage" runat="server" Width="200px" /> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Interested In : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:TextBox ID="txtInterest" runat="server" Width="200px" ></asp:TextBox> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Religion : </td> <td style="width: 269px">

- 90 -

&nbsp;&nbsp;<asp:TextBox ID="txtReligion" runat="server" Width="200px" ></asp:TextBox> </tr> <tr> <td align="right" style="color: white; height: 26px; width: 268px;"> City : </td> <td style="height: 26px; width: 269px;"> &nbsp;&nbsp;<asp:TextBox ID="txtLocation" runat="server" Width="200px"></asp:TextBox></td> </tr> <tr> 268px;"> <td align="right" style="color: white; width:

Home Town : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:Textbox ID="txtHomeTown" runat="server" Width="200px" /> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Country : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:Textbox ID="txtCountry" runat="server" Width="200px" /> </tr> <tr> <td align="right" style="color: white; width: 268px;"> Photo : </td> <td style="width: 269px"> &nbsp;&nbsp;<asp:FileUpload ID="fuPhoto"

runat="server" /> </tr>

</table> <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" style="z-index: 100; left: 394px; position: absolute; top: 495px" Width="75px" /> </asp:Panel> &nbsp; <asp:Label ID="Label1" runat="server" Font-Bold="True" FontItalic="False" Font-Size="XX-Large" ForeColor="White" Style=" text-align:center ; z-index: 101; left: 431px; position: absolute; top: 50px;" Text="Edit Your Profile Here :" Width="514px" BorderColor="White" BorderStyle="Groove"></asp:Label> &nbsp;

- 91 -

</div> </form> </body> </html>

EdittProfile.aspx.cs:using using using using using using using using using using using

System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class EdittProfile : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; string Login_Name; protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else { body1.Attributes["background"] = "Photos/bg.jpg"; } Login_Name = Session["Login_Name"].ToString(); if (!IsPostBack) { Data(); } } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where Login_Name='"+Login_Name+"'", con); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { txtFirstName.Text = dr["First_Name"].ToString();

- 92 -

txtLastName.Text = dr["Last_Name"].ToString(); txtAge.Text = dr["Age"].ToString(); txtInterest.Text = dr["Interest"].ToString(); txtLocation.Text = dr["Location"].ToString(); ddlGender.Text = dr["Gender"].ToString(); txtLanguage.Text = dr["Language"].ToString(); txtReligion.Text = dr["Religion"].ToString(); txtHomeTown.Text = dr["HomeTown"].ToString(); txtCountry.Text = dr["Country"].ToString(); } } dr.Close(); con.Close(); } protected void btnSave_Click(object sender, EventArgs e) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); if (fuPhoto.HasFile) { fuPhoto.SaveAs(System.IO.Path.Combine(Server.MapPath("Photos" ), fuPhoto.FileName)); //lblImg.Text = FileUpload1.FileName; //imgPhoto.ImageUrl = "~/Project Management/Photo/" + lblImg.Text; cmd = new SqlCommand("update tbl_SN_Profile set First_Name='" + txtFirstName.Text + "',Last_Name='" + txtLastName.Text + "',Age='" + txtAge.Text + "',Gender='" + ddlGender.Text + "',Location='" + txtLocation.Text + "',Interest='" + txtInterest.Text + "',Language='"+txtLanguage.Text+"',Religion='"+txtReligion.Text+"',HomeTo wn='"+txtHomeTown.Text+"',Country='"+txtCountry.Text+"',Photo='"+fuPhoto. FileName+"'where Login_Name='"+ Login_Name +"'", con); } else { cmd = new SqlCommand("update tbl_SN_Profile set First_Name='" + txtFirstName.Text + "',Last_Name='" + txtLastName.Text + "',Age='" + txtAge.Text + "',Gender='" + ddlGender.Text + "',Location='" + txtLocation.Text + "',Interest='" + txtInterest.Text + "',Language='" + txtLanguage.Text + "',Religion='" + txtReligion.Text + "',HomeTown='" + txtHomeTown.Text + "',Country='" + txtCountry.Text + "' where Login_Name='" + Login_Name + "'", con); } cmd.ExecuteNonQuery(); con.Close(); Response.Redirect("Home.aspx"); } }

- 93 -

Scrap.aspx:-

Scrap.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="scrapbook.aspx.cs" Inherits="scrapbook" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Scrap</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel1" runat="server" Height="355px" Style="zindex: 100; left: 79px; position: absolute; top: 66px" Width="670px"> <asp:TextBox ID="txtScrapBook" runat="server" Height="24px" Style="z-index: 100; left: 533px; position: absolute; top: -55px" TextMode="MultiLine" Width="1px" Visible="False"></asp:TextBox> <asp:Button ID="btnPost" runat="server" Style="z-index: 101; left: 538px; position: absolute;

- 94 -

top: -51px" Text="Post" OnClick="btnPost_Click" Width="10px" Visible="False" /> &nbsp;&nbsp; <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" style="z-index: 104; left: 1px; position: absolute; top: 9px" BackColor="Transparent" BorderColor="Transparent" CellPadding="4" ForeColor="Black" GridLines="Horizontal"> <Columns> <asp:TemplateField HeaderText="Scrap's"> <ItemTemplate> <asp:Label ID="lblLog" runat="server" Text='<%#bind("Login_Name") %>' Visible="false"></asp:Label> <table width="100%"> <tr> <td> <asp:Label ID="lblName" runat="server" Style="text-align: center" Width="80" ForeColor="white" Font-Bold="true" Text='<%#bind("First_Name") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Image ID="rpimage" runat="server" Width="80px" Height="80px" ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' /> </td> <td> <asp:TextBox ID="txtScrap" runat="server" Height="80" ReadOnly="true" Text='<%#bind("scrap") %>' Width="525px"></asp:TextBox><br /> <asp:LinkButton ID="lnkReply" runat="Server" Text="Reply" ForeColor="white" OnClick="lnkReply_Click" ></asp:LinkButton> </td> </tr> <tr> <td> <td><asp:TextBox ID="txtReply" visible="false" runat="server" Height="80" Width="525px"></asp:TextBox> <asp:Button ID="btnPostReply" visible="false" runat="server" ForeColor="black" Text="Post" OnClick="btnPostReply_Click" /> <asp:Button ID="btnCancel" runat="server" visible="false" Text="Cancel" OnClick="btnCancel_Click" /> </td> </tr> </table>

</ItemTemplate> </asp:TemplateField> </Columns> <FooterStyle BackColor="#CCCC99" ForeColor="Black" />

- 95 -

<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CC3333" FontBold="True" ForeColor="White" /> <HeaderStyle BackColor="Transparent" FontBold="True" ForeColor="White" /> </asp:GridView> </asp:Panel> &nbsp;&nbsp; <asp:Label ID="lblNameLogin" runat="server" Style="z-index: 101; left: 0px; position: absolute; top: 0px" Text="Label" Visible="false"></asp:Label> &nbsp;&nbsp; <asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57" Height="28px" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="zindex: 103; left: 80px; position: absolute; top: 35px; text-align: center" Width="61px"> <StaticSelectedStyle BackColor="#5D7B9D" /> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" /> <DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" /> <Items> <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> </Items> </asp:Menu> </div> </form> </body> </html>

Scrap.aspx.cs:using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class scrapbook : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr;

- 96 -

protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else { body1.Attributes["background"] = "Photos/bg.jpg"; } lblNameLogin.Text = Session["Login_Name"].ToString(); if (!IsPostBack) { Data(); }

} protected void btnPost_Click(object sender, EventArgs e) { //if (txtScrapBook.Text != "") //{ // con = new SqlConnection(); // con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; // con.Open(); // cmd = new SqlCommand("insert into tbl_Scrap(Login_Name,scrap)values('" + lblNameLogin.Text + "','" + txtScrapBook.Text + "')", con); // cmd.ExecuteReader(); // con.Close(); // txtScrapBook.Text = ""; // Data(); //} } protected void btnPostReply_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null) { GridViewRow gvr = btn.NamingContainer as GridViewRow; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtReply"); Label lbl = (Label)gvr.FindControl("lblLog"); if (txt.Text != "") { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("insert into tbl_SN_Scrap(ToMe,WrittenBy,scrap,ScrapTime)values('" + lbl.Text + "','"

- 97 -

+ Session["Login_Name"].ToString() + "','" + txt.Text + "','" + DateTime.Now.ToString() + "')", con); cmd.ExecuteReader(); con.Close(); txtScrapBook.Text = ""; Data(); } } } } protected void btnCancel_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null) { GridViewRow gvr = btn.NamingContainer as GridViewRow; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtReply"); txt.Visible = false; Button btnPost = (Button)gvr.FindControl("btnPostReply"); btnPost.Visible = false; Button btnCancel = (Button)gvr.FindControl("btnCancel"); btnCancel.Visible = false; LinkButton lnkReply = (LinkButton)gvr.FindControl("lnkReply"); lnkReply.Visible = true; } } } protected void lnkReply_Click(object sender, EventArgs e) { LinkButton btn = sender as LinkButton; if (btn != null) { GridViewRow gvr = btn.NamingContainer as GridViewRow; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtReply"); txt.Visible = true; Button btnPost = (Button)gvr.FindControl("btnPostReply"); btnPost.Visible = true; Button btnCancel = (Button)gvr.FindControl("btnCancel"); btnCancel.Visible = true; LinkButton lnkReply = (LinkButton)gvr.FindControl("lnkReply"); lnkReply.Visible = false; } } } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString;

- 98 -

con.Open(); cmd = new SqlCommand("select a.scrap,b.Login_Name, b.Photo,b.First_Name from tbl_SN_Scrap a join tbl_SN_Profile b on a.WrittenBy=b.Login_Name where ToMe='" + lblNameLogin.Text + "'order by a.ScrapTime desc", con); dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind(); // GridView1.HeaderRow.Visible = false; } }

- 99 -

PhotoGallery.aspx:-

PhotoGallery.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PhotoGallery.aspx.cs" Inherits="PhotoGallery" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Photo Gallery</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel1" runat="server" Height="497px" Style="zindex: 100; left: 50px; position: absolute; top: 65px" Width="647px"> &nbsp; <asp:Panel ID="Panel2" runat="server" Height="226px" Style="z-index: 100; left: 2px; position: absolute; top: 91px" Width="485px"> &nbsp;<asp:DataList ID="Datalist1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" > <ItemTemplate> <table width="100%">

- 100 -

<tr> <asp:ImageButton ID="rpimage" runat="server" Width="150px" Height="150px" AlternateText='< %#Eval("Photo") %>' ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' OnClick="rpimage_Click" /> </td> </tr> <tr> <td> <asp:Label ID="lblComment" runat="server" Text='<%#bind("Comment") %>' ForeColor="white"></asp:Label><br /> <asp:LinkButton ID="lnkComment" runat="Server" Text="Add Comment" ForeColor="white" OnClick="lnkComment_Click"></asp:LinkButton> </td> </tr> <tr> <td> <asp:TextBox ID="txtComment" Visible="false" TextMode="MultiLine" Width="150px" runat="server"></asp:TextBox> <asp:Button ID="btnComment" visible="false" runat="server" ForeColor="black" Text="Submit" OnClick="btnComment_Click"/> <asp:Button ID="btnCancel" visible="false" runat="server" ForeColor="black" Text="Cancel" OnClick="btnCancel_Click" /> </td> </tr> </table> </ItemTemplate> <SeparatorTemplate> <hr size="20" /> </SeparatorTemplate> </asp:DataList> </asp:Panel> <asp:Panel ID="Panel3" runat="server" Height="65px" Style="zindex: 101; left: 1px; position: absolute; top: 3px" Visible="False" Width="254px"> <asp:FileUpload ID="FileUpload1" runat="server" Style="zindex: 100; left: 6px; position: absolute; top: 10px" /> <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Style="z-index: 102; left: 22px; position: absolute; top: 35px" Text="Upload" Width="98px" /> </asp:Panel> <asp:LinkButton ID="lnkphoto" runat="server" OnClick="lnkphoto_Click" Style="z-index: 102; left: 12px; position: absolute; top: 32px" ForeColor="White">Add Photo</asp:LinkButton> <td>

- 101 -

<asp:Label ID="lblGallery" runat="server" ForeColor="White" Font-Bold="True" Style="z-index: 104; left: 0px; position: absolute; top: 72px" Text="My Photo Gallery" Font-Size="Large"></asp:Label> </asp:Panel> <asp:Label ID="lblNameLogin" runat="server" Style="z-index: 101; left: 0px; position: absolute; top: 0px" Text="Label" Visible="false"></asp:Label> &nbsp; <asp:Menu ID="Menu1" runat="server" BackColor="Transparent" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Georgia" Font-Size="Large" ForeColor="White" Height="28px" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="zindex: 102; left: 54px; position: absolute; top: 30px; text-align: center" Width="61px"> <StaticSelectedStyle BackColor="#5D7B9D" /> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" /> <DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" /> <Items> <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> </Items> </asp:Menu> <asp:Panel ID="Panel4" runat="server" Height="400px" Style="zindex: 104; left: 345px; position: absolute; top: 130px" Visible="False" Width="400"> <asp:Image ID="Image1" runat="server" Height="377px" Style="z-index: 100; left: 0px; position: absolute; top: 22px" Width="399px" /> <asp:LinkButton ID="LinkButton1" runat="server" FontBold="True" ForeColor="White" OnClick="LinkButton1_Click" Style="z-index: 102; left: 357px; position: absolute; top: 3px">Close</asp:LinkButton> </asp:Panel> </div> </form> </body> </html>

PhotoGallery.aspx.cs:using using using using using using using using

System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls;

- 102 -

using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class PhotoGallery : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else {

body1.Attributes["background"] = "Photos/bg.jpg";

} protected void btnUpload_Click(object sender, EventArgs e) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); FileUpload1.SaveAs(System.IO.Path.Combine(Server.MapPath("Photos" ), FileUpload1.FileName)); cmd = new SqlCommand("insert into tbl_SN_photogallery(Login_Name,photo)values('" + lblNameLogin.Text + "','" + FileUpload1.FileName + "')", con); cmd.ExecuteReader(); con.Close(); Panel3.Visible = false; lnkphoto.Visible = true; Data(); } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_PhotoGallery where Login_Name='" + lblNameLogin.Text + "'", con); dr = cmd.ExecuteReader(); Datalist1.DataSource = dr;

} lblNameLogin.Text = Session["Login_Name"].ToString(); if (!IsPostBack) { Data(); }

- 103 -

Datalist1.DataBind(); } protected void lnkphoto_Click(object sender, EventArgs e) { Panel3.Visible = true; lnkphoto.Visible = false; } protected void lnkComment_Click(object sender, EventArgs e) { LinkButton btn = sender as LinkButton; if (btn != null) { DataListItem gvr = btn.NamingContainer as DataListItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtComment"); txt.Visible = true; Button btnComment = (Button)gvr.FindControl("btnComment"); btnComment.Visible = true; Button btnCancel = (Button)gvr.FindControl("btnCancel"); btnCancel.Visible = true; LinkButton lnkComment = (LinkButton)gvr.FindControl("lnkComment"); lnkComment.Visible = false; } } } protected void btnComment_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null) { DataListItem gvr = btn.NamingContainer as DataListItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtComment"); Image img = (Image)gvr.FindControl("rpimage"); Label lbl = (Label)gvr.FindControl("lblLog"); if (txt.Text != "") { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("update tbl_SN_PhotoGallery set Comment='" + txt.Text + "' where Login_Name='" + Session["Login_Name"].ToString() + "' and Photo='" + img.AlternateText + "'", con); cmd.ExecuteReader(); con.Close(); txt.Text = ""; Data(); } } }

- 104 -

} protected void btnCancel_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null) { DataListItem gvr = btn.NamingContainer as DataListItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtComment"); txt.Visible = false; txt.Text = ""; Button btnComment = (Button)gvr.FindControl("btnComment"); btnComment.Visible = false; Button btnCancel = (Button)gvr.FindControl("btnCancel"); btnCancel.Visible = false; LinkButton lnkComment = (LinkButton)gvr.FindControl("lnkComment"); lnkComment.Visible = true; } } } protected void rpimage_Click(object sender, ImageClickEventArgs e) { ImageButton img = sender as ImageButton; if (img != null) { DataListItem rp = img.NamingContainer as DataListItem; if (rp != null) { Panel4.Visible = true; Panel1.Visible = false; Image1.ImageUrl = "Photos/" + img.AlternateText; } } } protected void LinkButton1_Click(object sender, EventArgs e) { Panel4.Visible = false; Panel1.Visible = true; } }

- 105 -

ChangeBackground.aspx:-

ChangeBackground.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChangeBackGround.aspx.cs" Inherits="ChangeBackGround" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel1" runat="server" Height="140px" Style="zindex: 100; left: 405px; position: absolute; top: 111px" Width="593px" BorderColor="White" BorderStyle="Double"> &nbsp; <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 40px; position: absolute; top: 118px" Text="Classic" Font-Bold="True" ForeColor="White"></asp:Label><asp:ImageButton ID="ImageButton2" ImageUrl="~/Photos/redwood_shoot.jpg" runat="server" width="100px"

- 106 -

Height="100px" style="z-index: 101; left: 126px; position: absolute; top: 9px" OnClick="ImageButton2_Click" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" /> <asp:ImageButton ID="ImageButton1" ImageUrl="~/Photos/bg.jpg" runat="server" width="100px" Height="100px" OnClick="ImageButton1_Click" style="z-index: 102; left: 9px; position: absolute; top: 11px" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" /> &nbsp;<asp:ImageButton ID="ImageButton3" ImageUrl="~/Photos/ginny.jpg" runat="server" width="100px" Height="100px" style="z-index: 103; left: 241px; position: absolute; top: 9px" OnClick="ImageButton3_Click" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" /> <asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 104; left: 155px; position: absolute; top: 117px" Text="Normal"></asp:Label> <asp:Label ID="Label3" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 105; left: 272px; position: absolute; top: 114px" Text="Simple"></asp:Label> <asp:Label ID="Label4" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 106; left: 397px; position: absolute; top: 114px" Text="Blue"></asp:Label> <asp:Label ID="Label6" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 110; left: 510px; position: absolute; top: 114px" Text="New"></asp:Label> <asp:ImageButton ID="ImageButton4" ImageUrl="~/Photos/blue.jpg" runat="server" width="100px" Height="100px" style="z-index: 108; left: 360px; position: absolute; top: 9px" OnClick="ImageButton4_Click" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" /> <asp:ImageButton ID="ImageButton5" ImageUrl="~/Photos/111.jpg" runat="server" width="100px" Height="100px" style="z-index: 109; left: 479px; position: absolute; top: 8px" OnClick="ImageButton5_Click" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" /> </asp:Panel> <asp:Menu ID="Menu1" runat="server" BackColor="Transparent" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Georgia" Font-Size="Large" ForeColor="White" Height="28px" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="zindex: 101; left: 62px; position: absolute; top: 21px; text-align: center" Width="61px"> <StaticSelectedStyle BackColor="#5D7B9D" /> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" /> <DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" /> <Items>

- 107 -

<asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> </Items> </asp:Menu> <asp:Label ID="Label5" runat="server" Font-Bold="True" FontSize="XX-Large" ForeColor="White" Style="z-index: 103; left: 574px; position: absolute; top: 79px" Text="BackGround's"></asp:Label> </div> </form> </body> </html>

ChangeBackground.aspx.cs:using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class ChangeBackGround : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; //string STR = ""; protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else { body1.Attributes["background"] = "Photos/bg.jpg"; } } public void ChangeBG(string STR1) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd=new SqlCommand("update tbl_SN_Profile set BackGround='"+ STR1+"' where Login_Name='"+Session["Login_Name"].ToString()+"'",con); cmd.ExecuteNonQuery();

- 108 -

e)

} protected void ImageButton1_Click(object sender, ImageClickEventArgs {

ChangeBG("bg.jpg"); Session["bg"] = "bg.jpg"; body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } protected void ImageButton2_Click(object sender, e) { ChangeBG("redwood_shoot.jpg"); Session["bg"] = "redwood_shoot.jpg"; body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } protected void ImageButton3_Click(object sender, e) { ChangeBG("ginny.jpg"); Session["bg"] = "ginny.jpg"; body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } protected void ImageButton4_Click(object sender, e) { ChangeBG("blue.jpg"); Session["bg"] = "blue.jpg"; body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } protected void ImageButton5_Click(object sender, e) { ChangeBG("111.jpg"); Session["bg"] = "111.jpg"; body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } }

ImageClickEventArgs

ImageClickEventArgs

ImageClickEventArgs

ImageClickEventArgs

- 109 -

FrndHomePage.apsx:-

FrndHomePage.apsx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="frndHomePage.aspx.cs" Inherits="frndHomePage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Home</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel1" runat="server" Height="373px" Style="zindex: 100; left: 60px; position: absolute; top: 65px" Width="625px"> <asp:Image ID="imgPhoto" runat="server" Height="151px" Style="z-index: 100; left: 7px; position: absolute; top: 10px" Width="151px" /> &nbsp; &nbsp; &nbsp; <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/frndScrapbook.aspx" Style="z-index: 101; left: 10px; position: absolute; top: 170px" Width="109px" ForeColor="White">Scrap Book</asp:LinkButton>

- 110 -

<asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl="~/frndPhiotoGallery.aspx" Style="z-index: 102; left: 9px; position: absolute; top: 191px" ForeColor="White">PhotoGallery</asp:LinkButton> <asp:Label ID="lblWelcome" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 103; left: 177px; position: absolute; top: 14px"></asp:Label> <asp:Label ID="lblInterest" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 104; left: 182px; position: absolute; top: 284px"></asp:Label> <asp:Label ID="lblAge" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 105; left: 180px; position: absolute; top: 47px"></asp:Label> <asp:Label ID="lblReligion" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 106; left: 180px; position: absolute; top: 117px"></asp:Label> <asp:Label ID="lblCity" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 107; left: 181px; position: absolute; top: 184px"></asp:Label> <asp:Label ID="lblHomeTown" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 108; left: 182px; position: absolute; top: 216px"></asp:Label> <asp:Label ID="lblCountry" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 109; left: 182px; position: absolute; top: 251px"></asp:Label> <asp:Label ID="lblLanguage" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 110; left: 180px; position: absolute; top: 151px"></asp:Label> <asp:Label ID="lblGender" runat="server" Font-Bold="True" ForeColor="White" Style="z-index: 112; left: 180px; position: absolute; top: 82px"></asp:Label> </asp:Panel> &nbsp; <asp:Label ID="lblN" runat="server" Style="z-index: 101; left: 9px; position: absolute; top: 11px" Visible="false"></asp:Label> <asp:Panel ID="Panel2" runat="server" Height="24px" Style="zindex: 102; left: 706px; position: absolute; top: 37px" Width="289px" Visible="False"> <asp:TextBox ID="txtSearch" runat="server" BorderStyle="Ridge" Style="z-index: 100; left: 0px; position: absolute; top: 0px" Width="207px"></asp:TextBox> <asp:Button ID="btnSearch" runat="server" BorderStyle="Outset" OnClick="btnSearch_Click" Style="z-index: 102; left: 220px; position: absolute; top: 1px" Text="Search" /> </asp:Panel> &nbsp; <asp:Panel ID="Panel4" runat="server" Height="235px" Style="zindex: 103; left: 707px; position: absolute; top: 90px" Width="282px"> &nbsp;<asp:DataList ID="Datalist1" RepeatDirection="Horizontal" RepeatColumns="3" Width="231px" runat="server" BorderColor="White" BorderStyle="Solid"> <ItemTemplate>

- 111 -

<asp:ImageButton ID="rpimage" runat="server" Height="60px" AlternateText='<%# Eval("First_Name") %>' ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' OnClick="rpimage_Click" Width="60px" /><br /> <asp:Label ID="rpLblName" runat="server" ForeColor="white" Style="text-align: center" Text='<%#bind("First_Name") %>' Width="60"></asp:Label> <asp:Label ID="rplblLogName" runat="server" Text='< %#bind("Login_Name") %>' Visible="false"></asp:Label> </ItemTemplate> <SeparatorTemplate> <hr color="White" size="auto" /> </SeparatorTemplate> </asp:DataList> </asp:Panel> <asp:Label ID="Label5" runat="server" Font-Bold="True" FontNames="Georgia" Font-Size="X-Large" ForeColor="White" Style="z-index: 104; left: 708px; position: absolute; top: 60px; text-align: center" Text="Friend List" Width="228px"></asp:Label> <asp:GridView ID="grdSearch" runat="server" AutoGenerateColumns="False" BackColor="Transparent" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="grdSearch_RowDataBound" OnRowUpdating="grdSearch_RowUpdating" Width="349px" style="z-index: 105; left: 236px; position: absolute; top: 408px" ForeColor="Black" GridLines="Horizontal"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label ID="lblNum" runat="server" Text='<%#bind("Num") %>' Visible="false"></asp:Label> <asp:Label ID="lblLogName" runat="server" Text='<%#bind("Login_Name") %>' Visible="false"></asp:Label> <asp:Image ID="imgPhoto" runat="server" Height="100px" ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' Width="100px" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:GridView ID="grdSearchInside" runat="server" AutoGenerateColumns="false" BackColor="transparent" BorderStyle="None" HorizontalAlign="Left" Width="150"> <Columns> <asp:TemplateField HeaderText="Search Result"> <ItemTemplate> <asp:Label ID="lblTextProName" runat="server" Text="First Name : "></asp:Label> <asp:Label ID="lblFirstName" runat="server" Text='<%#bind("First_Name") %>'></asp:Label><br />

- 112 -

<asp:Label ID="Label1" runat="server" Text="Last Name : "></asp:Label> <asp:Label ID="lblLastName" runat="server" Text='<%#bind("Last_Name") %>'></asp:Label><br /> <asp:Label ID="Label2" runat="server" Text="Age : "></asp:Label> <asp:Label ID="lblAges" runat="server" Text='<%#bind("Age") %>'></asp:Label><br /> <asp:Label ID="Label3" runat="server" Text="Location : "></asp:Label> <asp:Label ID="lblLocation" runat="server" Text='<%#bind("Location") %>'></asp:Label><br /> <asp:Label ID="Label4" runat="server" Text="Gender : "></asp:Label> <asp:Label ID="lblGender" runat="server" Text='<%#bind("Gender") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:Button ID="btnAddFrnd" runat="server" CommandName="update" Text="Add as a friend" /> </ItemTemplate> </asp:TemplateField> </Columns> <FooterStyle BackColor="#CCCC99" ForeColor="Black" /> <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CC3333" FontBold="True" ForeColor="White" /> <HeaderStyle BackColor="Transparent" FontBold="True" ForeColor="White" /> </asp:GridView> <asp:Menu ID="Menu1" runat="server" BackColor="Transparent" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Georgia" Font-Size="Large" ForeColor="White" Height="28px" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="zindex: 107; left: 62px; position: absolute; top: 34px; text-align: center" Width="61px"> <StaticSelectedStyle BackColor="#5D7B9D" /> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" /> <DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" /> <Items>

- 113 -

<asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> </Items> </asp:Menu> </div> </form> </body> </html>

FrndHomePage.apsx.cs:using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class frndHomePage : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; string Login_Name; protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else {

body1.Attributes["background"] = "Photos/bg.jpg";

} if (!IsPostBack) { lblN.Text = Session["logname"].ToString(); Login_Name = Session["logname"].ToString(); Data(); Datalist1.DataSource = Frnd(); Datalist1.DataBind(); } } public SqlDataReader Frnd() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ToString();

- 114 -

con.Open(); cmd = new SqlCommand("select Login_Name,First_Name,Photo from tbl_SN_Profile where Login_Name in(select AddFrnd from tbl_SN_Frnd where UserLogName='" + lblN.Text + "')", con); dr = cmd.ExecuteReader(); return dr; } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where Login_Name='" + Login_Name + "'", con); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { //txtFirstName.Text = dr["First_Name"].ToString(); //txtLastName.Text = dr["Last_Name"].ToString(); //txtAge.Text = dr["Age"].ToString(); //txtInterest.Text = dr["Interest"].ToString(); //txtLocation.Text = dr["Location"].ToString(); //ddlGender.Text = dr["Gender"].ToString(); imgPhoto.ImageUrl = "~/Photos/" + dr["Photo"].ToString(); lblWelcome.Text = "Welcome, " + dr["First_Name"].ToString(); lblAge.Text = "Age : " + dr["Age"].ToString(); lblInterest.Text = "Interested In : " + dr["Interest"].ToString(); lblCity.Text = "City : " + dr["Location"].ToString(); lblCountry.Text = "Country : " + dr["Country"].ToString(); lblHomeTown.Text = "HomeTown : " + dr["HomeTown"].ToString(); lblLanguage.Text = "Language : " + dr["Language"].ToString(); lblReligion.Text = "Religion : " + dr["Religion"].ToString(); lblGender.Text = "Gender : " + dr["Gender"].ToString(); } } dr.Close(); con.Close(); } protected void btnSearch_Click(object sender, EventArgs e) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where First_Name like '%" + txtSearch.Text + "%' or Last_Name like '%" + txtSearch.Text + "%' or Location like '%" + txtSearch.Text + "%'", con); dr = cmd.ExecuteReader();

- 115 -

grdSearch.DataSource = dr; grdSearch.DataBind(); grdSearch.HeaderRow.Visible = false; } protected void grdSearch_RowDataBound(object sender, GridViewRowEventArgs e) { Label lb = (Label)e.Row.FindControl("lblNum"); GridView gr = (GridView)e.Row.FindControl("grdSearchInside"); if (gr != null) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where Num='" + lb.Text + "'", con); dr = cmd.ExecuteReader(); gr.DataSource = dr; gr.DataBind(); gr.HeaderRow.Visible = false; } } protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { Label lb = (Label)e.Item.FindControl("lblNum"); GridView gr = (GridView)e.Item.FindControl("grdSearchInside"); if (gr != null) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_profile where Num='" + lb.Text + "'", con); dr = cmd.ExecuteReader(); gr.DataSource = dr; gr.DataBind(); gr.HeaderRow.Visible = false; } } protected void btnAddFrnd_Click(object source, RepeaterCommandEventArgs e) { //Label lb = (Label)e.Item.FindControl("lblNum"); //GridView gr = (GridView)e.Item.FindControl("grdSearchInside"); //if (gr != null) //{ // con = new SqlConnection(); // con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); // cmd = new SqlCommand("select * from tbl_profile where Num='" + lb.Text + "'", con); // dr = cmd.ExecuteReader();

- 116 -

} protected void grdSearch_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lb = (Label)grdSearch.Rows[e.RowIndex].FindControl("lblLogName"); con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("insert into tbl_SN_Frnd (UserLogName,AddFrnd)values('" + lblN.Text + "','" + lb.Text + "')", con); cmd.ExecuteNonQuery(); con.Close(); } protected void rpimage_Click(object sender, ImageClickEventArgs e) { ImageButton img =sender as ImageButton; if (img != null) { DataListItem rp = img.NamingContainer as DataListItem; if (rp != null) { Label lblLoginName = (Label)rp.FindControl("rplblLogName"); Session["logname"] = lblLoginName.Text; } } Response.Redirect("Try.aspx"); }

// // // //}

gr.DataSource = dr; gr.DataBind(); gr.HeaderRow.Visible = false;

- 117 -

frndPhiotoGallery.aspx:-

frndPhiotoGallery.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="frndPhiotoGallery.aspx.cs" Inherits="frndPhiotoGallery" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Photo Gallery</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <div> <asp:Panel ID="Panel1" runat="server" Height="300px" Style="z-index: 100; left: 81px; position: absolute; top: 61px" Width="494px"> &nbsp; <asp:Panel ID="Panel2" runat="server" Height="226px" Style="z-index: 100; left: 2px; position: absolute; top: 97px" Width="485px"> &nbsp;<asp:DataList ID="DataList1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" > <ItemTemplate>

- 118 -

<table width="100%"> <tr> <td> <asp:ImageButton ID="rpimage" runat="server" Width="150px" Height="150px" AlternateText='< %#Eval("Photo") %>' ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' OnClick="rpimage_Click" /> </td> </tr> <tr> <td> <asp:Label ID="lblComment" runat="server" Text='<%#bind("Comment") %>' ForeColor="white"></asp:Label><br /> <asp:LinkButton ID="lnkComment" runat="Server" Text="Add Comment" ForeColor="white" OnClick="lnkComment_Click"></asp:LinkButton> </td> </tr> <tr> <td> <asp:TextBox ID="txtComment" Visible="false" TextMode="MultiLine" Width="150px" runat="server"></asp:TextBox> <asp:Button ID="btnComment" visible="false" runat="server" ForeColor="black" Text="Submit" OnClick="btnComment_Click" /> <asp:Button ID="btnCancel" visible="false" runat="server" ForeColor="black" Text="Cancel" OnClick="btnCancel_Click" /> </td> </tr> </table> </ItemTemplate> <SeparatorTemplate> <hr color="transparent" size="10" /> </SeparatorTemplate> </asp:DataList> </asp:Panel> <asp:Panel ID="Panel3" runat="server" Height="65px" Style="z-index: 101; left: 5px; position: absolute; top: 3px" Visible="False" Width="254px"> <asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 100; left: 6px; position: absolute; top: 10px" /> <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Style="z-index: 102; left: 22px; position: absolute; top: 35px" Text="Upload" Width="98px" /> </asp:Panel> <asp:LinkButton ID="lnkphoto" runat="server" OnClick="lnkphoto_Click" Style="z-index: 102; left: 12px; position: absolute; top: 32px" ForeColor="White" Visible="False">Add Photo</asp:LinkButton>

- 119 -

<asp:Label ID="lblGallery" runat="server" FontBold="True" Style="z-index: 104; left: 0px; position: absolute; top: 72px" Text="My Photo Gallery" Font-Size="X-Large" ForeColor="White"></asp:Label> </asp:Panel> <asp:Label ID="lblNameLogin" runat="server" Style="z-index: 101; left: 1px; position: absolute; top: 2px" Text="Label" Visible="false"></asp:Label> <asp:Menu ID="Menu1" runat="server" BackColor="Transparent" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Georgia" Font-Size="Large" ForeColor="White" Height="28px" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="z-index: 102; left: 83px; position: absolute; top: 27px; text-align: center" Width="61px"> <StaticSelectedStyle BackColor="#5D7B9D" /> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" /> <DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" /> <Items> <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> </Items> </asp:Menu> <asp:Panel ID="Panel4" runat="server" Height="400px" width="400" Style="z-index: 103; left: 375px; position: absolute; top: 106px" Visible="False" > <asp:Image ID="Image1" runat="server" Height="377px" Style="z-index: 100; left: 0px; position: absolute; top: 22px" Width="399px"/> <asp:LinkButton ID="LinkButton1" runat="server" FontBold="True" ForeColor="White" OnClick="LinkButton1_Click" Style="z-index: 102; left: 357px; position: absolute; top: 3px">Close</asp:LinkButton> </asp:Panel> </div> </div> </form> </body> </html>

frndPhiotoGallery.aspx.cs:using using using using using using

System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security;

- 120 -

using using using using using

System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class frndPhiotoGallery : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else {

body1.Attributes["background"] = "Photos/bg.jpg";

} protected void btnUpload_Click(object sender, EventArgs e) { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); FileUpload1.SaveAs(System.IO.Path.Combine(Server.MapPath("Photos" ), FileUpload1.FileName)); cmd = new SqlCommand("insert into tbl_SN_photogallery(Login_Name,photo)values('" + lblNameLogin.Text + "','" + FileUpload1.FileName + "')", con); cmd.ExecuteReader(); con.Close(); Panel3.Visible = false; lnkphoto.Visible = true; Data(); } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("select * from tbl_SN_PhotoGallery where Login_Name='" + lblNameLogin.Text + "'", con); dr = cmd.ExecuteReader(); DataList1.DataSource = dr;

} lblNameLogin.Text = Session["logname"].ToString(); if (!IsPostBack) { Data(); }

- 121 -

DataList1.DataBind(); } protected void lnkphoto_Click(object sender, EventArgs e) { Panel3.Visible = true; lnkphoto.Visible = false; } protected void lnkComment_Click(object sender, EventArgs e) { LinkButton btn = sender as LinkButton; if (btn != null) { DataListItem gvr = btn.NamingContainer as DataListItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtComment"); txt.Visible = true; Button btnComment = (Button)gvr.FindControl("btnComment"); btnComment.Visible = true; Button btnCancel = (Button)gvr.FindControl("btnCancel"); btnCancel.Visible = true; LinkButton lnkComment = (LinkButton)gvr.FindControl("lnkComment"); lnkComment.Visible = false; } } } protected void btnComment_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null) { DataListItem gvr = btn.NamingContainer as DataListItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtComment"); Image img = (Image)gvr.FindControl("rpimage"); Label lbl = (Label)gvr.FindControl("lblLog"); if (txt.Text != "") { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("update tbl_SN_PhotoGallery set Comment='" + txt.Text + "' where Login_Name='" + Session["logname"].ToString() + "' and Photo='" + img.AlternateText + "'", con); cmd.ExecuteReader(); con.Close(); txt.Text = ""; Data(); } } }

- 122 -

} protected void btnCancel_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn != null) { DataListItem gvr = btn.NamingContainer as DataListItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtComment"); txt.Visible = false; txt.Text = ""; Button btnComment = (Button)gvr.FindControl("btnComment"); btnComment.Visible = false; Button btnCancel = (Button)gvr.FindControl("btnCancel"); btnCancel.Visible = false; LinkButton lnkComment = (LinkButton)gvr.FindControl("lnkComment"); lnkComment.Visible = true; } } } protected void rpimage_Click(object sender, ImageClickEventArgs e) { ImageButton img =sender as ImageButton; if (img != null) { DataListItem rp = img.NamingContainer as DataListItem; if (rp != null) { Panel4.Visible = true; Panel1.Visible = false; Image1.ImageUrl = "Photos/" + img.AlternateText; } } } protected void LinkButton1_Click(object sender, EventArgs e) { Panel4.Visible = false; Panel1.Visible = true; }

- 123 -

frndScrap.aspx:-

frndScrapbook.aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="frndScrapbook.aspx.cs" Inherits="frndScrapbook" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Scrap</title> </head> <body id="body1" runat="server"> <form id="form1" runat="server"> <div> <div> &nbsp; &nbsp;&nbsp; <asp:Label ID="lblNameLogin" runat="server" Style="z-index: 100; left: 10px; position: absolute; top: 10px" Text="Label" Visible="false"></asp:Label> &nbsp;&nbsp; <asp:Panel ID="Panel1" runat="server" Height="512px" Style="z-index: 101; left: 53px; position: absolute; top: 48px" Width="868px">

- 124 -

<asp:TextBox ID="txtScrapBook" runat="server" Height="80px" Style="z-index: 100; left: 8px; position: absolute; top: 17px" TextMode="MultiLine" Width="526px"></asp:TextBox> <asp:Button ID="btnPost" runat="server" OnClick="btnPost_Click" Style="z-index: 101; left: 547px; position: absolute; top: 77px" Text="Post" /> <asp:Panel ID="Panel2" runat="server" Height="219px" Style="z-index: 103; left: 11px; position: absolute; top: 126px" Width="525px"> <asp:GridView ID="GridView1" runat="server" BackColor="Transparent" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal" Style="z-index: 100; left: 2px; position: absolute; top: -6px" AutoGenerateColumns="False" Width="686px" OnRowDataBound="GridView1_RowDataBound"> <FooterStyle BackColor="#CCCC99" ForeColor="Black" /> <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CC3333" FontBold="True" ForeColor="White" /> <HeaderStyle BackColor="transparent" FontBold="True" ForeColor="White" /> <Columns> <asp:TemplateField HeaderText="Scrap's"> <ItemTemplate> <asp:Label ID="lblLog" ForeColor="white" runat="server" Text='<%#bind("Login_Name") %>' Visible="false"></asp:Label> <table width="100%"> <tr> <td> <asp:Label ID="lblName" ForeColor="white" runat="server" Style="text-align: center" FontBold="true" Text='<%#bind("First_Name") %>' Width="80px"></asp:Label><br /> </td> </tr> <tr> <td> <asp:Image ID="rpimage" runat="server" Width="80px" Height="80px" ImageUrl='<%# "~/Photos/" + DataBinder.Eval(Container.DataItem,"Photo") %>' /><br /> </td> <td><asp:TextBox ID="txtScrap" runat="server" Height="80" ReadOnly="true" Text='< %#bind("scrap") %>' Width="525px"></asp:TextBox></td> </tr> </table> </ItemTemplate> </asp:TemplateField> <%-- <asp:TemplateField> <ItemTemplate>

- 125 -

<asp:GridView ID="grdInside" runat="server" AutoGenerateColumn="false"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:TextBox ID="txtScrap" runat="server" Height="80" ReadOnly="true" Text='<%#bind("scrap") %>' Width="525px"></asp:TextBox> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </ItemTemplate> </asp:TemplateField> --%> </Columns> </asp:GridView> </asp:Panel> </asp:Panel> <asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57" Height="28px" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="z-index: 103; left: 55px; position: absolute; top: 18px; text-align: center" Width="61px"> <StaticSelectedStyle BackColor="#5D7B9D" /> <StaticMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" /> <DynamicMenuStyle BackColor="#F7F6F3" /> <DynamicSelectedStyle BackColor="#5D7B9D" /> <DynamicMenuItemStyle BackColor="Transparent" HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" /> <Items> <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home"></asp:MenuItem> </Items> </asp:Menu> </div> </div> </form> </body> </html>

frndScrapbook.aspx.cs:using System; using System.Data; using System.Configuration;

- 126 -

using using using using using using using using

System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class frndScrapbook : System.Web.UI.Page { SqlConnection con = null; SqlCommand cmd = null; SqlDataReader dr; protected void Page_Load(object sender, EventArgs e) { if ((Session["bg"] != null) || (! String.Empty.Equals(Session["bg"].ToString()))) { body1.Attributes["background"] = "Photos/" + Session["bg"].ToString(); } else { } try { lblNameLogin.Text = Session["logname"].ToString(); } catch (Exception ee) { } if (!IsPostBack) { Data(); } } protected void btnPost_Click(object sender, EventArgs e) { if (txtScrapBook.Text != "") { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); cmd = new SqlCommand("insert into tbl_SN_Scrap(ToMe,WrittenBy,scrap,ScrapTime)values('" + lblNameLogin.Text + "','" + Session["Login_Name"].ToString() + "','" + txtScrapBook.Text + "','" + DateTime.Now.ToString() + "')", con); cmd.ExecuteReader(); con.Close(); txtScrapBook.Text = ""; Data();

body1.Attributes["background"] = "Photos/bg.jpg";

- 127 -

} } //protected void btnPostReply_Click(object sender, EventArgs e) //{ // Button btn = sender as Button; // if (btn != null) // { // RepeaterItem gvr = btn.NamingContainer as RepeaterItem; // if (gvr != null) // { // TextBox txt = (TextBox)gvr.FindControl("txtReply"); // if (txt.Text != "") // { // con = new SqlConnection(); // con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; // con.Open(); // cmd = new SqlCommand("insert into tbl_Scrap(Login_Name,scrap)values('" + lblNameLogin.Text + "','" + txt.Text + "')", con); // cmd.ExecuteReader(); // con.Close(); // txtScrapBook.Text = ""; // Data(); // } // } // } //} protected void lnkReply_Click(object sender, EventArgs e) { LinkButton btn = sender as LinkButton; if (btn != null) { RepeaterItem gvr = btn.NamingContainer as RepeaterItem; if (gvr != null) { TextBox txt = (TextBox)gvr.FindControl("txtReply"); txt.Visible = true; Button btnPost = (Button)gvr.FindControl("btnPostReply"); btnPost.Visible = true; LinkButton lnkReply = (LinkButton)gvr.FindControl("lnkReply"); lnkReply.Visible = false; } } } public void Data() { con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); //cmd=new SqlCommand("select Login_Name,First_Name from tbl_Profile where Login

- 128 -

cmd = new SqlCommand("select a.scrap,b.Login_Name, b.Photo,b.First_Name from tbl_SN_Scrap a join tbl_SN_Profile b on a.WrittenBy=b.Login_Name where ToMe='" + lblNameLogin.Text + "' order by a.ScrapTime desc", con); dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind(); //GridView1.HeaderRow.Visible = false; } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { //Label lb = (Label)e.Row.FindControl("lblName"); //GridView gr = (GridView)e.Row.FindControl("grdInside"); //if (gr != null) //{ // con = new SqlConnection(); // con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open(); // cmd = new SqlCommand("select a.scrap from tbl_Scrap a join tbl_Profile b on a.ToMe=b.Login_Name where b.First_Name='" + lb.Text + "'", con); // dr = cmd.ExecuteReader(); // gr.DataSource = dr; // gr.DataBind(); // gr.HeaderRow.Visible = false; //} } }

PUBLISHING THE WEBSITE

- 129 -

Uploading Techinques

Domain Name Server:The site should be registered at any of the domain name service agencies like the Internet, network solution or Angel Fire etc as per the availability of the domain name. The website creator is given choice of website name that are available as per his/her preference. It usually takes around 24 hrs.For the activation of the registered domain, because all domain servers across the worlds shall be updated with the new entries. Web Server:The site designer should be careful in the selection of the web server for hosting his/her site. This should be done on the basic of the technological requirements & the kind of support needed from the web server. Many web servers do not support certain technologies. For example: are supports the SMTP small service, whereas pws does not. Thus the designer should choose the suitable web server from the various web servers available in the IT market today: Personal Web Server (pws) IIS (Internet Information Server) I planet Apache Web Server Web Star Latest Domino

The website can be uploaded using FTP or any other software that connect the FTP site & transfer the files using the FTP Protocol there are various software that provide fast uploading of the website using FTP Cute FTP File Zilla

- 130 -

TESTING
CONSIDERATION
Testing is a process of executing a program with the interest of finding an error. A good test is one that has high probability of finding the yet undiscovered error. Testing should systematically uncover different classes of errors in a minimum amount of time with a minimum amount of efforts. Two classes of inputs are provided to test the process

- 131 -

A website configuration that includes a website requirement specification, a design specification and source code. A website configuration that includes a test plan and procedure, any testing tool and test cases and their expected results. Testing is divided into several distinct operations:

VARIOUS TYPES OF TESTING

1. Unit Testing
Unit test comprises of a set tests performed by an individual program prior to the integration of the unit into large system. A program unit is usually the smallest free functioning part of the whole system. Module unit testing should be as exhaustive as possible to ensure that each representation handled by each module has been tested. All the units that makeup the system must be tested independently to ensure that they work as required. During unit testing some errors were raised and all of them were rectified and handled well. The result was quiet satisfactory and it worked well.

2. Integration Testing
Integration testing is a system technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested modules and build a program structure that has been dictated by design. Bottom-up integration is the traditional strategy used to integrate the components of a software system into functioning whole. Bottom-up integration consists of unit test followed by testing of the entire system. A subsystem consists of several modules that communicated with other defined interface. The system was done the integration testing. All the modules were tested for their compatibility with other modules .They test was almost successful. All the modules coexisted very well, with almost no bugs. All the modules were encapsulated very well so as to not hamper the execution of other modules.

- 132 -

3. Validation Testing
After validation testing, software is completely assembled as a package, interfacing errors that have been uncovered and corrected and the final series of software test; the validation test begins. Steps taken during software design and testing can greatly improve the probability of successful integration in the larger system. System testing is actually a series of different tests whose primary purpose is to fully exercise the compute based system.

4. Recovery Testing
It is a system that forces the software to fail in a variety of ways and verifies that the recovery is properly performed.

5. Security Testing
It attempts to verify that protection mechanisms built into a system will in fact protect it from improper penetration. The systems security must of course be tested from in vulnerability form frontal attack.

6. Stress Testing
Stress tools are designed to confront programs with abnormal situations. Stress testing executes a system in a manner that demands resources in abnormal quantity and volume.

7. Black Box Testing


Black box testing is done to find out the following information as shown in below: 1. Incorrect or missing functions. 2. Interface errors. 3. Errors or database access. 4. Performance error. 5. Termination error.

- 133 -

The mentioned testing is carried out successfully for this application according to the users requirement specification.

8. Test Data Output


After preparing test data, the system under study is tested using the test data. While testing the system using test data, errors are again uncovered and corrected by using above testing and corrections are also noted for future use.

- 134 -

MAINTAINANCE OF THE WEBSITE


Maintenance and upgradation is a very important part in the development of things. Once the site is ready to be released it is THE time to watch the site in action. We need to observe things such as Were the site development goals satisfied? Are any small corrections required? Consistent Backups of the website. Preventing site from hacking,etc. New feature will be required. Upgrades to deal with technology are inevitable. The initial development signifies the start of a continual development process called as maintenance. a website. The website is made taking into consideration the current trend. This has to be updated for newer

FAQs (Online User Manual)


How do I make a new account? Click on the Click Here And Signup Link on the Main page of the website, fill the form properly and you are done registering with your new account.

- 135 -

How do I change my password? Once you log into your account, you can change you password by going to the Edit Profile Page,On the top of the Edit profile page you can see the link for the change password page.you can go to that page, Insert your old password and the new password you want to keep for your accout and submit the form.You are then done changing your password How do I retrieve my password? For security purposes we dont send you your old password back, Instead we chage your password to a newer one and send that password to you.Thus, when you get your password, you can change your password by logging into your account. While retrieving password the form will ask for, Secret Nick or Number which you gave us while registering your new account, once the server checks that the secret thing is valid you get your new password How do I add a friend? You can search for your friend from the search bar given on top right of the website.It wil give you the results (existing members with the name as of your friends).You can check the profile of your friend and on the bottom you can click on the Add as a friend icon to add him as a friend. This will send him/her a request to become a friend with you. Your friend needs to confirm that you are his friend by accepting your friend request. Once this procedure is done, he will be available as a friend in your account.

- 136 -

If you need more information about anything related to the website you can visit the contact us page and contact the site administrator.

FUTURE ENHANCEMENT
Communtiy Forums Online Chat New Themes

As per the feedbackor suggestions we receive from our members we will analis them and try to implement them if they are considered.

- 137 -

ANNEXURE
Data Dictionary

1) Table Name: tbl_Profile FIELD Num Login_name First_Name Last_Name Password Photo Age Gender Location Interest Language Religion HomeTown Country BackGround SIZE 4 50 30 30 30 25 4 20 50 50 50` 30 50 50 50 TYPE Int Varchar Varchar Varchar varchar Varchar Int Varchar Varchar Varchar Varchar Varchar Varchar Varchar Varchar DESCRIPTION Serial Number Primary Key First Name Last Name Password Photo Path Age Gender Location Interested In Category Language Known Religion HomeTown Country Background Image

- 138 -

2) Table Name: tbl_PhotoGallery FIELD Login_Name Photo Comment SIZE 50 50 900 TYPE Varchar Varchar Varchar DESCRIPTION Foreign Key Photo for gallery Comment for Photo

3) Table Name: tbl_Frnd FIELD UserLogName AddFrnd SIZE 50 50 TYPE Varchar Varchar DESCRIPTION User Login Name Request for adding friends name

4) Table Name : tbl_Request FIELD RequestFrom RequestTo 5) Table Name: tbl_Scrap FIELD ToMe WrittenBy Scrap ScrapTime SIZE 50 50 900 50 TYPE Varchar Varchar Varchar DateTime DESCRIPTION Scrap to user Scarp written by Scrap Scrap timing SIZE 50 50 TYPE Varchar Varchar DESCRIPTION Request user name Request to friend

- 139 -

References:

Web : 1. http: //www.w3schools.com/aspnet/default.asp 2. http:// aspnet.codeplex.com/ 3. http://www.w3schools.com/sql/DEfaULT.asP 4. http://Techtuts.com 5. http://stackoverflow.com/questions/31982/looking-for-agood-book-to-learn-sql

Book: 1. ASP.net 3.5 Unleashed by Stephen Walther 2. SQL Queries for Mere Mortals

- 140 -

You might also like