Introduction:
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:
http://socialnetworks.16mb.com
Requirements:
– 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
https://www.apachefriends.org/download.html
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:
- functions.php – includes functions + database login.
- header.php – this file is included by other files so each page of the project can be accessed to the same features for uniformity.
- setup.php – creates MySQL tables. This file needs to be executed first to setup initial database.
- index.php – home page. Display a simple welcome message.
- signup.php – sign up page. Enable users to join the network.
- checkuser.php – check whether creating username is duplicated with existing users in database or not.
- login.php – sign in page. Authenticate user’s login.
- profile.php – create a profile.
- members.php – list of members you can find and add as friends (or drop if already friends).
- friends.php – list of mutual friends, followers and following users.
- messages.php – messages are posted in public or private mode.
- logout.php – logout the site.
- style.css – layout the site.
- javascript.js – contains some functions for scripting and combines with HTML5 to draw the logo.
Conclusion:
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.