Have you ever asked yourself that how Facebook, Twitter or Instagram were built? How can Mark Zuckerberg build the Facebook? Can I do one for myself? What things do I need to learn in order to build them? My answer for these questions is that you can do it if you are really desired to learn about it. In this project I’ll guide you how to build a social network by using PHP and MySQL. Because this tutorial is quite long so I will divide it into many parts. The result for this project: 


– In order to understand this project it requires you to have a solid knowledge about PHP and MySQL as well as a basic understanding about HTML, CSS and AJAX


Design a social network site:

There are a couple of things that we need to plan before we build a social network:

– A sign-up process

– A login form

– A logout facility

– Session control

– User profiles with uploaded thumbnails

– A member directory

– Adding members as friends

– Public and private messaging between members

– How to style the project

This project includes several code files:

  1. functions.php includes functions + database login.
  2. header.php this file is included by other files so each page of the project can be accessed to the same features for uniformity.
  3. setup.phpcreates MySQL tables. This file needs to be executed first to setup initial database.
  4. index.phphome page. Display a simple welcome message.
  5. signup.php sign up page. Enable users to join the network.
  6. checkuser.phpcheck whether creating username is duplicated with existing users in database or not.
  7. login.phpsign in page. Authenticate user’s login.
  8. profile.php – create a profile.
  9. members.phplist of members you can find and add as friends (or drop if already friends).
  10. friends.phplist of mutual friends, followers and following users.
  11. messages.phpmessages are posted in public or private mode.
  12. logout.php logout the site.
  13. style.css layout the site.
  14. javascript.js contains some functions for scripting and combines with HTML5 to draw the logo.


 In this section I just introduced some ideas about our project. I hope that you have an image of how our project looks like. I will dive into the project next sections.

close slider

    BusinessE-commerce/ Online storeNon-profitPersonal websiteI'm not sureOther

    Create a new websiteOverhaul of my websiteMinor changes to my websiteOther

    Help customer find my business onlineSell my product or service and take payments onlineSell my product or service, taking payments offlineProvide information to the publicOther

    ASAPIn the next few weeksIn the next monthIn the next 2-3 monthsI'm not sureOther

    I'm not sureLess than 1 monthUp to 3 monthsUp to 6 monthsOther

    Pin It on Pinterest