Jump to content

Need help with PHP Error: Fatal error: Call to a member function require_login()


feliks

Recommended Posts

Can anyone help me with this error?

 

Fatal error: Call to a member function require_login() on a non-object in /home/wallls/public_html/index.php on line 27

 

Lines 26-33 below:

 

<?php 
$smilek = $_GET['id'];
$ppalout = $_GET['payout'];
$healthy = array("%", "!", "=", "'", ",", "OR", "?", "<", "&", ";");
$yummy   = array("", "", "", "", "" ,"", "", "", "", "");
$peee = str_replace($healthy, $yummy, $smilek);
$chnpay = str_replace($healthy, $yummy, $ppalout);


require_once 'appinclude.php';
require_once 'mystyle.php';

echo '<div align="center"><img src="'.$appcallbackurl.'main.png" width="300" height="150"></div>';

require_once 'ads/topads.php';
?>
<fb:tabs>
  <fb:tab-item href='<? echo $appCanvasUrl; ?>' title='Lottery' selected='true' />
  <fb:tab-item href='<? echo $appCanvasUrl; ?>earn.php' title='Get Tickets' />
  <fb:tab-item href='<? echo $appCanvasUrl; ?>payment.php' title='Payment Info' />
  <fb:tab-item href='<? echo $appCanvasUrl; ?>history.php' title='Lottery History' />
  <fb:tab-item href='<? echo $appCanvasUrl; ?>forum.php' title='Forum' />
  <fb:tab-item href='<? echo $appCanvasUrl; ?>invite.php' title='Invite Friends' />
</fb:tabs>
<div align="center">
<?
$fbid = $facebook->require_login();
$theirip = $_SERVER['REMOTE_ADDR'];


if ($fbid == "")
{
?>

Can anyone help me with this error?

 

Fatal error: Call to a member function require_login() on a non-object in /home/wallls/public_html/index.php on line 27

 

Lines 26-33 below:

 

<?
$fbid = $facebook->require_login();
$theirip = $_SERVER['REMOTE_ADDR'];


if ($fbid == "")
{
?>

 

While I'm fairly unfamiliar with the facebook API, the most simple thing to check is, where you instantiate the class are you instantiating it as $facebook? It would be helpful to see the first 25 lines as well.

How can I fix that. What/where do i add.

 

Well not to be rude, but it's evident you copy pasted or pretty much copy pasted. That usually doesn't work out too well with php for these sorts of things, to help you, I would probably guess the facebook class if it even exists, is in your appinclude.php file.

 

Mind sharing it?

Yeah.

 

<?php

require_once 'facebook.php';

// your api key and application secret, received in part 2 of 3 of the installation process
$appapikey = '';
$appsecret = '';

$adminid = "";
// your facebook profile id, admin access will be allowed to the above facebook id

$thename = "fbrafffle";
// ONE WORD! No special characters, this is mainly used for the FB Forum
include "connect.php";
?>
<style type="text/css"> input.search { background:white url(facebook.com/images/magglass.png) no-repeat scroll 3px 4px; padding-left:17px; } input, textarea, select { border:1px solid #BDC7D8; font-family:"lucida grande",tahoma,verdana,arial,sans-serif; font-size:11px; padding:3px; } input:focus, textarea:focus, select:focus {border-color:#687FB0} .field {border:1px solid #bdc7d8; padding:2px} .field:focus {border-color:#687FB0} textarea.field {width:98.5%;height:100px} button { padding:1px 3px 1px 4px; font-size:1em; cursor:pointer; background:#3b5998; color:#fff; border:1px solid #0e1f5b; border-left-color:#D9DFEA; border-top-color:#D9DFEA; } button.next, button.cancel { background:#ddd; color:#111; border:1px solid #666; border-left-color:#ddd; border-top-color:#ddd }</style>
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();

$appcallbackurl = 'http://wwe-tlc-streaming.info/';
// where the script is installed

$appCanvasUrl = 'http://apps.facebook.com/fbrafffle/';
// your canvas page url, set up in part 2 of 3 of the installation process

    try {
        if (!$facebook->api_client->users_isAppAdded()) {
            $facebook->redirect($facebook->get_add_url());
        }
    }
    catch (Exception $excatch) {
        $facebook->set_user(null, null);
        $facebook->redirect($appcallbackurl);
    }

 

Edited by thorpe: I assume you don't want everyone getting hold of your facebook credentials?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.