if($_REQUEST['crear']==""){
//Numero aleatorio y mostramos el resultado
$CUAL = mt_rand(10,95);
echo '<a href="'.$_MSERVER.'tab.php?crear=1&cual='.$CUAL.'&signed_request='.$_REQUEST['signed_request'].'"><img src="pic/button.png" border="0"></a><br/><br/>';
echo '<img src="fondos/tmp_'.$CUAL.'.jpg">';
}else{
//Subimos la imagen
$_P['message'] = trim('Descubre tu suerte diaria. '.$_LNK);
$_P['source'] = "@" . realpath('fondos/tmp_'.$_REQUEST['cual'].'.jpg');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$_R['user_id'].'/photos?access_token='.$_R['oauth_token']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_P);
$resultado = curl_exec($ch);
$resultado = json_decode($resultado, true);
curl_close($ch);
//echo "<script>window.top.location = '".$_LNK."';</script>";
//Si no queremos mostrar mas nada solo sacamos las barras de comentario (//) en la linea anterior
//Sino mostramos algo.
echo '<h1>Tu imagen fue subida con exito, podras verla en tu perfil</h1>';
}