SMF For Free Support Forum
Signup For Free Forum
September 05, 2008, 12:02:53 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1] 2
  Print  
Author Topic: [Help] with my code...  (Read 1284 times)
0 Members and 1 Guest are viewing this topic.
blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« on: March 11, 2008, 11:13:25 pm »

I made this code its supposed to put a password on your forums or website the default pass is "cool".

code:

Code:
<HEAD>
<SCRIPT language="JavaScript">
<!--hide

var password;

var pass1="cool";

password=prompt('Please enter your password to view this page!',' ');

if (password==pass1)
  alert('Password Correct! Click OK to enter!');
else
   {
    window.location="www.barbie.com";
    }

//-->
</SCRIPT>
</HEAD>


See var password;
This creates a variable named "password".

var pass1="cool";
This creates a password that will be accepted by the script. We name it pass1 in case we would like to have more than one acceptable password. ( ie pass2, pass3 etc. ).

password=prompt('Please enter your password to view this page!',' '); This is what creates the prompt for the user to enter a password. Whatever the user enters in the prompt will be the value of the variable "password".

if (password==pass1)
alert('Password Correct! Click OK to enter!');

This is where we verify the password. The variable "password" is what the user just typed into the prompt. The variable "pass1" is the only password we will accept. If they are the same, we send them an alert that the password was OK and they can continue.

else
{
window.location="www.barbie.com";
}
This is what happens when they type in an incorrect password. We send them to a page of our choice. In IE4, it looks like nothing happened, it just reloads this page. In NS3 and 4 you will probably see the protected page for a quarter of a second. I said it wasn't the most secure script out there, so I would recommend the links at the end of the tutorial so you can get a more secure script. I chose to send it back to this page (jpass.htm), but you can type any url here you want. Maybe you could use something like:
window.location="http://www.barbie.com";
Make them cringe a little.......thats what mine is...
When i tried on test forum it kept redirecting me to a weird site it was and advertizing site didn't evan ask for pass whats wrong with it???


« Last Edit: March 14, 2008, 07:40:32 pm by blahs » Logged
Celebrus
SMF For Free Hero
*
Offline Offline

Posts: 752


Previously known as Omikron


View Profile WWW
« Reply #1 on: March 12, 2008, 12:37:17 am »

Try
Code:
<script type="text/javascript">
<!-- // hide

var password;

var pass1="cool";

password=prompt('Please enter your password to view this page!',' ');

if (password==pass1) {
  alert('Password Correct! Click OK to enter!');
}
else {
    window.location="http://www.barbie.com/";
}

// -->
</script>
Logged

blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« Reply #2 on: March 12, 2008, 09:32:51 am »

Try
Code:
<script type="text/javascript">
<!-- // hide

var password;

var pass1="cool";

password=prompt('Please enter your password to view this page!',' ');

if (password==pass1) {
  alert('Password Correct! Click OK to enter!');
}
else {
    window.location="http://www.barbie.com/";
}

// -->
</script>
dang now it ruins it it dosen't ask for pass just directs to barbie.com can a staff member here take that code of its in the headers at http://tteessttforum.smfforfree4.com/index.php
Logged
Celebrus
SMF For Free Hero
*
Offline Offline

Posts: 752


Previously known as Omikron


View Profile WWW
« Reply #3 on: March 12, 2008, 09:48:00 am »

Why not disable javascript and get rid of the code? It's working for me btw.
Logged

blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« Reply #4 on: March 12, 2008, 09:49:57 am »

Why not disable javascript and get rid of the code? It's working for me btw.
how do i disable/inable?
Logged
simply sibyl
Global Moderator
*
Offline Offline

Posts: 8018


I am not a dude!


View Profile WWW
« Reply #5 on: March 12, 2008, 10:29:11 am »

Why not disable javascript and get rid of the code? It's working for me btw.
how do i disable/inable?

To disable Javascript in Firefox: 
Tools > Options >  Content >  take checkmark out of  "enable Javascript"  in Firefox

To disable Javascript in Internet Explorer:
From the Tools menu, choose Internet Options... .
Click the Security tab.
Click Custom Level... .
Scroll to the "Scripting" section of the list. Click Disable or Enable.
Close and restart your browser.
Logged

blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« Reply #6 on: March 13, 2008, 07:58:55 am »

Why not disable javascript and get rid of the code? It's working for me btw.
how do i disable/inable?

To disable Javascript in Firefox: 
Tools > Options >  Content >  take checkmark out of  "enable Javascript"  in Firefox

To disable Javascript in Internet Explorer:
From the Tools menu, choose Internet Options... .
Click the Security tab.
Click Custom Level... .
Scroll to the "Scripting" section of the list. Click Disable or Enable.
Close and restart your browser.

It didn't work can you go on the forum and delete this code:
Code:
<script type="text/javascript">
<!-- // hide

var password;

var pass1="cool";

password=prompt('Please enter your password to view this page!',' ');

if (password==pass1) {
  alert('Password Correct! Click OK to enter!');
}
else {
    window.location="http://www.barbie.com/";
}

// -->
</script>
Ppplllleeeaassee!!! because all the codes I wrote the tests are on that forum and since i need to show them a test for the codes i need that forum working!
Logged
Celebrus
SMF For Free Hero
*
Offline Offline

Posts: 752


Previously known as Omikron


View Profile WWW
« Reply #7 on: March 13, 2008, 08:29:51 am »

Which browser are you using? Your test forum works fine for me. Some popups and prompts are displayed, then it asks for the password, I enter cool and then it lets me see the site.
Logged

blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« Reply #8 on: March 13, 2008, 08:49:06 am »

Which browser are you using? Your test forum works fine for me. Some popups and prompts are displayed, then it asks for the password, I enter cool and then it lets me see the site.
really it redirects me to barbie.com im using internet explorer
Logged
Celebrus
SMF For Free Hero
*
Offline Offline

Posts: 752


Previously known as Omikron


View Profile WWW
« Reply #9 on: March 13, 2008, 08:55:03 am »

Try accessing your site with FF and go in and delete it.
Logged

blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« Reply #10 on: March 13, 2008, 12:40:14 pm »

Try accessing your site with FF and go in and delete it.
once i tried getting ff but it deleted all my favourites etc. how do i get without getting rid of my internet explorer?
Logged
LaundryLady
Global Moderator
*
Offline Offline

Posts: 3026



View Profile WWW
« Reply #11 on: March 13, 2008, 12:48:28 pm »

Firefox is just another browser.  It doesn't delete anything.  I currently have 5 browsers on my computer.  You must not have paid attention when you were doing it.
Logged

blahs
SMF For Free Sr. Member
*
Offline Offline

Posts: 252


5 out of 4 people have trouble with fractions!


View Profile WWW
« Reply #12 on: March 13, 2008, 01:04:18 pm »

Firefox is just another browser.  It doesn't delete anything.  I currently have 5 browsers on my computer.  You must not have paid attention when you were doing it.
can you give me the link on how to get ff without getting rid or expanding on ie?
Logged
LaundryLady
Global Moderator
*
Offline Offline

Posts: 3026



View Profile WWW
« Reply #13 on: March 13, 2008, 01:34:23 pm »

http://www.mozilla.com/en-US/
Logged

Soul Fly
SMF For Free Hero
*
Online Online

Posts: 708



View Profile
« Reply #14 on: March 13, 2008, 02:59:30 pm »

The page takes me directly to barbie.com
So...
No help from me sorry..
Could you help me too with that?
Pm me..
Thanks

X
Logged



Pages: [1] 2
  Print  
 
Jump to:  

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 1.432 seconds with 19 queries.