<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$error='';
if(isset($_REQUEST['btnsubmit']))
{
if(isset($_REQUEST['name'])){if($_REQUEST['name']<>""){$name= $_REQUEST['name'];}
else { $error.="Please Enter Your User Id.....<br>";}}
if(isset($_REQUEST['pass'])){if($_REQUEST['pass']<>""){$pass= $_REQUEST['pass'];}
else { $error.="Please Enter Your Password.....<br>";}}
if($error=='')
{
// set up basic connection
$ftp_server = "IP Address";
$conn_id = ftp_connect($ftp_server);
// login with username and password
$ftp_user_name = "$name";
$ftp_user_pass = "$pass";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_pasv($conn_id, true);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}
}
else
{ echo $error;}
$buff = ftp_nlist($conn_id,".");
print_r($buff);
ftp_close($conn_id);
}
?>
<form name="Login" method="post">
<table width="50%" border="0" align="center">
<tr>
<td colspan="3" bgcolor="#FF9900">
<div align="center"><strong><font color="#FFFFFF" size="6">FTP Login</font></strong></div></td>
</tr>
<tr>
<td width="24%" rowspan="3"><img src="image/Login.gif" width="132" height="100"></td>
<td width="33%" height="62"><p> </p>
<p align="center"><strong><font color="#FF9900">U</font>ser ID</strong></p></td>
<td width="43%"><p> </p>
<p>
<input name="name" type="text" id="name">
</p></td>
</tr>
<tr>
<td height="71"><div align="center"><strong><font color="#FF9900">P</font>assword</strong></div></td>
<td><input name="pass" type="password" id="pass"></td>
</tr>
<tr>
<td height="26"> <div align="right">
<input type="submit" name="btnsubmit" value="Submit" >
</div></td>
<td height="26"><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
</form>
</body>
</html>
Please help
I want to create a login page through php for ftp server linux os.
Through the above code I got access to ftp server but i not able to access the folder because the output coming in array format neither in folder format.
MOD EDIT: Added code tags and split into new topic
This post has been edited by JackOfAllTrades: 17 September 2012 - 02:59 AM

New Topic/Question
Reply



MultiQuote




|