PDA

View Full Version : need help with p/w protecting


huwey
12-19-2002, 01:49 AM
hello i'm not sure where this actually needs to be placed but what i am needing is some way of having a user name/password protection on a certian page of mine...i use frontpage 98 for my site and can't upload .htaccess and .htpasswd files so i am assuming that the site don't support them or something...frontpage gives me an error when trying to import these files...is there a way to accomplish the same thing w/o using these files so that only certian people have access to the page??...some detailed help on this will be needed cause anything out side of i guess you would call basic html is "greek" to me...i dont have the slightest clue as to what to do for something like this.....thanks all for the help :)

KJ_innit
12-19-2002, 07:16 AM
if you really want adequate pass word protection on your site i'd recommend getting to know the basics of either ASP or PHP and try and create a login page using that, its effective. Alternatively i know that you can assign passwords to folders on your server, but i'm not sure how.

Hope this helps.

scoutt
12-19-2002, 09:14 AM
yeah don't use front page to do your uploading or downloading. get a free ftp program and it will accomplish the job better.

leoo24
12-19-2002, 12:02 PM
dont use javascript to pass protect your site, cos simply someone amy have java turned off!! server side scripting is secure but i think easier for you is to create a .htaccess file:

1. Create a text file in the directory you want to protect called .htaccess.

2. Contents of .htaccess (you have to type/paste them in):
(don't type in the <-- comments)

-----------------------------------------------------------
AuthUserFile /home/yourusername/public_html/.htpasswd <-- The .htpasswd file in the directory you want to protect
AuthGroupFile /dev/null
AuthName "Test of Security Stuff" <--- call it whatever you want
AuthType Basic

<Limit GET>
require user billy bob joe <--- whoever you want to have access to the page(s)
</Limit>

--------------------------------------------------------------------------------

3. Next, you have to create the password file in the directory you want to protect (type the stuff after the $ and before the <--) These commands are typed directly into the command line of your shell. Do not create and upload a file with these lines. It will not work.

--------------------------------------------------------------------------------
$/usr/sbin/htpasswd -c .htpasswd rex <-- initial user
$/usr/sbin/htpasswd .htpasswd billy bob joe <-- additional users

--------------------------------------------------------------------------------

4. you're done. try to access your page now.

scoutt
12-19-2002, 12:53 PM
he already said he can't do .htaccess because frontpage wouldn't let him....

huwey
12-19-2002, 12:55 PM
yes i know how to use .htaccess and .htpasswd files i am currently using them for the page...but i'm moving the page to another site and can't get them to work there that's why i was trying to find a way to do this w/o using .htaccess/.htpasswd files....anything but ASP can be used on this site...but as far as writing a script for it in php or any other language i'm completely lost...lol...but thanks for the advice leoo the .htaccess/.htpasswd files to a great job...just moving to another server to have more options (languages) available to me to use and try and learn :)

leoo24
12-19-2002, 01:56 PM
oooooops, see my mother always told me to read things through properly, don't why i didnt listen lol

leo

leoo24
12-19-2002, 02:09 PM
try having a look at this downloadable php script (version 1.0)
http://www.xaviermedia.com/php/cookieprotection.phtml

the instructions are easy to follow, only problem is that your pages have to have .php extensions for it to work, but that's not a problem really, you can just change the extension and it will work like a normal html file, php files can be a combination of html and php, anyway have a butchers, php isn't that hard to learn

leo

scoutt
12-19-2002, 02:16 PM
php can't have teh extension "html" unless the server is setup to parse html as php, which is not recommended. it must have a php if the server is not setup that way.

leoo24
12-19-2002, 02:19 PM
here huwey, here's some perl scripts for password protection
, there maybe one there that you can just thow into the cgi-bin
http://www.hotscripts.com/Perl/Scripts_and_Programs/Password_Protection/

leo:)

