Jump to content


Customized FTP Login

  • Please log in to reply
2 replies to this topic

#1 jesse_pinuelas_jr

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 09 May 2006 - 04:36 PM

Hello everyone I have been successful at adding users to my database and table with php but when I try to log in I get an error message. I am trying to build the the URL or FTP address with variables can anyone help!!

//////// error message //////////

Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/loraxbiz/public_html/do_authuser.php on line 32
Couldn't connect to [a href=\"ftp://lorax.biz\" target=\"_blank\"]ftp://lorax.biz[/a]

//////// end of error message //////////

// jesse check for required fields 
if ((!$_POST[username]) || (!$_POST[password])) {
// jesse note to self, set up names of databases and table to use
$db_name ="loraxbiz_authuser";
$table_name = "clients";

//now connect to server and select database
$connection = @mysql_connect("localhost", "private", "privatee")
    or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());

//build and issue the query
$sql = "SELECT * FROM $table_name WHERE username ='$_POST[usernname]'
AND password = password('$_POST[password]')";
$result = @mysql_query($sql,$connection) or die(mysql_error());

// get the number of rows in the result set
$num = mysql_num_rows($result);

// print message or redirect elsewhere, based on result set
if ($num != 0) {
    $msg = "<p> Welcome to LORAX Environmental,Inc</p>";
} else {
    // try to log in to freaking ftp
    $ftp_server = "ftp://lorax.biz";
    $ftp_user = '$_POST[usernname]';
    $ftp_pass = '$_POST[password]';
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
   echo "Connected as $ftp_user@$ftp_server\n";
} else {
   echo "Couldn't connect as $ftp_user\n";

#2 johnwayne77

  • Members
  • PipPipPip
  • Advanced Member
  • 156 posts

Posted 03 February 2007 - 06:00 PM

you have a mistake in your script:

$ftp_server = "ftp://lorax.biz";  <-- wrong

replace with

$ftp_server = "lorax.biz";  <-- or ftp.lorax.biz or whatever is your ftp host (just don't add the 'ftp://' which is used for direct browsing
what you do in life, echoes in eternity

#3 NoDoze

  • Members
  • PipPipPip
  • Advanced Member
  • 199 posts

Posted 19 June 2007 - 09:56 PM

I tried this script above with the MySQL database setup with my user login and password info, but when logging in I get:
Couldn't connect as $_POST[usernname]

Any ideas?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users