Need to create a FTP Custom login

Hi everyone. I would like to know if its possible to make a FTP Login.

I dont want to use the default ftp login like the image that I added in the attachement message. (Please correct me if I’m making mistake in English) Im doing my best.

I would like to know if its possible for an user to put its username and password and then login as FTP. Instead of using the default FTP login that the web browser did.

In bref.

I want to make an user login to an FTP site by using my custom web form.

Please answer me.

Can I be able to receive email each time that A member reply to me?
I would like to know please.

I want to know how to paste an image directly on the post message.

Everyone have a good day.

[attachment deleted by admin]

The login dialog is a browser-defined piece. The FTP site has nothing to do with it, other than grabbing the credentials input into it. If you want to change it, you’ll have to write a wrapper for the FTP site, and host it somewhere. I think you’re better off using an FTP program like smartFTP.

Im a begginer and I know how to login to a FTP site with a FTP client. But I want to make a custom login
for custumer who dont know how to use ftp.

Ok I tell you what Im should do

I should do an Web page that give some information about the compagny . And there should be a
hyperlink that send directly to a login page. In the login page you se a brief description that say to newbie
customer where to put their username and their password into my web form. I want to know if I can manke
a FTP Login or a web form that directly put the username and password. in the ftp site and make you access to your files.

I gave an example:

         <html>
                    <head>
                            <title>Login</title>
                    </head>
                   <body>
                               <form name="loginCustom" method="post" action="ftp://ftp.ftpSiteExemple.com" id="loginCustom">
                                    <input type="text" name="ftpUserName" size="50" MAXLENGTH="50" />
                                    <input type="password" name="ftppassword" size="50" MAXLENGTH="50" />
                                    <input type="submit" id="submitButton" value="Login" />
                                </form>
                    </body>
         </html>
         

I think that should be possible, even with the form you gave in your last post. It’s also possible to include the username and password in the URL.

Yes I get a help from an other phpforum’s user.

Originally Posted by bpat1434
What you have is essentially that. It in theory should work; however, I do know that most FTP servers will allow you to log in with this type of url:
Code:

ftp://username:[email protected]

So for example:

ftp://[email protected]

You would then log in with the credentials of “root”.

One way to achieve this is to use the header() function and send them there on your own:

<?php

if(isset($_POST) && !empty($_POST))
{
    $url = 'ftp://%s:%s@' . $_SERVER['HTTP_HOST'];

    $user = $_POST['ftpUserName'];
    $pass = $_POST['ftppassword'];

    $url = sprintf($url, $user, $pass);  // Replace the %s's with proper values

    header('Location: ' . $url);
}
else
{
    // Show the form:
    echo <<<HTMLFORM
<html>
  <head>
    <title>Login</title>
  </head>
  <body>
    <form name="loginCustom" method="post" action="ftp://ftp.ftpSiteExemple.com" id="loginCustom">
      <input type="text" name="ftpUserName" size="50" MAXLENGTH="50" />
      <input type="password" name="ftppassword" size="50" MAXLENGTH="50" />
      <input type="submit" id="submitButton" value="Login" />
    </form>
  </body>
</html>
HTMLFORM;
}

The problem is when I make on purpose an error . The default ftp login it showed.
Could someone find a way to stop the default login appear?

Everyone have a nice day! :D

I don’t think that’s possible, as it’s browser functionality. You could of course write your own browser software to modify the (FTP) authorization dialog.

Ok I understand . :frowning:

Have you considered NOT using FTP instead using the FILE_UPLOADS methods available in PHP to “Simulate” an FTP. That way you have full control of login and what is presented.

On a failed login, you can redirect back.

If that is not an option perhaps you could check the login credentials manually against the password file and if (and only if) the check passes, do you allow the redirect to the url via the ftp://username:[email protected] method.

Granted this is a more complex way of achieving it, but at least you could achieve it this way. It would also avoid the “Failure” of logging correctly re-directing you to the “Default” login.

Once in, however, it will not preclude users from using the default login method especially if they try to bookmark the page. Using ftp://username:[email protected] will also do a “Re-Direct” of it’s own, after validating the login, to ftp://domain.com/FtpUsersLoginDirectory where FtpUsersLoginDirectory is the default home directory for the username provided.

Thanks for your help. but I dont understand a part of the example that you said to me.

when you said : “If that is not an option perhaps you could check the login credentials manually against the password file and if (and only if) the check passes, do you allow the redirect to the url via the ftp://username:[email protected] method.”

Whats thats mean : “check the login credentials manually against the password file”
Does it mean that I need to know all the passwords from the ftp database and I need to make a request .
To check if the username and password are correct.?

I need to have a litte example please . :smiley:

Ok…

At the time I posted that I was thinking that you might be able to Shell a command to take the submitted password (and username) and compare it against the ftp user passwords that are (on a linux system) often times stored in a text file.

For security they are HASHED so you would have to use the same hashing algorithm with the submitted password and then compare that against what’s in the system.

I am now having issues finding the password file (which I thought I had found when I originally posted it), so that makes it harder for me to provide an example.

I am sorry about that. I will try and keep looking however.

Thanks for your answer.

Im using Windows as operated system.

I just need to make a redirection. Like the header fonctions .

:D
Sponsor our Newsletter | Privacy Policy | Terms of Service