huwey
12-19-2002, 02:48 PM
would one of you be willing to show me how to change the html over to a php page?? currently it is in html and not sure how to write in php....so would need probably lots of patients lol....or i could just attach the html on here...either way..but would like to atleast try to learn php....the html itself is 9k so to me that is kinda a large html file...or if you wanted you could look at my previous post here (http://www.htmlforums.com/showthread.php?threadid=19792) that has the code posted already....and once again thanks for the help on that scoutt

scoutt
12-19-2002, 03:04 PM
if you use that page for the php and password protect that page, then we have some work to do.

you have to decide on what form of protection you want. cookies or through the db.

huwey
12-19-2002, 03:32 PM
what way would be easiest to do....there will only be 1 user name and 1 password....see i run a group that hosts euchre tournaments online and all the people that host (run) the tournaments will have the user name and the password...and this way not everyone will be able to access the site to submit the winners and emails and such...this way i wont have to worry about if it's a REAL tournament result or not....cause this page will be linked from our main page that everyone will have access to....and as long as you are willing to work with me on this and have somme patients with me i'll do the best i can with it w/o you having to do anything....Thanks :)

scoutt
12-19-2002, 03:48 PM
ok, if there is only 1 password and username it can be set pretty easy. so is that the page you are usnig to login with? the one on the other thread?

huwey
12-19-2002, 08:20 PM
well the way it currently is done is like this (http://home.earthlink.net/~zone_disney/tourney_results/tourney_results.html) using the .htaccess type of a log in....so a seperate login page would be fine if that is whats needed...unless you can link right to the page but a login would be required for the page to show kinda like the htaccess...will just need to know how it will work....dont want the page that the login is for to be accessable w/o signing in....if that makes since

scoutt
12-19-2002, 08:47 PM
ok, so we want to create a seperate login page. first you need to decide if you want to use a cookie or jsut a session or both or both and a db? :)

either way it shouldn't be to tough.

so you create your form that you want people to enter the username and password in. that should be easy for you.

next we need to decide, actually what is the page that you want to password protect? does it have a form on it too?

but anyway, at the top of that page you are protecting you need to insert some code so that somebody can't just type the address to that page and see if while bypassing the login page.

this is pretty easy. if you decide a cookie then it is something like this

<?
if (!$_COOKIE['username']){
header ("location: login.php");
}
?>

that will tell them if there is no cookie then we take them to the login page. you can do the same with the session too.

so we need to get password and username from the login form. this looks like this

<?
// username is the name of the form input tag
// same as the password name of the input form
if(($_POST['username'] == "") OR ($_POST['password']== "")){
// if empty then we take them to the login page
header ("location: login.php");
} elseif ($_POST['username'] == "your_username") AND ($_POST['password'] == "your password") OR ($_COOKIE['username'])){

//the rest of the page here

// at the bottom of the page add this
} else {
header("location: login.php");
}
?>

understand? you will also need to change the extension of this page we are protecting to filename.php

huwey
12-19-2002, 09:09 PM
ok about the page that i want protected...it is just that form that is posted in the other thread


and at the top of that is where this would go right??


PHP:--------------------------------------------------------------------------------

<?
if (!$_COOKIE['username']){
header ("location: login.php");
}
?>

--------------------------------------------------------------------------------



and this


PHP:--------------------------------------------------------------------------------

<?
// username is the name of the form input tag
// same as the password name of the input form
if(($_POST['username'] == "") OR ($_POST['password']== "")){
// if empty then we take them to the login page
header ("location: login.php");
} elseif ($_POST['username'] == "your_username") AND ($_POST['password'] == "your password") OR ($_COOKIE['username'])){

//the rest of the page here

// at the bottom of the page add this
} else {
header("location: login.php");
}
?>

--------------------------------------------------------------------------------


would be on the sign in page right?? and the coding for the page (assuming it can be in just reg. html) would go on the next line after //the rest of the page here

now as far as the page itself (the one that will be protected) it's currently named tourney_results.html but i'm gonna change it to just index.html but from what your saying just rename it to index.php ??

and the db would be needed to compare if the user/pass combo was correct wouldn't it?


sorry for all the questions like i said i honestly dont really have a clue how to do this...lol...do you know of a site that will "tutor" someone on how to do this?...something free of course...lol

