Log in

View Full Version : PHP password protect, LOTS of pages...



alexjewell
08-08-2006, 04:15 PM
I'm doing some freelance work for a photography studio.
They're doing the senior portraits for a couple schools in the are.
They had a cool idea. They wanted to put together slideshows of every student to put online.
The problem, however, is they want them password protected.
EVERY ONE of them.

So, I did some playing around.
This is what I came up with:



<?php

$username = "someuser";
$password = "somepassword";

if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {

?>

<h1>Login</h1>

<form name="form" method="post" action="<?=$_SERVER['PHP_SELF']; ?>">
<p><label for="txtUsername">Username:</label>
<br /><input type="text" title="Enter your Username" name="txtUsername" /></p>

<p><label for="txtpassword">Password:</label>
<br /><input type="password" title="Enter your password" name="txtPassword" /></p>

<p><input type="submit" name="Submit" value="Login" /></p>

</form>

<?php

}
else {

?>

<p>This is the protected page. Your private content goes here.</p>

<?php

}

?>


now, for each video, I have the page set up as so:

index.php has this:



if(@$_GET['name']) {
$name = $_GET['name'];
include('videos.php');}
else{
//index.php html
}


Then, videos.php:



if ( $name == "whatever") { //video for whatever }

elseif ( $name == "whoever") { //video for whoever }


etc, etc, etc.

now, I want each of these videos password protected.
I really DO NOT want to use the above script for over 300 some people!
Any ideas on how to do this?
[without .htaccess? I'm also not sure id msql is supported on their server, either]

blm126
08-08-2006, 08:27 PM
You need some type of storage. Do you have access to SQLite?

alexjewell
08-08-2006, 08:56 PM
I'll take whatever you got
haha

shachi
08-08-2006, 09:30 PM
Try using this for your storage(if webservers don't support MySQL): http://freemysql.net/

Twey
08-08-2006, 10:44 PM
Check out http://www.twey.co.uk/?q=loginscript.

alexjewell
08-08-2006, 11:16 PM
Wow, Twey, you're like...brilliant.
But your script is just way more than I need.
I don't need a register thing.
And the script is just too complicated for what I need.

All I need is for when someone logs in, for it to go to their own personal video page.
And if someone isn't logged in, for them not to see any video.
And for when they are logged in, to only see THEIR video.
You get what I'm saying?

alexjewell
08-09-2006, 12:08 AM
Thanks guys for all your input.
If you have any more, PLEASE post it.
But because of time constraints, I'm going to go with my original code. Thanks again.