Skip to content

Instantly share code, notes, and snippets.

View SecureCloud-biz's full-sized avatar

Terry DeSimone SecureCloud-biz

View GitHub Profile
@SecureCloud-biz
SecureCloud-biz / PHP_Server_Generated_SESSION.php
Created July 12, 2014 23:02
PHP_Server_Generated_SESSION
<?php
// [Accept only server-generated SIDs]
// One way to improve security is not to accept session identifiers that were not generated by the
// server. However, as noted above, this does not prevent all session fixation attacks.
if (!isset($_SESSION['SERVER_GENERATED_SID'])) {
session_destroy(); // destroy all data in session
}
session_regenerate_id(); // generate a new session identifier
$_SESSION['SERVER_GENERATED_SID'] = true;
@SecureCloud-biz
SecureCloud-biz / fb_4.0.x.php
Created July 12, 2014 22:58
Facebook PHP SDK 4.0.0 Example
<?php
// include required files form Facebook SDK
// added in v4.0.5
require_once( 'Facebook/FacebookHttpable.php' );
require_once( 'Facebook/FacebookCurl.php' );
require_once( 'Facebook/FacebookCurlHttpClient.php' );
// added in v4.0.0
@SecureCloud-biz
SecureCloud-biz / tag_store.php
Created July 12, 2014 22:54
Using a ID from taggable_friends to post Status Update using Graph API 2.0 and Facebook PHP SDK 4.0.x
<?php
// requires Facebook PHP SDK 4.0.x or later
// user must be logged-in prior to API call
// publish story, requires 'places' attribute
// use a page_id with no address to tag hidden location
// $tags is a comma-separated string of IDs
$story = (new FacebookRequest( $session, 'POST', '/me/feed', array(