Jump to content

dave101

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dave101's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok now that is working!! AWESOME!!. Now how woudl i make it show only a directory listing? For example if i had 3 directories under the directory /home/files/uploads/ Thanks!!
  2. Thank you for the help. It seems to bypass the login piece of the script and still display the files with no auth. Also is there a way to only list a certain type of fiels in the directory? Such as only list the files that ahve a pdf extention? This is the script I have so far. <?php session_start(); // Define your username and password $username = "Fileuser"; $password = "test98"; if (!isset($_SESSION['loggedIn'])) { $_SESSION['loggedIn'] = false; } if (isset($_POST['txtUsername']) && isset($_POST['txtPassword'])) { if ($_POST['txtUsername'] === $username && $_POST['txtPassword'] === $password) { $_SESSION['loggedIn'] = true; } } if ($_SESSION['loggedIn']) { // list your files $dir = "."; $dh = opendir($dir); while (($file = readdir($dh)) !== false) { echo "<A HREF=\"$file\">$file</A><BR>\n"; } closedir($dh); //end list files } else { // display the login form ?> <h1>Login</h1> <form name="form" method="post" action="<?php echo $_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 } // end display the login form Thanks!
  3. Basically I am trying to haev a secure webpage that has a listiogn of files that are in the directory but I do not want the files to show up until after the user has authenticated. Thanks!
  4. <?php // Define your username and password $username = "Fileuser"; $password = "test98"; if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { ?> <h1>Login</h1> <form name="form" method="post" action="<?php echo $_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 { ?> <? } ?> <? How can i make thsi call another php file after it has authenticated the user? Thanks! Dave
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.