feliks Posted January 6, 2011 Share Posted January 6, 2011 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 == "") { ?> Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/ Share on other sites More sharing options...
Zurev Posted January 6, 2011 Share Posted January 6, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155500 Share on other sites More sharing options...
feliks Posted January 6, 2011 Author Share Posted January 6, 2011 I updated post with the first 25. Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155504 Share on other sites More sharing options...
Zurev Posted January 6, 2011 Share Posted January 6, 2011 I updated post with the first 25. Well $facebook doesn't exist anywhere, unless it's somewhere in those required files you have near the top... Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155505 Share on other sites More sharing options...
feliks Posted January 6, 2011 Author Share Posted January 6, 2011 How can I fix that. What/where do i add. Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155508 Share on other sites More sharing options...
trq Posted January 6, 2011 Share Posted January 6, 2011 How should we know? What are you expecting the $facebook object to be? Do you have a facebook class? Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155512 Share on other sites More sharing options...
Zurev Posted January 6, 2011 Share Posted January 6, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155513 Share on other sites More sharing options...
feliks Posted January 6, 2011 Author Share Posted January 6, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155516 Share on other sites More sharing options...
Zurev Posted January 6, 2011 Share Posted January 6, 2011 lol, actually seems like a pretty easy fix...you never started the php tag again after your style tags. Before $facebook on the appinclude.php file add <?php and let us know how it goes. Quote Link to comment https://forums.phpfreaks.com/topic/223540-need-help-with-php-error-fatal-error-call-to-a-member-function-require_login/#findComment-1155527 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.