The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Password protected directory login form?

Discussion in 'cPanel Developers' started by senators24, Aug 11, 2010.

  1. senators24

    senators24 Member

    Joined:
    Aug 11, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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!
     
  2. senators24

    senators24 Member

    Joined:
    Aug 11, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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!
     
  3. senators24

    senators24 Member

    Joined:
    Aug 11, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
  4. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    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).
     
    #4 cPanelDon, Aug 11, 2010
    Last edited: Aug 11, 2010
  5. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Friendly Moderator Note

    I have relocated this thread into the Developer Discussions forums area so it may receive more relevant attention and visibility.
     
  6. senators24

    senators24 Member

    Joined:
    Aug 11, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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:$pass@movies.idevcreations.com');
    }
    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>
     
  7. senators24

    senators24 Member

    Joined:
    Aug 11, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Here is an example of what I need.

    Code:
    http://thebigu.info/main.php
     
  8. ArgoSys

    ArgoSys Registered

    Joined:
    Sep 23, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  9. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    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
     
  10. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,468
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This sounds like a problem with your app code. htaccess popups do work on iPhone.





    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.
     
Loading...

Share This Page