42806

Recording logins for password protected directories

I have a folder in the webroot at http://somesite.com/folder which I'm password protecting with the directory password protection feature in cpanel which I guess uses some form of htacccess. So it's not protected with a normal login system that's connected to a database that I can check against.

Once a correct username and password is entered, a user can see the content of the folder

http://somesite.com/folder/index.php

I'm trying to find a php way to see what account was used to log into the folder. Anyone can think of a way this can be done?

Answer1:

For basic, authentication, you'll have $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'].

For digest, you can parse $_SERVER['PHP_AUTH_DIGEST'] or just look at $_SERVER['PHP_AUTH_USER'] if you want the username (the password won't be available).

Recommend

  • Run script file on remote server
  • Receiver has no segue with identifier“***”
  • Separate ID and Class for JS and CSS
  • (Tcl/Expect) clear screen after exit
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • netsh acl setting (need alternative method - registry settings?)
  • how to set variables in a php include file?
  • Autofac with Web API 2 - Parameter-less constructor error
  • Memory error in python- how to use more memory
  • Laravel: Getting Session ID oddly truncates when using foreach
  • Bypass multiple inheritance in Java
  • How to handle images sent by a mobile device?
  • Django rest serializer Breaks when data exists
  • How to clear text inside text field when radio button is select
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Avoid links criss cross / overlap in d3.js using force layout
  • how to do an event when i swipe from fragment to the other
  • Pass value from viewmodel to script in zk
  • Is there any way to access browser form field suggestions from JavaScript?
  • Splitting given String into two variables - php
  • How do I fake an specific browser client when using Java's Net library?
  • Sony Xperia Z Tablet not found by adb
  • How to get a value (ex: baseURL) in every Karate feature?
  • Check if a string to interpolate provides expected placeholders
  • How to extract text from Word files using C#?
  • How to check if every primary key value is being referenced as foreign key in another table
  • Sending data from AppleScript to FileMaker records
  • Validaiting emails with Net.Mail MailAddress
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • jQuery tmpl and DataLink beta
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • SQL merge duplicate rows and join values that are different
  • Proper way to use connect-multiparty with express.js?
  • Benchmarking RAM performance - UWP and C#
  • Getting error when using KSoap library to consume .NET web services
  • How to set the response of a form post action to a iframe source?
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • How does Linux kernel interrupt the application?
  • How to get NHibernate ISession to cache entity not retrieved by primary key