WELCOME TO SINLEB.COM

Contact - Email:


IN TE DOMINE ,SPERAVI ; NON CONFUNDAR IN AETERNUM


384,162 Visits  |  17,010 Followers



VOYNICH CIPHERS ALGORITHMS GAMES AREA TOKI PONA ESOTERISM PAGES


BACK TO SCRIPTS



SHARE MUSIC ON FACEBOOK
VIEW DEMO




POST TO YOUR WALL ON FACEBOOK FROM A MOBILE DEVICE
VIEW DEMO


Download lib   (Facebook-php-sdk v 3.1.1-8)

Example of mobipost.php   (Accessible via this url:   http://www.sinleb.com/logicgames/mobipost.php )

Enter your app_id and your app_secret ......line 3
Edit or uncomment Mobile device detected...... line 70
Edit link,name,picture,caption,description ...... line 105 aprox.
<?
require 'lib/facebook.php';
require "lib/connect.php";

$app_id= '';        //Enter yor app_id
$app_secret= '';    //Enter your app_secret

$facebook = new Facebook(array(
'appId'=> $app_id,
'secret' => $app_secret,
));

//Getting User ID
$user_id= $facebook->getUser();

if ($user_id) {  
try {    
//User who's authenticated.    
$user_profile = $facebook->api('/me');  
} 
catch (FacebookApiException $e) {    error_log($e);    $user_id = null;  }
}

//Login or logout url will be needed depending on current user state.
if ($user_id) {  
$logoutUrl = $facebook->getLogoutUrl();
} else {  
$loginUrl = $facebook->getLoginUrl(array("scope" => "user_status"));
//$loginUrl = $facebook->getLoginUrl(array("scope" => "user_status,publish_stream"));
}


//Detecting Mobile Device

$mobile_browser = '0';
 
IF(PREG_MATCH('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',
    STRTOLOWER($_SERVER['HTTP_USER_AGENT']))){
    $mobile_browser++;
    }
 
IF((STRPOS(STRTOLOWER($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or
    ((ISSET($_SERVER['HTTP_X_WAP_PROFILE']) or ISSET($_SERVER['HTTP_PROFILE'])))){
    $mobile_browser++;
    }
 
$mobile_ua = STRTOLOWER(SUBSTR($_SERVER['HTTP_USER_AGENT'],0,4));
$mobile_agents = ARRAY(
    'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
    'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
    'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
    'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
    'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
    'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
    'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
    'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
    'wapr','webc','winw','winw','xda','xda-');
 
IF(IN_ARRAY($mobile_ua,$mobile_agents)){
    $mobile_browser++;
    }
IF (STRPOS(STRTOLOWER($_SERVER['ALL_HTTP']),'OperaMini')>0) {
    $mobile_browser++;
    }
IF (STRPOS(STRTOLOWER($_SERVER['HTTP_USER_AGENT']),'windows')>0) {
    $mobile_browser=0;
    }
 
//Edit-Uncomment your option
IF($mobile_browser>0){
//   echo "MOBILE  ($mobile_ua)";
   } ELSE {
// echo "MOBILE DEVICE NOT DETECTED !";
//Exit;
} 


//Posting on the wall

if(isset($_POST['Submit'])){

//Getting permissions
$permissions = $facebook->api($user_profile[id]."/permissions");

// Permission is granted
if( array_key_exists('publish_stream', $permissions['data'][0]) ) {
	
//Getting  message
$message=$_POST['message'];

if(empty($message)){
echo "<center>";
echo "Robot - Logic Games";
echo "<br>";
echo "<font color=#ff0000><b>MESSAGE FIELD WAS EMPTY!!</b></font>";
echo "<br><br>";
echo "<img src='http://www.sinleb.com/images/tysm.jpg' width='120px'>";
echo "<br>";
echo "<a href='mobipost.php'><font color=#0000ff><u>TRY AGAIN , PLEASE</u></font></a>";
echo "</center>";
echo "<br><br>";
Exit;
}

//Do the related task
$newPostId = $facebook->api($user_profile[id].'/feed', 
'POST', 
array (
'message' => $message,
'link' => 'http://sinleb.com/logicgames/mobipost.php',          //Edit the URL to redirect to after the user clicks on the image or title 
'name' => 'Sinleb Dialogs for Mobile Devices',                  //Edit Your title
'picture' => 'http://www.sinleb.com/images/tysm.jpg',           //Edit Your image
'caption' => 'Use Sinleb Dialogs to interact with Facebook.',   //Edit Your caption
'description' => 'Powered by Sinleb.com'                        //Edit Your description
));


//Success
echo "<center>";
echo "Robot - Logic Games";
echo "<br>";
echo "<img src='http://www.sinleb.com/logicgames/images/ok.gif'>";
echo "<br>";
echo "<font size='5' color=#ff0000><b>MESSAGE POSTED SUCCESSFULLY!!</b></font>";
echo "<br><br>";
echo "<img src='http://www.sinleb.com/images/tysm.jpg' width='120px'>";
echo "<br>";
echo "<a href='http://www.facebook.com/profile.php?id=$user_profile[id]'><font size='5' color=#0000ff><u>LAUNCH MY PROFILE</u></font></a>";
echo "<br><br>";
echo "<a href='mobipost.php'><font size='5' color=#0000ff><u>BACK TO FORM</u></font></a>";
echo "</center>";
echo "<br><br>";
Exit;


// We don't have the permission - Alert the user or ask for the permission

} else {

$LoginUrl=$facebook->getLoginUrl(array("scope" => "publish_stream"));
?>
<div align="center">
<img src='http://www.sinleb.com/logicgames/images/alert.gif'>
<br>              
<a href="<?php echo $LoginUrl; ?>">
<font size='5' color=#ff0000>Click Here Set Permission with Facebook</font>
</a>      
</div> 

<br>
<img src='http://www.sinleb.com/logicgames/images/perm.png'>
<br>
<center>
<font size='4' color='#0000ff'>You will be able to change this permission from the</font> <a href='http://www.facebook.com/settings?tab=applications' target='_blank'>Application Settings page</a>
</center>

<br><br><br>
<? 
Exit;
}

}
?>
<HTML xmlns:fb="http://www.facebook.com/2008/fbml">
<HEAD>
<title>Logic Games - Mobipost</title>

<style>
body
{
font-family:Arial;
font-size:30px;
color: #0000ff;
}

td
{
font-family:Arial;
font-size:30px;
color: #0000ff;
}
</style>

</HEAD>

<BODY>

<?php if ($user_id): ?>     

<center>
Welcome , <?php 
$Link=$user_profile['link'];
echo "<a href='$Link' target='_blank'>"; ?>
<font color=#ff0000>
<? print $user_profile['name']; ?>
</font>
</a> 
  (<a href="<?php echo $logoutUrl; ?>">Logout</a>)    
<br>
<?php echo "<a href='$Link' target='_blank'>"; ?>
<img src="https://graph.facebook.com/<?php echo $user_profile[id]; ?>/picture">
</a>
<br>
<br>
</center>

<?php else: ?>    
 
<center> 
<strong><em>You are not logged in <br> in the application.</em></strong>   
<br>
<a href="<?php echo $loginUrl; ?>">
<font color=#ff0000>Click here to login with Facebook</font>
</a>      
</center>
<? Exit; ?> 

<?php endif ?>  

<?
//Getting your app details
$App=json_decode(file_get_contents("https://graph.facebook.com/$app_id"));
?>
<CENTER>
<TABLE border='0' style='border-collapse:collapse;'>
<TR>
<TD>
<center>
Leave a Message (480 chars max.)
<form name='general' action="mobipost.php" method="post">
<table width='100%' border='1'>
<tr>
<td>
<center>
<? echo "<a href='http://www.facebook.com/profile.php?id=".$user_id."' target='_blank'><img src=https://graph.facebook.com/".$user_id."/picture>"; ?>
</td>
<td>
<textarea cols="40" rows="5" name="message" onKeyDown="validate_elen()" onKeyUp="validate_elen()"></textarea>
</td>
<tr>
<td>480 chars.</td>
<td>
<input type="text" name=echarfield size=4>

<center>
<input type='hidden' name='action' value='Post'>
<input type="submit" name="Submit" value="Leave a Message" />

</td> 
</tr>
</table>
</form>
</TD>

</TR>
</TABLE>
</CENTER>

<script> 

chintextarea = "" 
challowed = 480      //Number or chars. allowed

function validate_elen(){ 

   numchars = document.general.message.value.length 

   if (numchars > challowed){ 
      document.general.message.value = chintextarea 
   }else{ 
      chintextarea = document.general.message.value 
   } 

   if (numchars >= challowed){ 
      document.general.echarfield.style.color="#ff0000"; 
   }else{ 
      document.general.echarfield.style.color="#000000"; 
   } 

   eCounter() 
} 
function eCounter(){ 
   document.general.echarfield.value=document.general.message.value.length 
} 

</script> 

</td>
</tr>
</table>

<p align="center">
Application developed by <br><a href='<? echo $App->link; ?>' target='_blank'><font color=#ff0000><u><? echo $App->name; ?></u></font></a><br><img src='http://photos-g.ak.fbcdn.net/photos-ak-snc1/v27562/70/50565512410/app_1_50565512410_4402.gif' width='100'>
</p>

</center>

<br>

</BODY>
</HTML>





AN EASY WAY TO SHARE CONTENT ON FACEBOOK

Share on Facebook



If you want to share a web page or video, etc... with your friends on Facebook, simply click on the button
Share on Facebook ( in that page)
Then, a link with a thumbnail will appear in your Facebook profile (and obviously in your links page).


If you have a Website or blog :
Copy and Paste the following block of codes into your page.


Share on Facebook



Share




Use this script under your own responsibility and read the TOS


Page generated in 0.267948 seconds
Wed, 22 Feb 2012 [14:34] Server Time
Script Created by Sinleb.com