0

O que devo fazer?

criado por Wallace em 03/12/2012 8:37am
Boa Tarde.

Pessoal estou tendo um grande problema aqui.

É o seguinte, meu site tem dois modos de conexão. Pelo facebook connect, e pelo login do proprio site,
acontece que as pagina do meu site, só podem ser visualizadas se estiverem conectados, ai vem o problema.

Se eu fizer login pelo site, consigo visualizar normalmente as paginas. Mas se eu conecto pelo Facebook eu não consigo,
ja alterei varias vezes o codigo mas nao consigo fazer os 2 "connects" funcionarem simultaneamente.

Ai vão os arquivos:

ME.PHP ( pagina pra usuarios conectados )
[spoiler]<?php
include('global.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title><?php echo $sitename." - Me"; ?></title>
<link rel="icon" href="http://i37.servimg.com/u/f37/13/27/41/49/favico10.png" type="image/gif" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="Public/JS/jquery.history.js"></script>
<script language="javascript">
(function($){
$(document).ready(function() {
$('.Usersmotto').click(function() {
$('.Usersmotto').css("display", "none")
$('.UserMotto').css("display", "block")
$('.UserMotto').focus()
return;
});

$('.UserMotto').blur(function() {
$('.UserMotto').css("display", "none")
$.ajax({
url: "functions/updatemotto.php?motto=" + $('.UserMotto').val(),
async: false
})
$('.Usersmotto').html($('.UserMotto').val())
$('.Usersmotto').css("display", "block")
$('.Usersmotto').css("min-width", "200px")
$('.Usersmotto').css("min-height", "30px")
return;
});
});
})(jQuery);
</script>
<link type="text/css" rel="stylesheet" href="Public/Styles/<?php echo $currentstyle ?>/CSS/main.css" />
</head>

<body>

<div class="mainBox">
<?php include("header.php"); ?>
<?php include("system/homenav.php"); ?>

<div class="mid" id="midcontent">

<div class="column" id="column1">

<div class="myOverview">
<div id="enter-hotel">
<div class="open">
<a href="client/?forwardid=2&roomid=1" target="ClientWndw" onclick="window.open('client/','ClientWndw','width=980,height=597');return false;"><?php echo $lang['enter_hotel']; ?></a>
</div>
</div>
<div id="avatar-plate" onclick="location.href='characters.php'"><img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=<?php echo $users->UserInfo($username, 'look'); ?>" alt="<?php echo $users->UserInfo($username, 'username'); ?>" style="margin:0 0 0 15px;" /></div>
</div>
<div class="avatarinfo">
<div class="MottoContainer">
<div class="Usersname"><?php echo $users->UserInfo($username, 'username'); ?>:</div>
<div class="Usersmotto" style="min-width:200px; min-height:30px;"><?php echo $users->UserInfo($username, 'motto'); ?></div>
<input class="UserMotto" type="text" value="<?php echo $users->UserInfo($username, 'motto'); ?>" style="display:none"/>
</div>
<div class="link-bar">
<div class="credits"><?php echo $users->UserInfo($username, 'credits'); ?> <?php echo $lang['credits']; ?></div>
<div class="activitypoints"><?php echo $users->UserInfo($username, 'activity_points'); ?> <?php echo $lang['pixels']; ?></div>
<?php
$query = mysql_query("SELECT * FROM user_subscriptions WHERE user_id = '".$users->UserInfo($username, 'id')."' LIMIT 1");
$num = mysql_num_rows($query);
$subscription = mysql_fetch_array($query);
if($num > 0 && $subscription['timestamp_expire']>= time())
{
$expire = $subscription['timestamp_expire']-time();
$expire = intval($expire/60/60/24);
if($subscription['subscription_id'] == 'habbo_club')
echo '<div class="club">'.$expire.' '.$lang['hc_left'].'</div>';
elseif($subscription['subscription_id'] == 'habbo_vip')
echo '<div class="club">'.$expire.' '.$lang['vip_left'].'</div>';
}
?>
</div>
</div>
<div class="avatarextrainfo">
<?php
$query = mysql_query("SELECT * FROM messenger_friendships WHERE user_one_id ='".$users->UserInfo($username, 'id')."'");
$i = 0;
while($friends = mysql_fetch_array($query))
{
$getfriend = mysql_query("SELECT * FROM users WHERE id ='".$friends['user_two_id']."' AND online = '1' LIMIT 1");
if(mysql_num_rows($getfriend) > 0)
{
$i++;
if($i == 1)
{
echo '<div class="content" id="feed-friends">'.$lang['friends_online'].': ';
}
$friend = mysql_fetch_array($getfriend);
echo $friend['username'].', ';
}
}
if($i > 0)
echo '</div>';
?>
<div class="smallcontent" id="feed-lastlogin">
<?php echo $lang['last_signed_in']; ?>: <?php echo @date("d-m-Y", $users->UserInfo($username, 'last_online')); ?>
</div>
</div>

<div class="contentBox">
<div class="boxHeader"><?php echo $lang['campaigns']; ?></div>
<?php
$query = mysql_query("SELECT * FROM cms_news WHERE campaign ='1' ORDER BY published DESC");
$num = mysql_num_rows($query);
if($num > 0)
{
$color = 'odd';
while($campaign = mysql_fetch_array($query))
{
echo'
<div class="campaigncontainer" id="'.$color.'">
<div class="image" style="background: url('.$campaign['campaignimg'].') no-repeat;"></div>
<div class="campaign">
<div class="title"><a href="articles.php?story='.$campaign['id'].'">'.strip_tags($campaign['title']).'</a></div>
<div class="story">'.strip_tags($campaign['shortstory'], '<br><br/><br />').'</div>
<div class="published">'.$lang['posted_date'].': '.@date("d-m-Y", $campaign['published']).'</div>
<div class="readmore"><a href="articles.php?story='.$campaign['id'].'">'.$lang['read_more'].'</a></div>
</div>
</div>';
if($color == 'odd')
$color='even';
else
$color='odd';
}
}
?>
</div>
<div class="contentBox">
<div class="boxHeader">Radio</div>
<?php include("system/radio.php"); ?>
</div>
<div class="contentBox">
<div class="boxHeader">Chat</div>
<?php include("system/xat.php"); ?>
</div>
</div>

<div class="column" id="column2">
<?php
$query = mysql_query("SELECT * FROM cms_news ORDER BY published DESC LIMIT 1");
$num = mysql_num_rows($query);
if($num > 0)
{
$news = mysql_fetch_array($query);
echo'<div class="newsHeader">
<div class="HeadlineStory" id="'.$news["id"].'" style="background: url('.$news["image"].') no-repeat; display:block;">
<p class="Mainheadline"><a href="articles.php?story='.$news["id"].'">'.stripslashes($news["title"]).'</a></p>
<p class="Mainstory">'.strip_tags($news["shortstory"], '<br><br/><br />').'</p>
</div>
</div>';
$color = 'odd';
$query = mysql_query("SELECT * FROM cms_news ORDER BY published DESC LIMIT 3");
while($news = mysql_fetch_array($query))
{
echo'<div class="storybox" id="'.$color.'" ref="'.$news["id"].'">
<p class="headline"><a href="articles.php?story='.$news["id"].'">'.$news["title"].'</a></p>
<p class="date">'.@date("d-m-Y", $news['published']).'</p>
</div>';
if($color == 'odd')
$color='even';
else
$color='odd';
}
}
?>
<div class="storyboxEnd">
<div class="readmore"><a href="articles.php"><?php echo $lang['read_more']; ?></a></div>
</div>

<div class="contentBox">
<div class="boxHeader">Loja de Emblemas <?php
echo 'ola' .$_SESSION["username"];
?></div>
<center>
<form method="post">
<?php echo $error; ?>

<h4><font color="#000000">Voce pode comprar o emblema seguintes:</font></h4>
<img src="http://images.habbo.com/c_images/album1584/<?php echo $badge; ?>.gif" />
<br />
<br />
<br />
<font color="#000000">custa</font>
<font color="#0099CC"><?php echo number_format($price); ?>
<font color="#0099CC">pixels</font>
<br />
<br />
<input type="submit" value="Comprar" name="buy-bad"/>
<input name="habbo" type="hidden" id="habbo" value="<?php echo $username; ?>"/>

</div>
<div class="contentBox">
<div class="boxHeader">Hall da Fama</div>
<center>
<table>
<?php
$datosTop = mysql_query("SELECT * FROM users ORDER BY respect DESC LIMIT 5");

while($datosTop10 = mysql_fetch_array($datosTop)){
echo '
<tr><td width="5px"></td>
<td width="20px">';

echo '<img src="http://www.habbo.com.es/habbo-imaging/avatarimage?figure=&#039; . $datosTop10['look'] . '&direction=3&head_direction=3&gesture=sml&action=crr=2&size=s" align="left"title="User mais respeitado"/></td> <td width="195px"><a href="/home.php?u='.$datosTop10['username'].'">'.$datosTop10['username'].'</a><br />'.$datosTop10['respect'].' respeitos';

echo '</td>

';
}
?>
</table>
</div>
<div class="contentBox">
<div class="boxHeader">Twiiter</div>
<?php include("system/twiiter.php"); ?>
</div>
</div>

<div class="column" id="column3">
<div class="contentBox" align="center">
<div class="boxHeader">Parceiros</div>
<!-- Advertisement -->
<a href="http://www.power-pixel.net/forum" target="_blank"><img src="http://www.brimg.info/uploads/1/cc8b328054.png" border="0"></a>
</div>
</div>
<?php include("system/sideads.php"); ?>

</div>

<?php include("system/footer.php"); ?>

</div>
</body>
</html>[/spoiler]

Facebook Connect
[spoiler]<?php
if(!isset($_SESSION['user']))
{
//Application Configurations
$app_id = "******";
$app_secret = "********";
$site_url = "****";

try{
include_once "src/facebook.php";
include_once "common.php";
}catch(Exception $e){
error_log($e);
}
// Create our application instance
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
));

