if ($_GET['optin'] != "true") { die("</br>Do not fool around with the parameters."); } if (isset($_GET['optout'])) { if ($_GET['optout'] != "sec1") { die("</br>Do not fool around with the parameters."); } } echo "<h3>Dearest " . $me['name'] . "!</br>Thank you for participating in our survey.</h3>"; echo "<h3>You should soon receive an email to " . $me['email'] . " with a download link.</h3>"; echo "<h4>In case you have further questions, contact the survey author: Markus Huber mhuber@sba-research.org</h4>"; echo "<h4>Spread the surveylink: http://is.gd/snapshotsurvey</h4>"; $sendid = ""; // It's probably a safe assumption to use the & here (instead of checking if we need ?), the Graph API needs the access token in the URL anyway, so there are parameters. if (!isset($_GET['sendid'])) { $sendid = "snapshot" . $facebook->getUnique(); } else { $sendid = $_GET['sendid']; } /* echo "<h4>Facebook account: " . $me['email'] . "</h4>"; echo "</br>" . $sendid; echo "</br>" . $_GET['optin']; echo "</br>" . $_GET['optout']; echo "</br>" . $facebook->getUser() . "</br>";*/ //echo $entry; $entry = $facebook->getUser() . ";" . $_GET['optin'] . ";" . $_GET['optout'] . ";" . $sendid . "\n"; //Cookie for only one snapshot a week if ($_COOKIE["uid"] != $facebook->getUser()) { $surveylogfile = "/var/www/SocialSnapshot/survey.log"; $fh = fopen($surveylogfile, 'a') or die("can't open surveyfile: contact mhuber@sba-research.org");
} else { ?> <a href="<?php echo $loginUrl; ?> " id='connectlink'> <img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif"> </a> <?php } if ($me) { echo "<h3>Fetching your Facebook account data...</h3>"; $sendid = ""; // It's probably a safe assumption to use the & here (instead of checking if we need ?), the Graph API needs the access token in the URL anyway, so there are parameters. if (!isset($_GET['sendid'])) { $sendid = "snapshot" . $facebook->getUnique(); } else { $sendid = $_GET['sendid']; } echo "<h3>Once finished, an email will be send to: " . $me['email'] . "</h3>"; echo "Profiles of friends included in social snapshot:<br/>"; $friends = $facebook->api('/me/friends'); foreach ($friends['data'] as $friend) { echo "<a class='friend' href='http://www.facebook.com/profile.php?id=" . $friend['id'] . "'>" . $friend['name'] . "</a> "; } flushOutput(); if (!isset($_GET['continue'])) { if (!isset($_GET['sendid'])) { echo "<p><a class='continue' href='" . $_SERVER['REQUEST_URI'] . "&continue=y&sendid=snapshot" . $facebook->getUnique() . "'>Continue</a></p>"; } else { echo "<p><h2><a class='continue' href='" . $_SERVER['REQUEST_URI'] . "&continue=y'>Start Social Snapshot (Continue)</a></h2></p>";