Can i get an automatic email every time someone logs in to password protected directory? - cpanel

I have a VPS server with WHM and cpanel.
We have a few password protected directories(defined in cpanel). We wish that whenever a user logs in to one of them, we will get an instant email.
Possible?
Thanks

Well, you could use the mail() function in PHP on your index.php. Other than that, it isn't possible unfortunately.

Related

How to give phpmyadmin access through the webmail in cpanel?

I added the user from user management but I don't know what to do further how to check?
I am expecting to user don't access public html folder.
User will be able to access the public html folder, if they are accessing it through cPanel. Unfortunately, there is no way around this as phpMyAdmin is secured with cPanel authentication.
However, you could install your own phpMyAdmin on your domain and provide access through it. You can find more information about how to do it here.

How to find cpanel server url name to use for a XMLHttp Post request

I am new to servers and Cpanel. I am building a chrome extension where I have to upload html files to my server, but am unsure as to what the url should be when doing an XMLHttpRequest().If I just type in the name of my website which Cpanel hosts, including the username and password, would that work?
I think what you are looking for is to use the cPanel/WHM API version 1 or 2.
This link should provide you more details on how to use cPanel API, specifically for uploading files:
https://documentation.cpanel.net/display/SDK/cPanel+API+2+Functions+-+Fileman%3A%3Auploadfiles
Could you Please explain in few more words?
I think you are asking
Can i upload files to cpanel! just by url and cpanel username and password ? by using the XMLHttpRequest() ex : from the extension?
If yes.
For private use you can Use PHP FTP classes to run in host
like example.com/myownftp/
or
Cpanel ftp example.com:port for ftp : username and password
Or You can Achieve it by making a script to upload the files to your hosting server its Simple.. PHP is great to do.
I would like to know whether i replied to Your question?

How does apache match authentication/authorization information with subsequent http requests from same user?

When you protect an area of your document root using either the server configuration or .htaccess, the server prompts for a username and password when someone requests those files from a browser. If the password matches the one from the authentication provider for that user, the documentation at http://httpd.apache.org/docs/2.2/howto/auth.html says that apache will set environment variables for that user. In my case I'm building a php app, and using phpinfo() I gather that the environment variables set are are REDIRECT_AUTHENTICATE_SAMACCOUNTNAME, AUTHENTICATE_SAMACCOUNTNAME (Using active directory as authentication provider), and REMOTE_USER. I believe this is what prevents the user from being prompted again and again on each subsequent request.
What I don't understand is how apache matches requests from a user with the environment variables set for that user, and also when and how it knows how to clear those variables. I doesn't appear to use cookies, because I cleared all the cookies for the domain in question, and still it doesn't ask me to reauthenticate unless I actually close the browser.
Ultimately I'm going to be working with php to get the userid and to maintain state, but since php is getting the information from the apache information, I'd like to know about that context, and I don't seem to be able to find these details. Thanks in advance.
Look at the http headers your browser is sending. After you have supplied a username and password, your browser will continue sending those details to that site until your browser session ends, or longer if you tell your browser to remember the credentials.

How to use .htaccess to log ips?

I've got a directory I'm protecting with .htaccess and .htpassword but I think some people have shared the access username and password, which is against my terms. The other possibility is that they are using bruteforce. How can I use .htaccess to log the IP addresses of the people who try to access my protected directory, for both accurate and failed logins?
That is beyond the scope of .htaccess. You will need to modify your webservers configuration if it doesn't log failed logins already. (Hint: Those can be identified by the 401 response code)

Cross domain authentication - Passing User Info

this is my first post,
I'm working on a project that required me to buy another domain. But i want it to use the same authentication system as my current domain and and also login the user into both sites.
I already found a great post whate it explains what needs to happen here: See the first comment
But I want to make it possible for the user to login on domain1.com (by entering credentials) and i want the credentials to be taken from domain1.com to maindomain.com and authenticate it.
Now, i know its not safe to send the users info unprotected, but i am not sure exactly how to do it any other way.
Do you have any suggestions to how i may send the login info or authenticate the users.
NOTE:
Both sites are on the Same server and one is in a subdirectory of the other (in the file tree) but they have two separate domains so i cant just tell it to POST the info to /login, instead i would have to send it to which would not work with POST.
Any and all help is appreciated!
Thanks in advance!
When the user logs in on server1, you could include something like this in the HTML:
<img src="http://server2/login/?hash=...">
(put a 1*1 transparent gif there or so)
The server should reply with a header that sets the session id.
If you are using cookie based sessions, the easiest way is to set additional copy of session cookie using iframe after successful login.