scoutt
12-19-2002, 09:46 PM
hmm, well no, don't name the file index.php. the reason is because that is the default page for the folder it is in. the code I gave all goes into the page you wanted to protect. but you have to decide if you want to use the db or the cookie way, no reason to do both if you are going to have only 1 password and username.

I would do the cookie way but it doesn't matter.

you would have to search the net for a tutorial as I don't have any.

just make the loginpage and have the from action point to the page you were going to call index.php. name it like this
tourney_results.php

huwey
12-19-2002, 10:48 PM
ok not sure if i'm getting this or not but here is what i got...i made one called index.php (to be the login screen) with this in it:


<html>

<head>
<title>Login</title>
</head>

<body>
<div align="center"><center>

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="90%">
<tr>
<td width="100%" valign="middle" align="center">&nbsp;<form method="POST"
action="results.php">
<p><strong>Username: </strong><input type="text" name="username" size="20"><br>
<strong>Password: </strong><input type="password" name="password" size="20"><br>
<input type="submit" value="Submit" name="submit"><input type="reset" value="Reset" name="reset"></p>
</form>
</td>
</tr>
</table>
</center></div>
</body>
</html>

then i have the for named (as you can see from above) results.php and it has this in it:


<!-- saved from url=(0022)http://internet.e-mail -->
<html>

<head>
<title>Tourney Results</title>
<?
if (!$_COOKIE['username']){
header ("location: index.php");
}
?>
<script type="text/javascript">


//Made by A1 JavaScripts - http://www.a1javascripts.com
//Use freely but please keep the credits in place
//Not to be exhibited on any other archive without permission

<!--
function validateform(disney) {
if (
disney.Winner_1.value==""||
disney.Winner_2.value==""||
disney.Runner_Up_1.value==""||
disney.Runner_Up_2.value==""||
disney.email1.value==""||
disney.email2.value==""||
disney.email3.value==""||
disney.email4.value==""||
disney.host.value==""||
disney.date.value==""||
disney.Start_Time.value==""||
disney.Scheduled.value==""||
disney.Format.value==""||
disney.No_of_Teams==""
)
{
window.alert ("Please check and make sure you have everything filled in")
return false;
}
}
//-->
</script>

</head>

<body background="tvbkgnd.gif" bgproperties="fixed">

