Page 1 of 1

facebook application

Posted: Fri Oct 21, 2011 4:29 pm
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

Re: facebook application

Posted: Fri Oct 21, 2011 11:34 pm
by social_experiment
Google is a good starting point; a quick search for 'creating my first facebook app' will yield sufficient (and helpful) results

Re: facebook application

Posted: Sat Oct 22, 2011 3:31 am
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

Re: facebook application

Posted: Sat Oct 22, 2011 4:33 am
by social_experiment

Re: facebook application

Posted: Sat Oct 22, 2011 9:48 am
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 ...
:/

Re: facebook application

Posted: Sun Oct 23, 2011 12:22 pm
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).

Re: facebook application

Posted: Mon Oct 24, 2011 9:42 am
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

Re: facebook application

Posted: Mon Oct 24, 2011 9:49 am
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

Re: facebook application

Posted: Mon Oct 24, 2011 10:43 am
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

Re: facebook application

Posted: Mon Oct 24, 2011 11:58 am
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

Re: facebook application

Posted: Mon Oct 24, 2011 12:50 pm
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!

Re: facebook application

Posted: Mon Oct 24, 2011 3:20 pm
by amirbwb
it's ok, if u ever knew anything about it plz let me know, thank you

Re: facebook application

Posted: Mon Oct 24, 2011 5:07 pm
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.

Re: facebook application

Posted: Mon Oct 24, 2011 9:04 pm
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)