Simple Machine Codes
April 17, 2024, 11:20:06 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 Webpage

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

Offline Offline

Gender: Male
Posts: 2,672



View Profile WWW
« on: June 16, 2009, 08:04:43 am »

Footers:
Code:
<script type="text/javascript">
function PassProWeb(p,w){
if(location.href.match("/" + p + ".php") || location.href.match("ezportal;sa=page;" + p) && !location.href.match("pass=" + w)){
document.getElementById("bodyarea").innerHTML = "<div class='tborder' id='PassProWeb'><div class='catbg' st" + "yle='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='ppw' /><br /><br /><input type='button' onclick='PressMe(\"" + w + "\");' value='Enter' /></center></td></tr></table></div></div>";
};};
function PressMe(pW){
var pw = document.getElementById("ppw");
if(pw.value == pW){
if(location.href.match(/\/pages\//i)) window.location.href = window.location.href + "?pass=" + pW;
if(location.href.match(/ezportal;sa=page;p/i)) window.location.href = window.location.href + ";pass=" + pW;
}else if(pw.value == ""){
alert("Enter a Password");
}else{
alert("Password is incorrect");
};};
PassProWeb("PAGE","PASSWORD");
</script>

Original request:http://revolutionx.smfforfree3.com/index.php/topic,695.0.html

This code lets you add a Password, that is case sensitive, to a webpage you have created.  It works in either the Webpage Editor webpages, or the ez-portal pages Smiley

PAGE = The name of the page,
 - If you want to use the Webpage Editor Page, use the Name of the webpage.  You need the correct name too, so go to that webpage and look at the URL, you will see something like this:
Quote
http://XXXXXXXX.smfforfreeX.com/pages/XXXXXXXX/test.php
The red text is the text that you will put for the name of the webpage.
 - If you want to use the ezPortal page, go to it and you will see something like this:
Quote
http://XXXXXXXX.smfforfreeX.com/index.php?action=ezportal;sa=page;p=1
Again, the red text is the part you would put for the name part.
PASSWORD = The password for that page.  The password is case sensative.

Here are two examples of how to edit the code:
Code:
PassProWeb("test","moose");
PassProWeb("p=1","Agent");

Also, to add more pages to protect, add more of these lines:
Code:
PassProWeb("PAGE","PASSWORD");

Enjoy Smiley
Report Spam   Logged

Share on Facebook Share on Twitter



Pages: [1]   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