<?
// username is the name of the form input tag
// same as the password name of the input form
if(($_POST['username'] == "") OR ($_POST['password']== "")){
// if empty then we take them to the login page
header ("location: index.php");
} elseif ($_POST['username'] == "your_username") AND ($_POST['password'] == "your_password") OR ($_COOKIE['username'])){
//the rest of the page here

<p align="center"><strong>NOTE: All fields with <font color="red">*</font> next to it is
required.<br>
</strong><br>
</p>

<form name="disney" method="post" action="contact.php"
onsubmit="return validateform(disney)">
<div align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="50%" valign="top" align="left"><b>Host:</b> <input type="text" name="host"
size="17" style="background-color: rgb(255,0,0); color: rgb(255,255,255)" maxlength="16"> <font
color="red">*</font><br>
<b><br>
Date:</b> <input type="text" name="date" size="9"
style="background-color: rgb(0,0,128); color: rgb(255,255,255)" maxlength="8"> <font
color="red">*</font><b> (Please use the following format 01/01/02)<br>
<br>
Starting Time:&nbsp; <select name="Start_Time" size="1"
style="background-color: rgb(128,0,128); color: rgb(255,255,0)">
<option selected value></option>
<option value="12:00 AM">12:00 AM</option>
<option value="1:00 AM">1:00 AM</option>
<option value="2:00 AM">2:00 AM</option>
<option value="3:00 AM">3:00 AM</option>
<option value="4:00 AM">4:00 AM</option>
<option value="5:00 AM">5:00 AM</option>
<option value="6:00 AM">6:00 AM</option>
<option value="7:00 AM">7:00 AM</option>
<option value="8:00 AM">8:00 AM</option>
<option value="9:00 AM">9:00 AM</option>
<option value="10:00 AM">10:00 AM</option>
<option value="11:00 AM">11:00 AM</option>
<option value="NOON">NOON</option>
<option value="1:00 PM">1:00 PM</option>
<option value="2:00 PM">2:00 PM</option>
<option value="3:00 PM">3:00 PM</option>
<option value="4:00 PM">4:00 PM</option>
<option value="5:00 PM">5:00 PM</option>
<option value="6:00 PM">6:00 PM</option>
<option value="7:00 PM">7:00 PM</option>
<option value="8:00 PM">8:00 PM</option>
<option value="9:00 PM">9:00 PM</option>
<option value="10:00 PM">10:00 PM</option>
<option value="11:00 PM">11:00 PM</option>
</select></b> <font color="red">*</font><b> (Please use zone time &quot;PST&quot;)<br>
<br>
Format:</b> <select name="Format" size="1"
style="background-color: rgb(0,0,0); color: rgb(0,255,255)">
<option selected></option>
<option value="5 pt. speed">5 pt. speed</option>
<option value="7 by 2">7 by 2</option>
<option value="Black only">Black only</option>
<option value="Blindman's Bluff">Blindman's Bluff</option>
<option value="Canadian">Canadian</option>
<option value="Cheaters reverse">Cheaters reverse</option>
<option value="Fine Nine Assassins">Fine Nine Assassins</option>
<option value="Front Line Bullet">Front Line Bullet</option>
<option value="Happy To Help">Happy To Help</option>
<option value="Host's Choice">Host's Choice</option>
<option value="Name Your Downfall">Name Your Downfall</option>
<option value="Next">Next</option>
<option value="Queen Of The Night">Queen Of The Night</option>
<option value="Red only">Red only</option>
<option value="Red/Black suicide">Red/Black suicide</option>
<option value="Regular">Regular</option>
<option value="Reverse">Reverse</option>
<option value="Risky Business">Risky Business</option>
<option value="Russian Roulette">Russian Roulette</option>
<option value="Single Suit Only">Single Suit Only</option>
<option value="Sloppy Suicide">Sloppy Suicide</option>
<option value="Solitare">Solitare</option>
<option value="Stage Assassins">Stage Assassins</option>
<option value="Steal The Deal">Steal The Deal</option>
<option value="Strip 9's">Strip 9's</option>
<option value="Suicide">Suicide</option>
<option value="Suicide King's">Suicide King's</option>
<option value="Suited Seat">Suited Seat</option>
<option value="Trump First">Trump First</option>
</select><font color="red">*</font><br>
<b><br>
Number of teams: <input type="text" name="No_of_Teams" size="20"
style="background-color: rgb(0,0,128); color: rgb(192,192,192)"></b><font color="red">*</font><br>
<b><br>
Was this tourney Scheduled? <input type="radio" value="Yes" name="Scheduled"
style="color: rgb(0,0,255)"> Yes&nbsp; <input type="radio" name="Scheduled" value="No"> No</b><font
color="red"> *</font></td>
<td width="50%"><b>Winner 1:</b> <input type="text" name="Winner_1" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email1" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font><br>
<br>
<b>Winner 2:</b> <input type="text" name="Winner_2" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email2" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font><br>
<br>
<b>Runner Up 1:</b> <input type="text" name="Runner_Up_1" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email3" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font><br>
<br>
<b>Runner Up 2:</b> <input type="text" name="Runner_Up_2" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email4" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font></td>
</tr>
</table>
</center></div><hr color="#FFFFFF" width="95%" size="3">
<div align="center"><center><p><b>Any additional emails (please include username next to
each email ie. jondoe jdoe@hotmail.com):</b><br>
<br>
<textarea name="additional_emails" rows="10" cols="60"
style="font-family: Arial; background-color: rgb(0,0,255); color: rgb(255,255,255); border-left: medium solid rgb(255,255,0); border-right: medium solid rgb(255,255,0); border-top: medium solid rgb(0,255,0); border-bottom: medium solid rgb(0,255,0)"></textarea></p>
</center></div><div align="center"><center><p><input type="submit" value="Send"
style="background-color: rgb(255,255,255); color: rgb(255,0,0); border: medium none"> <input
type="reset" value="Clear"
style="background-color: rgb(255,255,255); color: rgb(255,0,0); border: medium none"></p>
</center></div>
</form>

<p align="center">click <a href="http://zonehosts.com/disney"
style="color: rgb(255,255,0)">here</a> to return to the main page</p>

<hr color="white" width="95%" size="3">
// at the bottom of the page add this
} else {
header("location: index.php");
}
?>
</body>
</html>

