Pelican Parts Forums

Pelican Parts Forums (http://forums.pelicanparts.com/)
-   Off Topic Discussions (http://forums.pelicanparts.com/off-topic-discussions/)
-   -   How to Create a simple, single password in Dreamweaver? (http://forums.pelicanparts.com/off-topic-discussions/413176-how-create-simple-single-password-dreamweaver.html)

RKC 06-05-2008 02:46 PM

How to Create a simple, single password in Dreamweaver?
 
I'm finally (I know, I know) migrating from GoLive to Dreamweaver, and just need to make a form with a single, simple password to protect an exam from prying eyes. I am a "pretty colors" sort of guy - I love Illustrator, InDesign and Photoshop, etc., but don't know code.

So what's the deal? I can make the form, found the password field to make the text turn to dots, but how do you assign a value for the password? Can you just protect a page? Can I do a sign up form with a password that leads to another form? Don't care how it's done, really - and I'm not worried about REAL security (no payments, just a test I'm giving that won't change for a year - so I don't want others to see it until they are really taking it). But the test will be a form too, so I can't just do a locked *.pdf.

Help!

FWIW - I'm finally leaving Live Motion 2 also (Adobe's old Flash creator) for Flash CS3 too. A summer of re-learning.....

slodave 06-05-2008 02:56 PM

Can you put the page you want into a new sub directory? If so, use htaccess.

http://www.javascriptkit.com/howto/htaccess3.shtml

If you use a field, then you would have to use javascript, perl or php to make read the password field.

In php, it would look something like this:
If the password field has a name of password and the password is "test1234", then when variable is passed to the next page, the php code would...

$variable = $password;

PHP Code:

if ($variable == 'test1234') {
echo 
"that is the correct password.";

} else {

echo 
"Sorry, you loose!";



Dave

RKC 06-05-2008 03:15 PM

Wow! Thanks for the quick response. I cut and pasted the code and it worked great!

I'll try the htaccess too.

But even the link you sent seems secure enough for what I want.

Thanks again.

RKC 06-05-2008 03:21 PM

BTW - this is best site, hands down, for ANY QUESTION.

Thanks again, slodave! (And Wayne!)

slodave 06-05-2008 04:11 PM

I'm glad it worked. I forgot to put in the corresponding [INPUT TYPE=PASSWORD NAME=password] for the first page.

rattlsnak 06-05-2008 04:20 PM

BTW, if youre using DW, it will write all the PHP code for you in Design mode. No need to "learn" code! ;)

RKC 06-05-2008 05:36 PM

Thanks for the tip. I can cut and paste code - thanks again slowdave - but don't know how to write it - except for some basic way back when.....

Haven't got the htaccess/password stuff to work. Will try again Friday.

RKC 06-05-2008 05:38 PM

One more question though:

If I just cut and paste the simplest code, can't anyone just do the "view source" thing and SEE the password?

I'm dealing with medical doctors in their 40's & 50's mainly, so not really an issue, but I'm curious....

slodave 06-05-2008 05:41 PM

Quote:

Originally Posted by RKC (Post 3986317)
One more question though:

If I just cut and paste the simplest code, can't anyone just do the "view source" thing and SEE the password?

I'm dealing with medical doctors in their 40's & 50's mainly, so not really an issue, but I'm curious....

No, the php code will not be visible, only the HTML it displays. The hidden input takes a value (test1234) and passes that in the headers as a variable to the next page.

slodave 06-05-2008 05:54 PM

Here's a simple php/HTML page...

First Page:
PHP Code:

<?php
print "<HTML>\n";
print 
"<TITLE>My Page</TITLE>\n";
print 
"<BODY>\n";
print 
"<FORM ACTION=nextpage.php METHOD=POST>\n";
print 
"Please enter a the password<BR />\n";
print 
"<INPUT TYPE=PASSWORD NAME=password>\n";
print 
"</FORM>\n";
print 
"</BODY>\n";
print 
"</HTML>\n";
?>

nextpage.php...

PHP Code:

<?php

$variable
=$password;

if (
$variable == 'test1234') {
print 
"<HTML>\n";
print 
"<TITLE>Page 2</TITLE>\n";
print 
"<BODY>\n";
print 
"Password is correct.<BR />\n";
print 
"Your data goes here.\n";
print 
"</BODY>\n";
print 
"</HTML>\n";
} else {

print 
"Password is invalid";

}
?>


slodave 06-05-2008 05:58 PM

I'll write the two pages for you, if you want...


All times are GMT -8. The time now is 11:43 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2025 Pelican Parts, LLC - Posts may be archived for display on the Pelican Parts Website


DTO Garage Plus vBulletin Plugins by Drive Thru Online, Inc.