Calling an FTP location in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dalgibbard@gmail.com

    Calling an FTP location in PHP

    This (im hoping) is an easy problem to solve!
    Quite simply, i have a HTML login form, where users can type their
    usernames and passwords for an FTP server of mine.

    The code im using is;

    <?
    //set variables for form values of previous page to make next code
    easier.
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $login = "Location: ftp://{$user}:{$pass} @12.34.5.67/";


    header( "$login" );

    ?>

    User and Pass are boxes on the form before hand, and all works fine-
    however, the page this opens is a list of files that are inside that
    ftp location- instead of a 'folder view' that you usually get with most
    modern versions of windows. You can easily get to the folder view by
    hitting refresh when the file list shows up, but this ideally isnt what
    i want.

    So is there another method of calling that page so that it goes
    straight to folder view? Maybe opening it up in another window would
    work, but how would i do that?

    Any help would be greatfully recieved as ive only really just got into
    PHP :)
    Darren.

  • Janwillem Borleffs

    #2
    Re: Calling an FTP location in PHP

    dalgibbard@gmai l.com wrote:[color=blue]
    > So is there another method of calling that page so that it goes
    > straight to folder view? Maybe opening it up in another window would
    > work, but how would i do that?
    >[/color]

    No, this is something the client should modify on his/her machine by
    changing the folder options. Not PHP related...


    JW


    Comment

    • FingAZ

      #3
      Re: Calling an FTP location in PHP


      Janwillem Borleffs wrote:[color=blue]
      > dalgibbard@gmai l.com wrote:[color=green]
      > > So is there another method of calling that page so that it goes
      > > straight to folder view? Maybe opening it up in another window would
      > > work, but how would i do that?
      > >[/color]
      >
      > No, this is something the client should modify on his/her machine by
      > changing the folder options. Not PHP related...
      >
      >
      > JW[/color]

      Well, at first, it would just load up a "page nopt found error" then
      you hit refresh and it works? Its definately something to do with the
      header function- is there any other functions available to call a page?
      preferably in a new windo or something?

      Darren.

      Comment

      • Markus Ernst

        #4
        Re: Calling an FTP location in PHP

        FingAZ schrieb:[color=blue]
        > Janwillem Borleffs wrote:
        >[color=green]
        >>dalgibbard@gm ail.com wrote:
        >>[color=darkred]
        >>>So is there another method of calling that page so that it goes
        >>>straight to folder view? Maybe opening it up in another window would
        >>>work, but how would i do that?
        >>>[/color]
        >>
        >>No, this is something the client should modify on his/her machine by
        >>changing the folder options. Not PHP related...
        >>
        >>
        >>JW[/color]
        >
        >
        > Well, at first, it would just load up a "page nopt found error" then
        > you hit refresh and it works? Its definately something to do with the
        > header function- is there any other functions available to call a page?
        > preferably in a new windo or something?
        >
        > Darren.
        >[/color]

        Client-side redirect: In the form action attribute call a script, call
        it for example "ftplogin.p hp"; you can use the target attribute in order
        to open a new window.

        ftplogin.php then will be something like:

        <?php
        $url = "ftp://".$_POST['user'].":".$_POST['pass']."@12.34.5.6 7/";
        ?>
        <html>
        <head>
        <meta http-equiv="refresh" content="0; URL=<?php echo $url; ?>">
        </head>
        <body>
        If you are not redirected automatically click
        <a href="<?php echo $url; ?>">here!</a>
        </body>
        </html>

        HTH
        Markus

        Comment

        • FingAZ

          #5
          Re: Calling an FTP location in PHP

          <snip>[color=blue]
          > Client-side redirect: In the form action attribute call a script, call
          > it for example "ftplogin.p hp"; you can use the target attribute in order
          > to open a new window.
          >
          > ftplogin.php then will be something like:
          >
          > <?php
          > $url = "ftp://".$_POST['user'].":".$_POST['pass']."@12.34.5.6 7/";
          > ?>
          > <html>
          > <head>
          > <meta http-equiv="refresh" content="0; URL=<?php echo $url; ?>">
          > </head>
          > <body>
          > If you are not redirected automatically click
          > <a href="<?php echo $url; ?>">here!</a>
          > </body>
          > </html>
          >
          > HTH
          > Markus[/color]

          Argh! It does work- but still just displays the file list and needs for
          the user to hit F5 :(
          I blame micro$uck lol any more ideas?

          Darren.

          Comment

          Working...