Wednesday, 11 December 2013

How Does Facebook Status Update works - learnmore with @s.shivasurya

Facebook has a cool feature that can update status each and every time by the users using various devices i.e. android ,web, i-os , blackberry etc.,so whenever you update status it may consist of text and images which is shown on wall where other friends view your updates.have you ever wondered about how does the status update works?





what is status update?

Status update is a option in a Facebook that enables the user to share their real life experience and they could tag their friends in the status, explain thier mood in status,current location and timings too.they are being shared on the user's timeline and where other users can review it.

why status update?


"If Facebook wall & News feeds is the heart of the Facebook,then status updates and photo updates act as Blood of Facebook "

in the real life world peoples are tempt to share their own experience on the social networking sites in the form of text or images.they just share and post "what's on your mind?"
addition to which user have Like buttons,comment & sharing options to make the status update still more valuable and interesting.



You would have come across a funny status from users,
"
Behind every successful status update, there is a Ctrl+C & Ctrl+V " :p




have a quick demo here. download the files from here.

here is script for updating status in Php language with mysql+ajax.

javascript for update.php

<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript" >
$(function() 
{
$(".submit").click(function(){
var test = $("#shivasurya").val();
var info = 'id=' + test ;
$("#loading").show();
$("#loading").fadeIn(200).html('<img src="../loader.gif" />Loading Comment...');
$.ajax({
type: "POST",
url: "statusexec.php",
data: info,
cache: false,
success: function(html){
$("ol#update").append(html);
$("ol#update li:last").fadeIn("slow");
$("#loading").hide();
}
});
return false;
});
});

</script>
html code for update.php

<body>
<div id="loading"></div>
<ol id="update" class="timeline" style="height:70px; width: 700px;">
</ol>
<form id="form" method="post" >

<h4 style="font-family:Verdana, Geneva, sans-serif;" > UPDATE STATUS </h4>
<textarea id="shivasurya" style="height:70px; width: 500px; border:dotted;" placeholder="your status here!"></textarea>
<input type="submit" value="post" class="submit" /> </form>
</body>
statusexec.php

this file is essential to process the statement and save in database!


<?php
include('./config.php');
if($_POST['id'])
{
if($_POST['id']!='')
{
$comment=$_POST['id'];

if(get_magic_quotes_gpc())
{
$message = stripslashes($comment);
}
$comment = mysql_real_escape_string(nl2br(htmlentities($comment, ENT_QUOTES, 'UTF-8')));

if($s=mysql_query('insert into statusupdates1 (status,timestamp) values ("'.$comment.'","'.time().'") '))

{ echo "success";
?>
<?php
}
else
{ echo "something went wrong we are trying to fix it soon as possible";
}
}

}
?>
<li claas="box">
your status update was successfully executed!
</li>


thus here i have explained here a simple status update with showing the message success/error! but there is a lot behind this,if you are really interested i will mail you advanced status updates! feel free to comment below!

0 comments:

Post a Comment