now no matter what i put in for the user/pass i get a screen saying this:

Parse error: parse error in /home/virtual/site63/fst/var/www/html/disney/tourney_results/results.php on line 53

also is it ok to make notepad the default viewer for php files?

huwey
12-19-2002, 11:03 PM
oh btw if you need/want to move this to the server side forum go ahead

scoutt
12-19-2002, 11:22 PM
well surprised that is all you get.

change this line

} elseif ($_POST['username'] == "your_username") AND ($_POST['password'] == "your_password") OR ($_COOKIE['username'])){


with this line

} elseif (($_POST['username'] == "your_username") AND ($_POST['password'] == "your_password") OR ($_COOKIE['username'])){


also you have to put this

<?
if (!$_COOKIE['username']){
header ("location: index.php");
}
?>

at the very top, before the <html>
actually try this.

<?
if (!$_COOKIE['username']){
header ("location: index.php");
}

// username is the name of the form input tag
// same as the password name of the input form
if(($_POST['username'] == "") OR ($_POST['password']== "")){
// if empty then we take them to the login page
header ("location: index.php");
} elseif (($_POST['username'] == "your_username") AND ($_POST['password'] == "your_password") OR ($_COOKIE['username'])){
setcookie("username", $_POST['username'], time() + 43200);
?>
<html>

<head>
<title>Tourney Results</title>
<script type="text/javascript">


//Made by A1 JavaScripts - http://www.a1javascripts.com
//Use freely but please keep the credits in place
//Not to be exhibited on any other archive without permission

<!--
function validateform(disney) {
if (
disney.Winner_1.value==""||
disney.Winner_2.value==""||
disney.Runner_Up_1.value==""||
disney.Runner_Up_2.value==""||
disney.email1.value==""||
disney.email2.value==""||
disney.email3.value==""||
disney.email4.value==""||
disney.host.value==""||
disney.date.value==""||
disney.Start_Time.value==""||
disney.Scheduled.value==""||
disney.Format.value==""||
disney.No_of_Teams==""
)
{
window.alert ("Please check and make sure you have everything filled in")
return false;
}
}
//-->
</script>

</head>
<body background="tvbkgnd.gif" bgproperties="fixed">

//the rest of the page here

<p align="center"><strong>NOTE: All fields with <font color="red">*</font> next to it is
required.<br>
</strong><br>
</p>

<form name="disney" method="post" action="contact.php"
onsubmit="return validateform(disney)">
<div align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="50%" valign="top" align="left"><b>Host:</b> <input type="text" name="host"
size="17" style="background-color: rgb(255,0,0); color: rgb(255,255,255)" maxlength="16"> <font
color="red">*</font><br>
<b><br>
Date:</b> <input type="text" name="date" size="9"
style="background-color: rgb(0,0,128); color: rgb(255,255,255)" maxlength="8"> <font
color="red">*</font><b> (Please use the following format 01/01/02)<br>
<br>
Starting Time: <select name="Start_Time" size="1"
style="background-color: rgb(128,0,128); color: rgb(255,255,0)">
<option selected value></option>
<option value="12:00 AM">12:00 AM</option>
<option value="1:00 AM">1:00 AM</option>
<option value="2:00 AM">2:00 AM</option>
<option value="3:00 AM">3:00 AM</option>
<option value="4:00 AM">4:00 AM</option>
<option value="5:00 AM">5:00 AM</option>
<option value="6:00 AM">6:00 AM</option>
<option value="7:00 AM">7:00 AM</option>
<option value="8:00 AM">8:00 AM</option>
<option value="9:00 AM">9:00 AM</option>
<option value="10:00 AM">10:00 AM</option>
<option value="11:00 AM">11:00 AM</option>
<option value="NOON">NOON</option>
<option value="1:00 PM">1:00 PM</option>
<option value="2:00 PM">2:00 PM</option>
<option value="3:00 PM">3:00 PM</option>
<option value="4:00 PM">4:00 PM</option>
<option value="5:00 PM">5:00 PM</option>
<option value="6:00 PM">6:00 PM</option>
<option value="7:00 PM">7:00 PM</option>
<option value="8:00 PM">8:00 PM</option>
<option value="9:00 PM">9:00 PM</option>
<option value="10:00 PM">10:00 PM</option>
<option value="11:00 PM">11:00 PM</option>
</select></b> <font color="red">*</font><b> (Please use zone time "PST")<br>
<br>
Format:</b> <select name="Format" size="1"
style="background-color: rgb(0,0,0); color: rgb(0,255,255)">
<option selected></option>
<option value="5 pt. speed">5 pt. speed</option>
<option value="7 by 2">7 by 2</option>
<option value="Black only">Black only</option>
<option value="Blindman's Bluff">Blindman's Bluff</option>
<option value="Canadian">Canadian</option>
<option value="Cheaters reverse">Cheaters reverse</option>
<option value="Fine Nine Assassins">Fine Nine Assassins</option>
<option value="Front Line Bullet">Front Line Bullet</option>
<option value="Happy To Help">Happy To Help</option>
<option value="Host's Choice">Host's Choice</option>
<option value="Name Your Downfall">Name Your Downfall</option>
<option value="Next">Next</option>
<option value="Queen Of The Night">Queen Of The Night</option>
<option value="Red only">Red only</option>
<option value="Red/Black suicide">Red/Black suicide</option>
<option value="Regular">Regular</option>
<option value="Reverse">Reverse</option>
<option value="Risky Business">Risky Business</option>
<option value="Russian Roulette">Russian Roulette</option>
<option value="Single Suit Only">Single Suit Only</option>
<option value="Sloppy Suicide">Sloppy Suicide</option>
<option value="Solitare">Solitare</option>
<option value="Stage Assassins">Stage Assassins</option>
<option value="Steal The Deal">Steal The Deal</option>
<option value="Strip 9's">Strip 9's</option>
<option value="Suicide">Suicide</option>
<option value="Suicide King's">Suicide King's</option>
<option value="Suited Seat">Suited Seat</option>
<option value="Trump First">Trump First</option>
</select><font color="red">*</font><br>
<b><br>
Number of teams: <input type="text" name="No_of_Teams" size="20"
style="background-color: rgb(0,0,128); color: rgb(192,192,192)"></b><font color="red">*</font><br>
<b><br>
Was this tourney Scheduled? <input type="radio" value="Yes" name="Scheduled"
style="color: rgb(0,0,255)"> Yes <input type="radio" name="Scheduled" value="No"> No</b><font
color="red"> *</font></td>
<td width="50%"><b>Winner 1:</b> <input type="text" name="Winner_1" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email1" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font><br>
<br>
<b>Winner 2:</b> <input type="text" name="Winner_2" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email2" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font><br>
<br>
<b>Runner Up 1:</b> <input type="text" name="Runner_Up_1" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email3" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font><br>
<br>
<b>Runner Up 2:</b> <input type="text" name="Runner_Up_2" size="17"
style="background-color: rgb(0,255,255); color: rgb(0,0,0)" maxlength="16"><font
color="red">*</font><br>
<b>Email:</b> <input type="text" name="email4" size="30"
style="background-color: rgb(0,0,128); color: rgb(255,255,0)"><font color="red">*</font></td>
</tr>
</table>
</center></div><hr color="#FFFFFF" width="95%" size="3">
<div align="center"><center><p><b>Any additional emails (please include username next to
each email ie. jondoe jdoe@hotmail.com):</b><br>
<br>
<textarea name="additional_emails" rows="10" cols="60"
style="font-family: Arial; background-color: rgb(0,0,255); color: rgb(255,255,255); border-left: medium solid rgb(255,255,0); border-right: medium solid rgb(255,255,0); border-top: medium solid rgb(0,255,0); border-bottom: medium solid rgb(0,255,0)"></textarea></p>
</center></div><div align="center"><center><p><input type="submit" value="Send"
style="background-color: rgb(255,255,255); color: rgb(255,0,0); border: medium none"> <input
type="reset" value="Clear"
style="background-color: rgb(255,255,255); color: rgb(255,0,0); border: medium none"></p>
</center></div>
</form>

<p align="center">click <a href="http://zonehosts.com/disney"
style="color: rgb(255,255,0)">here</a> to return to the main page</p>

<hr color="white" width="95%" size="3">
<?
// at the bottom of the page add this

} else {
header("location: index.php");
}
?>
</body>
</html>

you had some more errors because the the header() functions can't go after <html> or anything else that gets outputted to the browser. one of the rules you learn on your journey. :)

huwey
12-19-2002, 11:38 PM
ok cool i seen what the difference was between what you posted and what i had...then i just copied and pasted what you posted....just one thing tho this: //the rest of the page here is showing up on the page...can that be taken out and it work fine still?...thanks for the help scoutt your awsome :D:D

huwey
12-19-2002, 11:41 PM
actually scratch that last post it will work...lol


one question....the ("username", $_POST['username'], time() + 43200) controls how long the cookie stays on the computer right?? so if i only wanted it to stay for say like 2 hours then i would put ("username", $_POST['username'], time() + 7200) right?

leoo24
12-20-2002, 06:45 AM
IGNORE WHAT I'VE JUST WRITTEN I SAW WHEN I POSTED THAT THE SUPER FURRY GURU HAS SORTED IT OUT FOR YOU

LEO





hi again huwey, don't know if you had a look at the link to the php protection but i would give it a go, basically all you need do is download the script, alter a few things like adding in the user name and password, you can also alter a few things in the html( see php is basically the interactive side of web pages, the layout is still in html, so the php files still have html in them which you can alter with no problem)

once you have aletered any html layout in the script and changed the login, all you need do is change your page you want to protect to a php page, ie. instead of protectedpage.html change the extension to protectedpage.php, once you have done that you add a small line of php code into your protected page, you add it in before anything else, even before the doctype!
this is the line of code you will be adding
<? include("protection.php"); ?>
so when someone goes to your protected this little line of php code grabs that person and takes them to a login page, they login with your selected user and password and then is sent back to your protected page.

with the script download is a login page whcih you can change the appearance of how i mentioned before, its not bad actually you could leave it as it is, and then you upload it all to your server.
any questions please ask
leo.

ps here's the link again
http://www.xaviermedia.com/php/cookieprotection.phtml

remember its version 1.0 you want!

leo

huwey
12-20-2002, 07:33 AM
ok i got a question for ya leoo (or anyone else that would know) it's a little off on a tangent but has a little to do with something you mentioned in my contact.php it has this line in it
// This is the message that appears when submitting
echo "Thank You for your tourney results and as always thanks for hosting with us";
can everything between the ""'s be html coding or maybe another addy placed in there and it load that page up?

scoutt
12-20-2002, 08:19 AM
hey Huwey,

yes you can change the time the cookie stays on the computer to 2 hours, and you have it right. also you can take the "// rest of page here " out as I forgot to move that up in to the php section.

also you can change anything you want in the echo statements. just remember that is you add " inside an echo you have to escape them like this \"

so if you add html to an echo line then i twoul dbe like this

echo "<form action=\"somescript.php\" method=\"post\">";

you should get the idea form the that.

huwey
12-20-2002, 09:01 AM
wooooooooooooooooooooooooooohoooooooooooooooooooooooooooooo i got it...........it's all working great now....thanks all :D :rocker: :cool:

scoutt
12-20-2002, 09:10 AM
cool!!