views:

41

answers:

2

being new to php and coming from asp.net, i would like to know if there is an equivalent of IsPostBack, which calls a function or a method only once, once the user is logged in.

i have a facebook application, in which once the user authorizes the application it should enter his details in the database. this basic stuff should have been done using the post-authorize callback url which facebook pings when the user first authorizes the app, but somehow that is not working; hence i have to do it manually.

the issue is that, since i'm checking whether the user exists or not in index.php, i would not like index.php to run this code repeatedly for the same user when the user goes to the homepage every time.

any ideas?

A: 
<input type="submit" value="submit" name="submit_button" />
<?php
if(isset($_POST['submit_button']))
{
    // only execute if postback
}
?>
sshow
thanks for this, but the problem is since it is a facebook app, the authorization dialog is embed from facebook. how would i know the name of the button?
fuz3d
A: 

edit 2: I didn't misunderstood after all...

If it only has to run once per login, you could save the state to the session, so you can see if it has to executed or not.

GuidoH
an example please?
fuz3d