Revolution X

Coding Community => Other Forum Coding => Topic started by: Agent Moose on May 08, 2009, 07:50:50 am

Title: [ZB] Quick Admin Login
Post by: Agent Moose on May 08, 2009, 07:50:50 am
Place in (one of the following): Below Baord/Above Board/Above Copyright
<script type="text/javascript">function QuickAdmin(){/*==Created by Agent Moose (*/var User = $("#top_info strong a").text();$.get(main_url + "admin/",function(a){if($(a).find("a:contains('[Sign Out]')").html()){alert("Already logged in!");}else{var Pass1 = prompt("Enter your Password:","");var Pass2 = prompt("Enter your Password again:","");if(Pass1 == Pass2){$.post(main_url + "admin/?menu=login&amp;theme=0",{name:User,pass:Pass2},function(){alert("Logged in!");});}else{alert("Your passwords did not match!");};};});};if($("li#menu_acp").html()){$("a:contains('[Sign Out]')").after(" <a href='javascript:void(0);' onclick='QuickAdmin();'>[Quick Admin Login]</a>");};</script>

A simple code that adds a link next to the sign out link that says [Quick Admin Login] (only if your an admin of the board).

A simple code that took me awhile to make, it was my first time using Ajax Post function :P

Anyway, enjoy :)