Can I use php SESSIONS in spotify apps?

Posted by user1593846 on Stack Overflow See other posts from Stack Overflow or by user1593846
Published on 2012-10-08T09:24:09Z Indexed on 2012/10/08 9:37 UTC
Read the original article Hit count: 150

Filed under:
|
|
|

since PHP can't be used in Spotify apps directly I am using it on my server only, but I am having problems getting the sessions to work, is it possible to use sessions even?

I want to use it to see if a user is registered in my database or not so I am doing it like this:

session_start();

$query="SELECT * FROM user WHERE facebookID = {$fbid}";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$num_results = mysql_num_rows($result);
if ($num_results > 0)
{
echo"THERE IS A USER!";
$row['facebookID'] = $_SESSION[fid];
}
else
{
 echo"THERE IS NO USER!";
}

the authentication to the server works fine but the session does not seem to be working, on another PHP page witch is being called after the above code has been called with some ajax code I simply wanted to try this:

session_start();

if(isset($_SESSION['fid']))
{
echo"SESSION EXIST";
}
else
{
echo"NO SESSION";
}

anyways is there a special way to do this in Spotify apps or do I have to do this in some other way?

© Stack Overflow or respective owner

Related posts about php

Related posts about session