// Get User ID
$user = $facebook->getUser();
// We may or may not have this data based
// on whether the user is logged in.
// If we have a $user id here, it means we know
// the user is logged into
// Facebook, but we don’t know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
//print_r($user);
if($user){
// Get logout URL
$logoutUrl = $facebook->getLogoutUrl();
}else{
// Get login URL
$loginUrl = $facebook->getLoginUrl(array(
'scope' => 'read_stream, publish_stream, email, user_about_me',
'redirect_uri' => $site_url,
));
}

if($user){

try{
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
//Connecting to the database. You would need to make the required changes in the common.php file
//In the common.php file you would need to add your Hostname, username, password and database name!
mysqlc();

$name = GetSQLValueString($user_profile['name'], "text");
$email = GetSQLValueString($user_profile['email'], "text");
$gender = GetSQLValueString($user_profile['gender'], "text");
$bio = GetSQLValueString($user_profile['bio'], "text");
$query = sprintf("SELECT * FROM users WHERE mail = %s",$email);
$username = rand(0,9999);
$res = mysql_query($query) or die('Query failed: ' . mysql_error() . "<br />\n$sql");
if(mysql_num_rows($res) == 0)
{
$iquery = sprintf("INSERT INTO users (id, username, real_name, password, mail, auth_ticket, rank, credits, vip_points, activity_points_lastupdate, look, gender, motto, account_created, last_online, online, ip_last, ip_reg, home_room, respect, daily_respect_points, daily_pet_respect_points, newbie_status, is_muted, mutant_penalty, mutant_penalty_expire, block_newfriends, hide_online, hide_inroom, mail_verified, vip, experts, face)
values('',$username,%s,'',%s,'','','','','','','M','','','','','','','','','3','3','','0','0','','0','0','0','0','1','0','yes')",$name,$email,$gender);
$ires = mysql_query($iquery) or die('Query failed: ' . mysql_error() . "<br />\n$sql");
$_SESSION['user'] = $user_profile['email'];
$_SESSION['id'] = $user_profile['id'];
}
else
{
$row = mysql_fetch_array($res);
$_SESSION['user'] = $row['email'];
$_SESSION['id'] = $user_profile['id'];
}
}catch(FacebookApiException $e){
error_log($e);
$user = NULL;
}

}
}
?>[/spoiler]

acho que nao sao necessarios mais arquivos, me ajudem por favor

Lista de Respostas:

0
16/12/2012 8:01am
(~12 anos atrás)
Ferenz Networks respondeu:
não entendi muito a duvida, mas especifique mais sobre o problema...

Nova Resposta:

(Você pode usar tags como <b>, <i> ou <code>. URLs serão convertidas para links automaticamente.)