Upload
pravind-kumar
View
226
Download
0
Embed Size (px)
Citation preview
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 1/22
Social Network Using PHP/MYSQL
Group Members :-
1. Durgesh Kumar Singh .College:- Institute of Technology And Marine Engineering.Registration no:-13614.
2. Abdul Qadir .
College:- Institute of Technology And Marine Engineering.Registration no:-17101.
3. Kumar Shivam.College:- Institute of Technology And Marine Engineering.Registration no:-13566.
4. Vikash Kumar.College:- Institute of Technology And Marine Engineering.Registration no:-13566.
(i)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 2/22
Index Page
Item:- Page No:-
Acknowledgement (iii)Requirement Specification (iv)Database Design (v)Page Flow Diagram (vii)Screen Shots (viii)Future Scope of Improvements (ix)Code (x)
(ii)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 3/22
ACKNOWLEDGEMENT
I deem it a pleasure to express my deep sense of gratitude toMr. Abhishek Kundu who directed and gratitude me with her timely
advice which eased the task of completing this project.
Finally, I must say that no height is ever achieved without some
sacrifices made at some end it is here. I owe my special debt to my
parents for showing their generous love thought the entire period of
time.
(iii)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 4/22
Requirement Specification
Domain Description
Social Networking:
Social networking is the groupin of individualsinto specific groups, like small rural communities or a neighborhoodsubdivision, if you will. Although social networking is possible inperson, especially in the workplace, universities, and high schools,it is most popular online System.
geekSnetwork is a place to be in touch with yourloved ones. This is a small network where people can expressthemselves, give their opinion on different posts. geekSnetwork isbasically designed for any particular organization or college whereall the people in the organization or all the students in the collegecan communicate with each other. So to get started register here.
(iv)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 5/22
Database Design
ER Diagram:-
(v)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 6/22
Table Description:-
(vi)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 7/22
Page Flow diagrams
(vii)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 8/22
Screen Shots:
(viii)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 9/22
Future Scope of Improvements:
geekSnetwork still have manyfeatures to be added in future such as friend request, private chatetc. Notification feature also need some changes where user will benotified about the like of their post. Wall post will have some morefeatures that is when user updates his profile a wall post will beposted to his friends.
(ix)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 10/22
Code1. index.php
<?php
require 'dbconnection.php';if(isset($_COOKIE['email']) && isset($_COOKIE['pass']))
header('Location:login.php?auto=1');if(isset($_SESSION['user_id']))
header('Location:home.php');?><!DOCTYPE HTML><html>
<head><link rel='stylesheet' type='text/css' href='css/style.css'/><script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/indexscript.js"></script><script type="text/javascript" src="js/image.js"></script><script type="text/javascript" src="js/abc.js"></script><link rel="stylesheet" type="text/css"
href="1-simple-calendar/tcal.css" />
<script type="text/javascript"src="1-simple-calendar/tcal.js"></script>
<title>TRANING SOCIAL</title></head><body>
<div class='wrapper'><div class='header'>
<div id="logo" style='margin-left:30px;'><a style='font-size:50px' href='index.php'>geek<b
style='font-size:70px;'>S</b>network</a></div><div id='l'>
<form class="loginform" action="login.php"method='POST'>
<table cellspacing="0">
<tbody>(x)
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 11/22
<tr><td><label
for="email">Email</label></td><td><label
for="pass">Password</label></td> </tr><tr>
<td><inputclass="logininput" type="email" name="email" title="PLACEYOUR EMAIL-ID" required></td>
<td><inputclass="logininput" type="password" name="pwd" title="PLACEYOUR PASSWORD" required></td>
<td><input type="submit"id="buttonl" name="login" value="Log In"></input></td>
</tr><tr>
<td><div>
<inputtype="checkbox" name="loginchk" value="1">
<labelid="sp">Save Password</label>
</div><div>
<inputtype="hidden" name="forget" >
</div></td>
<td><a id="sp"
href="resetpass.php">Forgot password?</a></td>
</tr></tbody>
</table></form>
</div></div><!--end header-->
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 12/22
<div class='center'><div class='left'><!--start left-->
<div id="slideshowContainer"><div class="slideshow">
<img src="images/im/image1.png"width="600" height="300" /><img src="images/im/image2.png"
width="600" height="300" /><img src="images/im/image3.png"
width="600" height="300" /><img src="images/im/image4.png"
width="600" height="300" /><img src="images/im/image5.png"
width="600" height="300" /></div><ul id="nav1">
<li id="prev"><ahref="#">Previous</a></li>
<li id="next"><ahref="#">Next</a></li>
</ul></div>
</div><!--end left--><div class='div-register'>
<h3 class='Newuser'><span>New User</span><br/> </h3>
<?phpif(isset($_GET['remarks'])){$remarks=$_GET['remarks'];
if ($remarks=='unsuccess'){?><h1 id="mark"><?php echo 'Email Already
Registered ';?></h1><?php}if ($remarks=='success')
{?>
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 13/22
<h1 id="mark"><?php echo 'RegistrationSuccessful';?></h1>
<?php}
if ($remarks=='unsuccess1'){?><h5 id="mark"><?php echo 'Wrong Email or
Password';?></h5><?php}if($_GET['remarks']=='passchngd'){
?><h5 id="mark"><?php echo 'Password
changed successfully';?></h5><?php
}}
?><form id='Registration_form' name="fform"
action="question.php" onsubmit="return checkForm(fform)"method="POST">
<p><input type='text' name='fname'
placeholder='Firstname' title="PLACE YOUR FIRST NAME"id="firstName" required><br>
<p><input type='text' name='lname'
placeholder='Lastname' title="PLACE YOUR LAST NAME"id="laststName" required><br>
<p><input type='password'
name='pwd'placeholder='password' title="PLACE YOUR PASSWORD" id="password" maxlength="20" required><br>
<p><input type='password' name='repwd'
placeholder='Re-password' title="PLACE YOUR RE-PASSWORD"id="repassword" maxlength="20" required><br>
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 14/22
<p><input type='mobile' name='mo'
placeholder='Mobile No' title="PLACE YOUR MOBILENO"maxlength="14" id="mobile" required><br>
<p><input type='Email' name='email'placeholder='Email Id' title="PLACE YOUR EMAIL-ID"id="email" required>
<div><div id="dob" >Birthday</div><div id="D0B"><select class="DOB" name="day"
title="SELECT DAY" id="day" ><option selected="0"
value="0">Day</option><?phpfor($i=1;$i<=31;$i++){?><option><?php echo $i;?
></option><?php}?>
</select><select class="DOB" name="month"
title="SELECT MONTH" id="month" ><option selected="0"
value="0">Month</option>
<?php$i=1;$month=array('JAN','FEB','MAR','A
PR','MAY','JUNE','JULY','AUG','SEP','OCT','NOV','DEC');foreach($month as $val){?><option value='<?php echo $i;?
>'><?php echo $val;?></option><?php
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 15/22
$i++;}?>
</select>
<select class="DOB" name="year"title="SELECT YEAR" id='year' required ><option selected="0"
value="0">Year</option><?php
for($i=1900;$i<=2013;$i++){?><option><?php echo $i;?
></option><?php}?></select></div><div id="gender">
<tablestyle='margin-top:16px;'>
<tr ><td>Male</td><td><input
required type="radio" name='gender' title="SELECT GENDER"value="Male" ></td>
<td>Female</td><td><input required type="radio" name='gender' title="SELECT GENDER"value="Female"></td>
</tr></table>
</div></div>
<div><input type="submit"
name="submit" id="buttonr"value="Register"></input></div>
</form></div><!--end right-signup-->
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 16/22
</div><!--end center--><div id="foo" style='margin-left:50px'><!--footer-->
<nav><hr>
<ul> <li><a href="index.php">Home</a></li><li><a
href="Aboutus.php">About</a></li><li><a href="contactus.php">Contact
Us</a></li>
</ul></nav></div>
</div><!--end wrapper--></body>
</html>
2.home.php
<?phpinclude_once("dbconnection.php");if(!isset($_SESSION['user_id'])){header('Location:index.php');}
?><html>
<head><title>Welcome</title><link rel="stylesheet" type="text/css"
href="css/home.css"><script type="text/javascript"
src="scripts/jquery.min.js"></script><script type="text/javascript"
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 17/22
src="scripts/jquery.form.js"></script><script type="text/javascript" >$
(document).ready(function(){$('#photoimg').live('change', function(){$("#preview").html('');$("#preview").html('<img
src="loader.gif" alt="Uploading...."/>');$("#imageform").ajaxForm({target:'#preview'}).submit();});});
</script>
</head><body>
<div id="wrapper"><?php include ("include/header.php");?><div id="maincontent">
<div id="left1"></div><div id="left2">
<div id="propic"><div id="picdis">
<spanstyle="margin-top:1%; "><?php include_once 'picsave.php';?></span>
</div>
</div><div id="information"
style="margin-top:-10%;"><h3 id="info">Information<a
href='editusinfo.php?
w=150'style='margin-left:25%;'>Edit</a></h3><?phprequire'showuserinfo.php';?>
</div></div><div id="right2">
<div id='update'>
<span id='updatestatus'>UpdateStatus</span>
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 18/22
<form name="dispatches"action="postdispach.php" method="post">
<textarea rows="3" cols="20"placeholder="What's on your mind......"name="dispatch"
required></textarea>
<br></br><input id="postbtn"type="submit" value="Post"></input></form>
<hr></div>
<div id="rest">
<? include 'postview.php'; ?></div>
</div><div id="right1"></div>
</div><!--End main content--></div><!--End wrapper-->
</body></html>
<?if(isset($_GET['y']))
{if($_GET['y']==1){
echo "<script>alert('You have already liked this
post..')</script>";}if($_GET['y']==2){
echo "<script>alert('Only liked posts can beunliked..')</script>";
}}
if(isset($_GET['cnd'])){
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 19/22
if($_GET['cnd']==1){
echo "<script>alert('You can not delete thispost..')</script>";
}if($_GET['cnd']==2){
echo "<script>alert('You can not delete thiscomment..')</script>";
}}?>
3.dbconnection.php
<?phpsession_start();
$serverName="localhost";$dbUsername="root";$dbPassword="";$dbName="NETWORK";
mysql_connect($serverName,$dbUsername,$dbPassword) ordie('database Connection Issue');
mysql_select_db($dbName);
?>
<?phpfunction generateHash($pass){
return md5($pass);}
?>
4. postview.php
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 20/22
<style>td{
padding-top:.3em;padding-bottom:.3em;}</style><?phpinclude_once("dbconnection.php");
$sql=("SELECT * FROM messages order by id desc");
$result=mysql_query($sql);if(mysql_num_rows($result)>0) //start{
while($fetch=mysql_fetch_array($result)){
$dt=$fetch['timestamp'];$fd = date('d-M-Y, h:i A', strtotime($dt)); //$nd=new DateTime($dt); //$fd=date_format($nd,'d-M-Y,H:i A');
echo "<div style='margin-right:5px;'><a href='otherprofile.php?m=".$fetch['User_Id']."'><img src='upload/".$fetch['Image']."' height='50'width='50'></a></div>";echo "<div style='float:left; margin-left:55px;margin-top:-45px;'><ahref='otherprofile.php?m=".$fetch['User_Id']."'><b>".
$fetch['Name']." </b></a> <span style='color:black;font-size:11px;'>".$fd."</span> <a href='deletepost.php?d=".$fetch['id']." && uid=".$_SESSION['user_id']."'><img title='Delete'src='images/di.png' width=10 height=10></a>";echo "<div style='margin-left:500px; margin-top:-20px;'><ahref='vote.php?a=1 && b=".$fetch['id']."'><imgsrc='images/buttonsfeat1.jpg' ></a>";
$sql6="Select * from votes where msgid='".$fetch['id']."'";$res6=mysql_query($sql6) or die(mysql_error());
Document sign date :Aug 1, 2013
7/27/2019 Do Com u Ntation
http://slidepdf.com/reader/full/do-com-u-ntation 21/22
$numv=mysql_num_rows($res6);echo "<span style='background:black;'> ".$numv." </span>";echo "<a href='vote.php?a=2 && b=".$fetch['id']."'><imgsrc='images/buttonsfeat2.jpg' ></a></div>";
echo "";echo nl2br($fetch['content'])."</div>";echo "<div style='margin-left:55px;'><form action='commentin.php?n=".$fetch['id']." && m=".$fetch['User_Id']."' method='post'>";echo "<textarea style='resize: none; width: 50%; height: 4%; border:1px solid #8b9dc3;' name='cmnt' placeholder='Write a comment..'></textarea><br/><input type='submit'
style='cursor:pointer;font-weight:bold;
margin-top:2px;border: 1px solid #426A57;background-color:#426A57;color:#FFFFFF;'name='cmntbtn' value='comment'></form></div>";
$sql1="SELECT * FROM comment order by c_id desc";$result1=mysql_query($sql1) or die(mysql_error());while($fetch1=mysql_fetch_array($result1)){if($fetch['id']==$fetch1['msgid']){
$sql2="SELECT User_Id,Fname,Lname,Image from SOCIALwhere User_Id='".$fetch1['userid']."'";
$result2=mysql_query($sql2) or die(mysql_error());$fetch2=mysql_fetch_array($result2);
echo "<div ><div style='margin-left:60px;'><ahref='otherprofile.php?m=".$fetch2['User_Id']."'><imgsrc='upload/".$fetch2['Image']."' width=30 height=30></div><divstyle='margin-left:94px; margin-top:-33px;'>".$fetch2['Fname']." ".$fetch2['Lname']."</a> <a href='cmntdelete.php?cid=".$fetch1['c_id']." && cmntr=".$fetch1['userid']." && msgr=".$fetch1['msgposterid']."'><img title='Delete' src='images/di.png'
width=10 height=10></a><br/>".$fetch1['comment']."<hr></div></div>";
Document sign date :Aug 1, 2013