FTP_login + $pass="" and $user=""

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jissay

    #1

    FTP_login + $pass="" and $user=""

    Hi,

    I use the following scrit in an Intranet with the user name = "" and
    the password = "" :

    <?php
    $ftp_server = "192.168.25.25" ;
    $ftp_user = "";
    $ftp_pass = "";

    $conn_id = ftp_connect($ft p_server) or die("Couldn't connect to
    $ftp_server");

    if (@ftp_login($co nn_id, $ftp_user, $ftp_pass)) {
    echo "Connected at $ftp_user@$ftp_ server\n";
    } else {
    echo "Can't connect with $ftp_user\n";
    }
    ?>

    I have the following message :

    Connected to 192.168.25.25
    Warning: ftp_login(): 'USER': Invalid number of parameters in
    E:\www\test_ftp .php on line 26

    I tried to : ftp_login($conn _id, "", "") but i have the same result...

    Does anybody have an idea ?

    Thank in advance...
  • Agelmar

    #2
    Re: FTP_login + $pass=&quot;&qu ot; and $user=&quot;&qu ot;

    jissay wrote:[color=blue]
    > Hi,
    >
    > I use the following scrit in an Intranet with the user name = "" and
    > the password = "" :
    >
    > <?php
    > $ftp_server = "192.168.25.25" ;
    > $ftp_user = "";
    > $ftp_pass = "";
    >
    > $conn_id = ftp_connect($ft p_server) or die("Couldn't connect to
    > $ftp_server");
    >
    > if (@ftp_login($co nn_id, $ftp_user, $ftp_pass)) {
    > echo "Connected at $ftp_user@$ftp_ server\n";
    > } else {
    > echo "Can't connect with $ftp_user\n";
    > }[color=green]
    >>[/color]
    >
    > I have the following message :
    >
    > Connected to 192.168.25.25
    > Warning: ftp_login(): 'USER': Invalid number of parameters in
    > E:\www\test_ftp .php on line 26
    >
    > I tried to : ftp_login($conn _id, "", "") but i have the same result...
    >
    > Does anybody have an idea ?
    >
    > Thank in advance...[/color]

    You can't have a blank username. Are you trying to use Anonymous FTP? If so,
    set the username to Anonymous, and the password to an email address...


    Comment

    • CountScubula

      #3
      Re: FTP_login + $pass=&quot;&qu ot; and $user=&quot;&qu ot;

      "jissay" <jc.calviera@la poste.net> wrote in message
      news:4fd7d5a7.0 312300736.fc1ae 11@posting.goog le.com...[color=blue]
      > <?php
      > $ftp_server = "192.168.25.25" ;
      > $ftp_user = "";
      > $ftp_pass = "";
      >
      > $conn_id = ftp_connect($ft p_server) or die("Couldn't connect to
      > $ftp_server");
      >
      > if (@ftp_login($co nn_id, $ftp_user, $ftp_pass)) {
      > echo "Connected at $ftp_user@$ftp_ server\n";
      > } else {
      > echo "Can't connect with $ftp_user\n";
      > }
      > ?>[/color]

      Intranet? I assume this is all local? even the ftp server (i did see the
      local ip)

      in that case why bother with ftp if you controll the intranet? just set up a
      trusted user key for your script and do this:

      to send files
      <?
      $fileSpec = "/somedir/myfile.txt"; // or $fileSpec =
      "/somedir/tx_files/*";
      $dest = "/somedir/";
      `scp $fileSpec trusteduser@192 .168.25.25:$des t`;
      ?>

      to recieve files
      <?
      $fileSpec = "/somedir/myfile.txt"; // or $fileSpec =
      "/somedir/tx_files/*";
      $dest = "/somedir/";
      `scp trusteduser@192 .168.25.25:$fil eSpec $dest`;
      ?>

      or even simpler, just map one of the ftp servers directories into your
      webserves directories,
      so it wouyld be like this

      on webserver
      /www/somesite/filearea

      would actualy be a directory on the ftp server
      /ftpfiles/shared/filearea



      --
      Mike Bradley
      http://gzen.myhq.info -- free online php tools




      Comment

      Working...