How to determine if user tumblr is registered?

I am writing a topic and I want to show content only to the blog administrator, but I do not know how to determine if the administrator is registered.

I noticed that at the bottom of the HTML, right before the closing body tag, is this code:

<iframe src="http://assets.tumblr.com/iframe.html?10&src=http%3A%2F%2Fstaff.tumblr.com%2F&amp;lang=en_US&amp;name=staff" scrolling="no" width="330" height="25" frameborder="0" style="position:absolute; z-index:1337; top:0px; right:0px; border:0px; background-color:transparent; overflow:hidden;" id="tumblr_controls"></iframe> <!--[if IE]> <script type="text/javascript">document.getElementById('tumblr_controls').allowTransparency=true;</script> <![endif]--> <script type="text/javascript">_qoptions={qacct:"p-19UtqE8ngoZbM"};</script> <script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script> <noscript><img src="http://pixel.quantserve.com/pixel/p-19UtqE8ngoZbM.gif" style="display:none; border-width:0px; height:1px; width:1px;" alt=""/></noscript> 

The iframe URL (http://assets.tumblr.com/iframe.html?10&src=http%3A%2F%2Fstaff.tumblr.com%2F&lang=en_US&name=staff) leads to a page that does its own check, if the user is logged in. I just couldn't figure out how this works.

Since this check must be embedded in the theme code, it must be in JavaScript.

Thanks Spencer

+4
source share
1 answer

I think that the problem cannot be solved, because this check must be performed on the server, and the check cannot be performed due to the limitations of Tumblr Theme .

UPDATE: Revert to JS Version

Frames List:

Various blocks of code from these frames:

Tumblr iframe for non-registered users:

 <script type="text/javascript"> var logged_in = (document.cookie.indexOf('logged_in=1') != -1); </script><div style="position:absolute; top:3px; right:3px; white-space:nowrap; height:20px;"> <span id="logged_out_controls" style="display:none;"> <a href="https://www.tumblr.com/register" target="_top" id="follow_link"> <img id="follow_image" alt="Follow" style="width:58px;"/> </a> <a href="https://www.tumblr.com/register/join_tumblr" target="_blank" id="join_link"> <img id="join_image" alt="Join Tumblr" style="width:105px;"/> </a> </span> </div> 

Tumblr iframe for registered users [owner]:

 <div style="position:absolute; top:3px; right:3px; white-space:nowrap; height:20px;"> <a target="_top" href="http://www.tumblr.com/customize?redirect_to=http%3A%2F%2Fexample.com%2F"> <img src="http://assets.tumblr.com/images/iframe_customize_alpha.png?1016" alt="Customize" style="height:20px;width:80px; border-width:0px; display:block; float:left; cursor:pointer;" /> </a> <a target="_top" href="http://www.tumblr.com/dashboard"> <img src="http://assets.tumblr.com/images/iframe_dashboard_alpha.png?1016" alt="Dashboard" style="height:20px; width:81px; border-width:0px; display:block; float:left; cursor:pointer;" /> </a> </div> 

Tumblr iframe for registered users [non-owner]:

 <div style="position:absolute; top:3px; right:3px; white-space:nowrap; height:20px;"> <form action="/follow" method="post" style="display:block; float:left;"onsubmit="_gaq.push(['_trackEvent', 'Iframe', 'Follow', 'example-com');"> <input type="hidden" name="form_key" value="83jbGySgEVpQGOoZALqqoSaKfjs"/> <input type="hidden" name="id" value="example-com"/> <input type="image" src="http://assets.tumblr.com/images/iframe_follow_alpha.png?1016"style="width:58px; height:20px; border-width:0px; display:block;margin-left:3px; cursor:pointer;"alt="Follow"/> </form> <a target="_top" href="http://www.tumblr.com/dashboard"> <imgsrc="http://assets.tumblr.com/images/iframe_dashboard_alpha.png?1016" alt="Dashboard" style="height:20px; width:81px; border-width:0px; display:block; float:left; cursor:pointer;"/> </a> </div> 

Differences that can be detected:

Iframe for not registered has a strange script line:

  • var logged_in = (document.cookie.indexOf ('logged_in = 1')! = -1);

  • The NO link with the href attribute contains the "customize" template (CSS method: a[href*='customize'] );

  • The NO link with the href attribute contains the dashboard template (CSS method: a[href*='dashboard'] );

Iframe for registered users [owner] :

  • There is a link with the href attribute containing the "dashboard" template (CSS method: a[href*='dashboard'] );
  • There is a link with the href attribute that contains the "customize" template (CSS method: a[href*='customize'] );

  • There is NO 'follow' form;

Iframe for registered users [not owner] :

  • There is a link with the href attribute containing the "dashboard" template (CSS method: a[href*='dashboard'] );
  • There is a follow form,

  • The NO link with the href attribute contains the "customize" template (CSS method: a[href*='customize'] );

Conclusion

However, I find this solution rather fragile, I think it is possible to detect the user domain of the current blog based on the diffs listed above.

+5
source

All Articles