IrfanAlam123

jsConnect index.php configured file for Boonex Dolphin

Apr 3rd, 2016
853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.56 KB | None | 0 0
  1. <?php
  2. header('Content-type: application/javascript; charset=utf-8');
  3. $servername = "localhost";
  4. $username = "username";
  5. $password = "password";
  6. $dbname = "databasename";
  7. $memID = $_COOKIE['memberID'];
  8. // Create connection
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10. // Check connection
  11. if ($conn->connect_error) {
  12.     die("Connection failed: " . $conn->connect_error);
  13. }
  14. $sql = "SELECT * FROM Profiles WHERE ID='$memID'";
  15. $result = $conn->query($sql);
  16. if ($result->num_rows > 0) {
  17.     // output data of each row
  18.     while($row = $result->fetch_assoc()) {
  19.         $dnick = $row[NickName];
  20.         $dname = $row[FullName];
  21.         $demail = $row[Email];
  22.         $dstatus = $row[Status];
  23.         }
  24.     }
  25. $sqlpic = "SELECT Hash as pic FROM `bx_photos_main` WHERE Owner = $memID and ID = ( SELECT LastObjId FROM `sys_albums` WHERE Owner = $memID and Uri like '%-s-photos' )";
  26. $ressql = $conn->query($sqlpic);
  27. if ($ressql->num_rows > 0) {
  28.     // output data of each row
  29.     while($row = $ressql->fetch_assoc()) {
  30.     $pic = $row[pic];
  31.     }
  32. }
  33. $conn->close();
  34. ob_start(); //Start output buffer for full picture
  35. echo "http://mydolphin.com/m/photos/get_image/file/{$pic}.jpg";
  36. $dfullpic = ob_get_contents(); //Grab output
  37. ob_end_clean(); //Discard output buffer for full picture
  38. ob_start(); //Start output buffer for thumbnail
  39. echo "http://mydolphin.com/m/photos/get_image/thumb/{$pic}.jpg";
  40. $dsmallpic = ob_get_contents(); //Grab output
  41. ob_end_clean(); //Discard output buffer for thumbnail
  42.         if($dstatus=="Active"){
  43. //JSConnect Code Begins
  44. require_once dirname(__FILE__).'/functions.jsconnect.php';
  45. // 1. Get your client ID and secret here. These must match those in your jsConnect settings.
  46. $clientID = "Your client ID";
  47. $secret = "Your client Secret";
  48. // 2. Grab the current user from your session management system or database here.
  49. $signedIn = true; // this is just a placeholder
  50. // YOUR CODE HERE.
  51. // 3. Fill in the user information in a way that Vanilla can understand.
  52. $user = array();
  53. if ($signedIn) {
  54.    // CHANGE THESE FOUR LINES.
  55.    $user['uniqueid'] = $dnick;
  56.    $user['name'] = $dname;
  57.    $user['email'] = $demail;
  58.    $user['photourl'] = ' ';
  59. }
  60. // 4. Generate the jsConnect string.
  61. // This should be true unless you are testing.
  62. // You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
  63. $secure = true;
  64. WriteJsConnect($user, $_GET, $clientID, $secret, $secure);      
  65.  
  66. } else {
  67.     echo 'It seems you are not Logged In at My Dolphin or You account is not active!';
  68. }
Add Comment
Please, Sign In to add comment