Created
May 9, 2011 16:34
-
-
Save meancode/962841 to your computer and use it in GitHub Desktop.
Authenticate Template Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "<$mt:AdminCGIPath$><$mt:CommentScript$>?__mode=session_js&blog_id=<mt:BlogID>&jsonp=mtSetUserOrLogin"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_COOKIE, $_SERVER["HTTP_COOKIE"]); | |
$json = curl_exec($ch) or die("Cannot connect to MT!"); | |
curl_close($ch); | |
$json = substr($json, 17, strlen($json)-20); | |
$session = json_decode($json, true); | |
if ($session['can_post'] == 0) { | |
header("Location: <$mt:AdminCGIPath$><$mt:CommentScript$>?__mode=login&blog_id=<mt:BlogID>&return_url=".rawurlencode($_SERVER["REQUEST_URI"])); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="Javascript"><!-- | |
mtSignInOnClick('signin-widget-content'); | |
--></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment