facebook application

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

facebook application

Post by amirbwb »

Hello, I want to create a facebook application about music library, here are more details:
Pages on facebook can add this application and set a new artist with his bio and some musics,
I though about how to create this thing and I read about how to create a facebook application at facebook developers documentation, but I'm still confused!!

I want a code that gives me
the user :
id
first name
last name
if he liked the page
if he is an admin
etc ...

the page:
id
name
likes
etc ...

and many other things like conditions if he is not logged in, pop up login window etc ...

can someone teach me how to do this ??
Thank you a lot, you can contact me at amirbawab[at]hotmail[dot]com
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: facebook application

Post by social_experiment »

Google is a good starting point; a quick search for 'creating my first facebook app' will yield sufficient (and helpful) results
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

Re: facebook application

Post by amirbwb »

I have search lot on google, may you please suggest me a website, and if you have any idea please tell me ... thank you
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: facebook application

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

Re: facebook application

Post by amirbwb »

i opened more than 10 sites from here .. it's not clear, and recently the facebook changed the docs and not clear too ...
:/
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: facebook application

Post by social_experiment »

The general idea (from what i've experienced) is that the forum will help you if you help yourself. Create some sample code, paste it back here and you'll get more help. Or post in the looking for a developer section so you can pay someone to help with the project (or find a willing soul to help you with it).
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: facebook application

Post by egg82 »

here's a small guide:

1. Create a table `accounts` with `id`(auto-increment), `username`, `password`, `first`, `last`, `permissions`, etc... - This will be your user information
3. Create another table `$username` with `id`(auto-increment), `page`, `like` - This will be your "likes" database for each user
4. Create another table `pages` with `id`(auto-increment), `name`, `content`, `likes`, etc... - This will be your page database
5. Create a register script and encrypt at least the password
6. Create yourself an account with that scipt (tests the functionality and gives your script a chance to be used before release)
7. Manually edit your permission level to admin
8. Create a login script ($_SESSION and $_COOKIE come in helpful here)
9. Login with the script
10. Create a "create a page" script
11. Create a "like" button

The last bit should be easy providing you did steps one and two correctly
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: facebook application

Post by social_experiment »

I haven't had a lot of experience with this but the more complicated part of the scripts are related to the login and passing along of the session token once the user is logged in
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: facebook application

Post by egg82 »

not if your session_start() is in a shared header :D
oh, and the login is a lot easier than the registration. With login, all you have to sanitize and compare is a username and password. With registration... Well, there's quite a bit that can go wrong.

If you need an example, I have xampp installed on my computer and a DNS registered, so go here: http://www.gametack.org
I'm still working on the site, so that's just a start
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

Re: facebook application

Post by amirbwb »

social_experiment thank you but i prefer to learn it my self .. the question is how ? I read a lot !!
egg82 thank you, I know how to create this in php, it is very easy but the problem is how to connect with facebook,
I want to create an application that admins can add it to there pages, so I want to store in my database :
Who is the admin of the page?, so the admin page is displayed when he visit the application
Who is not the admin of the page? so the content (bio, playlist, photo album etc ..) are displayed
The page unique id to make the application work on many pages without confusing artists pages
[pageid] => [artist name]
example:
[5] => [bob marley] (url=www.facebook.com/pages/5)
[45123] => [shakira] (url=www.facebook.com/pages/45123)

hope you understand what i want =)
PS: i read a lot on facebook docs and other sites(google) but no results...

thank you
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: facebook application

Post by egg82 »

ahhhhh I get it now...
To be honest, i've never written anything for or including Facebook, so I can't be much help. Sorry!
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

Re: facebook application

Post by amirbwb »

it's ok, if u ever knew anything about it plz let me know, thank you
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: facebook application

Post by social_experiment »

amirbwb wrote:social_experiment thank you but i prefer to learn it my self .. the question is how ? I read a lot !!
Yeah that's what i am trying to assist you with :) Reading helps but coding something helps.
egg82 wrote:not if your session_start() is in a shared header
;) I've tried almost all the examples and they work, but i can't get the session carried over to the next page, i'd be happy if you could pm me how you succeeded with it, not a whole script just the crucial part.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: facebook application

Post by egg82 »

actually, happy to publicly announce it, in case someone else stumbles upon this post:

header.php

Code: Select all

<?php
//get session
session_start();
if(!isset($_SESSION["init"])){
	session_regenerate_id(true);
	$_SESSION["init"] = true;
	echo('<form action="getyourcookies.php" method="post" id="redir">');
	?>
	</form>
	<script language="JavaScript" type="text/javascript">
	<!--
	document.getElementById('redir').submit();
	//-->
	</script>
	<?
}
login:

Code: Select all

require("header.php");
$_SESSION["username"] = $row["username"];
echo('<form action="./" method="post" id="redir">');
?>
</form>
<script language="JavaScript" type="text/javascript">
<!--
document.getElementById('redir').submit();
//-->
</script>
any other page:

Code: Select all

require("header.php");
echo($_SESSION["username"]);
(Code from my site - All names have been changed for obvious reasons)
Post Reply