Password protected directory login form?

senators24

Member
Aug 11, 2010
5
0
51
Hey guys, I'm building an iPhone app, and within the view, it does not allow popups, so when one of my users go to my domain, instead of the popup coming up asking them to login, they get a white page.

Been searching and can't find a fix. I know a login form on an html page of some sort would work. Don't know how I would go about making one though.

So pretty much, I want the popup login to not be a popup, and on a static page. Any help would be much appreciated!
 

senators24

Member
Aug 11, 2010
5
0
51
Hey guys, I'm building an iPhone app, and within the view, it does not allow popups, so when one of my users go to my domain, instead of the popup coming up asking them to login, they get a white page.

Been searching and can't find a fix. I know a login form on an html page of some sort would work. Don't know how I would go about making one though.

So pretty much, I want the popup login to not be a popup, and on a static page. Any help would be much appreciated!
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
13
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
Hey guys, I'm building an iPhone app, and within the view, it does not allow popups, so when one of my users go to my domain, instead of the popup coming up asking them to login, they get a white page.

Been searching and can't find a fix. I know a login form on an html page of some sort would work. Don't know how I would go about making one though.

So pretty much, I want the popup login to not be a popup, and on a static page. Any help would be much appreciated!
You may use any mechanism that can handle HTTP authentication; this is what is used by password protected directories in Apache/httpd (via .htaccess files).
 
Last edited:

senators24

Member
Aug 11, 2010
5
0
51
Thanks :) Would you happen to have an example of some sort? I'm new to PHP, one of my buddies gave me this to try, but does not work..

PHP:
<?php
$user = $_POST['myusername'];
$pass = $_POST['mypassword'];  
if ( $user != '' ) {
header('Location: http://$user:[email protected]');
}
else
{
echo "";
}
?>
HTML:
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="login.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login</strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
 

ArgoSys

Registered
Sep 23, 2010
1
0
51
Any update on this?

I'd like to do the same thing.

I created a password protected directory in cPanel called "Files" and created the user and pass to go along with it.

I'd like to have it where I send the link "www.website.com/login.php" to my firends. On that page I'd like it to have a form where they type in their username and password. When they click submit I'd like them to be directed to the password protected directory "Files" (assuming user & pass are correct) WITHOUT the Firefox/IE pop-up authentication box showing up. I want to bypass that.

Any help would be appreciated. Thanks.
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
13
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
Please see the official PHP documentation regarding HTTP Authentication: PHP: HTTP authentication with PHP - Manual

Per the documentation, using HTTP authentication with PHP requires that your Apache PHP request handler must be set to Apache DSO (and not CGI or suPHP). However, if you are already using suPHP I would consider the inherent security risk of switching the PHP handler to Apache DSO because PHP scripts will then run as the anonymous system user "nobody" instead of running as the user of each Apache virtual host.

WebHost Manager (WHM) can be used to switch the PHP handler via the following menu path: WHM: Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration

Switching the PHP handler can also be accomplished via root SSH access using the following command-line script: Configuring PHP and suEXEC from the Command Line
Code:
# /usr/local/cpanel/bin/rebuild_phpconf --help
Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available] <Default PHP> <PHP4 Handler> <PHP5 Handler> <Suexec>
 --dryrun       : Only display the changes that would be made
 --no-restart   : Don't restart Apache after updating the php.conf link
 --no-htaccess  : Don't update user configurable PHP mime mapping.
 --current      : Show current settings
 --available    : Show available handlers and PHP SAPIs
 <Default PHP>  : Version of PHP to set as default handler for .php files
 <PHP# Handler> : Type of Apache module to use in serving PHP requests
 <Suexec>       : enabled, disabled, 1 or 0
 

Infopro

Well-Known Member
May 20, 2003
17,076
523
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
Hey guys, I'm building an iPhone app, and within the view, it does not allow popups, so when one of my users go to my domain, instead of the popup coming up asking them to login, they get a white page.
This sounds like a problem with your app code. htaccess popups do work on iPhone.

Been searching and can't find a fix. I know a login form on an html page of some sort would work. Don't know how I would go about making one though.

So pretty much, I want the popup login to not be a popup, and on a static page. Any help would be much appreciated!


Any update on this?

I'd like to do the same thing.

I created a password protected directory in cPanel called "Files" and created the user and pass to go along with it.

I'd like to have it where I send the link "www.website.com/login.php" to my firends. On that page I'd like it to have a form where they type in their username and password. When they click submit I'd like them to be directed to the password protected directory "Files" (assuming user & pass are correct) WITHOUT the Firefox/IE pop-up authentication box showing up. I want to bypass that.

Any help would be appreciated. Thanks.


I'm curious what these two needs have to do with cPanel?

Please forgive me here, but wouldn't you both have more luck on a custom coding forum of some sort for iPhone apps and websites?

These may be development posts but nothing to do with cPanel itself other than using htaccess as a part of your code(s).

iOS Dev Center - Apple Developer
.htaccess tricks and tips.. part one: tips, tricks, hints, examples; juicy .htaccess information.

Not sure how helpful those links are, but surely there's more there than on the cPanel Developer discussion forums.