Simple Machine Codes
March 28, 2024, 05:01:59 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to SMC, the best place for your SMF For Free Codes
 
  Home Help Search Arcade Gallery Affiliates Code Index Staff List Calendar Members Login Register  

Password Protect V1

Pages: [1] 2   Go Down
  Print  
Author Topic: Password Protect V1  (Read 2199 times)
0 Members and 1 Guest are viewing this topic.
Agent Moose
Administrator

Offline Offline

Gender: Male
Posts: 2,672



View Profile WWW
« on: November 26, 2007, 02:41:42 pm »

Footers
Code:
<script>
var BoardPro = "BOARD";
var PassPro = "PASSWORD";

var loc = window.location.href.split("/index.php")[0];
//Created by Agent Moose (smcodes.smfforfree3.com)
$("a[name='b" + BoardPro + "']").each(function(){
$(this).parent().parent().next().html("");
$(this).parent().parent().next().next().html("<i>Password Protected</i>");
});
function PassProtected(){
var BP = document.getElementsByTagName("a");
for(s=0;s<BP.length;s++){
if(BP[s].className == "nav" && BP[s].href.match("board," + BoardPro)){
document.getElementById("bodyarea").innerHTML = "<br><br><div class='tborder'><div class='catbg' style='padding: 6px; vertical-align: middle; text-align: center; '>Board Protected</div><div><table border='0' width='100%' cellspacing='1' cellpadding='4' class='bordercolor'><tr><td class='windowbg2' width='100%'><center><br><i>Enter Password:<br>(Password is Case Sensitive)</i><br><input type='text' id='passprotected'/><br><br><input type='button' onclick='PressButton();' value='Enter'/></center></td></tr></table></div></div><br>";
};};};
function PressButton(){
password = document.getElementById("passprotected");
if(password.value == PassPro){
window.location.href = loc + "/index.php/Protected/board," + BoardPro + ".0." + PassPro + ".html"
}else if(password.value == ""){
alert("Enter a Password");
}else{
alert("Password is incorrect");
};};
if(!location.href.match("/Protected/board," + BoardPro + ".0." + PassPro + ".html")) PassProtected();
</script>

Original Request: http://smcodes.smfforfree3.com/index.php/topic,417.0.html

BOARD = The Board Number that will be password protected.
PASSWORD = The password for the board.  The password is case sensative.

This is only for one board right now, I am still working on making it work for more than one board.
« Last Edit: October 17, 2008, 08:13:33 pm by Agent Moose » Report Spam   Logged

Share on Facebook Share on Twitter

knox1025
Members

Offline Offline

Posts: 50


View Profile
« Reply #1 on: November 26, 2007, 05:35:44 pm »

Only One Board? Then I Can't Wait For v.2!!  Angry Cheesy Grin
Report Spam   Logged

Myth
Lightning Guardian
Members

Offline Offline

Gender: Male
Posts: 28


Ike for Brawl!


View Profile WWW
« Reply #2 on: November 27, 2007, 03:11:32 pm »

what does "Board number" mean?
Report Spam   Logged

Agent Moose
Administrator

Offline Offline

Gender: Male
Posts: 2,672



View Profile WWW
« Reply #3 on: November 27, 2007, 04:51:56 pm »

When you view a board, if you look up at the Address bar, you will see something like this:

board,3

The Red number will be the board number.
Report Spam   Logged

Myth
Lightning Guardian
Members

Offline Offline

Gender: Male
Posts: 28


Ike for Brawl!


View Profile WWW
« Reply #4 on: November 27, 2007, 05:54:15 pm »

Ah thanks Cheesy
Report Spam   Logged

LaundryLady
Geriatric Goddess
Global Moderator

Offline Offline

Gender: Female
Posts: 290


I'm watching, I have a sense of humor: Guess Who


View Profile
« Reply #5 on: November 27, 2007, 06:07:41 pm »

Boards and Topics, cool.  Ok so we can protect one board with a password, but we can't put the script in again for another one?
Report Spam   Logged

Myth
Lightning Guardian
Members

Offline Offline

Gender: Male
Posts: 28


Ike for Brawl!


View Profile WWW
« Reply #6 on: November 28, 2007, 11:59:28 am »

I don't know...unless you know coding. Which I don't  Tongue
Report Spam   Logged

Agent Moose Jr.
Ultra Contagious
Global Moderator

Offline Offline

Gender: Male
Posts: 1,045



View Profile WWW
« Reply #7 on: January 04, 2008, 01:11:09 pm »

nice job
Report Spam   Logged

Newest:

knox1025
Members

Offline Offline

Posts: 50


View Profile
« Reply #8 on: January 31, 2008, 11:20:46 am »

Problem With This Code!

Okay, It Works Fine If You Are Going To Tha Locked Board From Tha Index.

But, If You View a Topic In 'Recent Posts' That Is IN Tha LOCKED Board, It Asks You For No Password, an Any1 Can Enter Tha Board.

Any Way To Fix This?

Or Maybe Set Tha Locked Board To NOT Display In 'Recent Posts'?
Report Spam   Logged

Myrtle
The Girl With The Forum.
100 Club Member

Offline Offline

Gender: Female
Posts: 480


Death Note(Credits to Kai): Myrtle_Gail, Myr-chan


View Profile WWW
« Reply #9 on: February 05, 2008, 09:15:25 am »

Thanks, there were problems about this certain topic of "hacking" in my forum. So thanks Smiley
Report Spam   Logged

PixelatedDaydreams
Newcomers!

Offline Offline

Posts: 1


View Profile
« Reply #10 on: February 26, 2008, 10:46:54 am »

i tried this code in my forum... but for some reason it isn't working. all my members can still get in...is there something im doing wrong?
Report Spam   Logged
sweet_candygirl23
Members

Offline Offline

Posts: 41


View Profile
« Reply #11 on: March 31, 2008, 05:25:21 am »

It's working fine at mine. Smiley Great code! Wink
Report Spam   Logged
knox1025
Members

Offline Offline

Posts: 50


View Profile
« Reply #12 on: April 29, 2008, 11:29:31 pm »

Problem With This Code!

Okay, It Works Fine If You Are Going To Tha Locked Board From Tha Index.

But, If You View a Topic In 'Recent Posts' That Is IN Tha LOCKED Board, It Asks You For No Password, an Any1 Can Enter Tha Board.

Any Way To Fix This?

Or Maybe Set Tha Locked Board To NOT Display In 'Recent Posts'?


Nobody Read That? Lol.. Is v.2 Out Yet?
Report Spam   Logged

legend 1234
100 Club Member

Offline Offline

Gender: Male
Posts: 461


Legend 1234


View Profile WWW
« Reply #13 on: April 30, 2008, 12:44:06 am »

hmm dnno

dont thnik moosey saw it

and i think its only v1 i think moosey forgot about this lol

he did post this last november

legend 1234
Report Spam   Logged

FinishTheFight
Newcomers!

Offline Offline

Gender: Male
Posts: 3


Smiles all around!


View Profile WWW
« Reply #14 on: May 03, 2008, 04:51:15 pm »

 THIS IS AWESOME! I was looking for something similar to this. Can you make it password protect topics or at least work on that. I made a request for it on smfsupport.
Report Spam   Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy