Results 1 to 7 of 7

Thread: PHP password protect, LOTS of pages...

  1. #1
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default PHP password protect, LOTS of pages...

    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 Code:
    <?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:

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

    Then, videos.php:

    PHP Code:
    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]

  2. #2
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    You need some type of storage. Do you have access to SQLite?

  3. #3
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    I'll take whatever you got
    haha

  4. #4
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Try using this for your storage(if webservers don't support MySQL): http://freemysql.net/

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    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?

  7. #7
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •