Location: PHPKode > projects > WWW-Admin > wwwadmin-0.1lt/ftpd.php
<?
	session_start();
	error_reporting ( 1 );
?>

<html>


<body>
<title>WWW-Admin v0.1.0 : FTP</title>
<body bgcolor="#000000" style="font-family:times;color:white;">

<?php

if( (!empty($_POST['ftp_user']))&&(!empty($_POST['ftp_pass']))&&(!empty($_POST['ftp_serv'])) )
{
 	$_SESSION[fuser] = $_POST['ftp_user'];
 	$_SESSION[fpass] = $_POST['ftp_pass'];
 	$_SESSION[fserv] = $_POST['ftp_serv'];
	if(!empty($_POST['ftp_port']))
	{
 		$_SESSION[fport] = $_POST['ftp_port'];
 	}
	else
	{
		$_SESSION[fport] = 21;
	}
	$com = $_POST['ftp_com'];
}

$cuser=$_SESSION[fuser];
$cpass=$_SESSION[fpass];
$cserv=$_SESSION[fserv];
$cport=$_SESSION[fport];
$com = $_POST['ftp_com'];


echo "<h4>FTP klientas:</h4>";

if ($_POST['close'] != 1)
{
	if(!empty($_SESSION[fuser]))
	{

 		if($connection = ftp_connect($cserv, $cport, 10))
 		{

		 	if(isset($com)){ftp_raw($connection,$com);}
 		 	$connection = ftp_connect($cserv, $cport, 10);
 		 	if(ftp_login($connection, $cuser, $cpass) == true) 
 		 	{ 
				if(!ftp_raw($connection, $com))
				{
					echo"<br>Klaida vykdant komanda {$com}!";
				}
				else
				{
					ftp_raw($connection, $com);
				}	
 
  		  		echo "Prisijungeme kaip {$cuser}@{$cserv}<br>";
				echo "Sistema : ".ftp_systype($connection)."<br><br>";

	   			$dir = ftp_pwd($connection);
 		  		echo "Esama direktorija : {$dir}<br><br>";

 		  		$mas = ftp_nlist($connection, ".");
				$rawmas = ftp_rawlist($connection, ".");
				$i = 0;
 		  		foreach($mas as $file)
 		  		{
					@$size = ftp_size($connection,$file);
					?>
			 		<table border="1">  
					<?	
						$st = str_split($rawmas[$i]);
						if(($st[0] != "d") && ($st[25] != "D"))
						{
							if($size < 5000)
							{	
								ftp_get($connection,".\\tmp\\{$file}",$file,FTP_BINARY);
							}
							$param = ".\\tmp\\{$file}";
 			 				echo "<tr><td>{$file} </td><td><a href=red.php?ofile={$param}>REDAGUOTI</a> </td></tr>";
						}
						else
						{
							$pwd = ftp_pwd($connection);
							echo $pwd; 
							echo "{$file}";
						}
						$i++;				
					?>
					</font>
					</table>
					<?
 		  		}
				?>
				<br>
				Vykdyti komanda:
				<br>

				<form method="POST" action="ftpd.php">
				<input type="text" name="ftp_com" value=""><br>
				<input type="submit" value="Vykdyti"><br><br>
				</form>
				<?

			
 	 		}
 			else 
  			{
  			 	echo "Negalima prisijungti {$cuser} vardu<br>";
 			}

 		}
 		else
 		{
 		 	echo "Negalima prisijungti prie {$cserv}";
 		}

	}

 
	else
	{
		echo "Iveskite susijungimo duomenis!";
	}
}

else
{
	ftp_close($connection);
	$path = getcwd()."\\";
	chdir("$path"."tmp");
	$dirlist = opendir($path."tmp");
	
        while ($file = readdir($dirlist))
        {
            	if(($file != '.') && ($file != '..'))
            	{
                	    $newpath = $path.$file;
                	    if (!is_dir($newpath))
                        {   
				            				unlink($file);
                        }
                }
        }
}

echo "<form method = POST action = ftpd.php>";
echo "<input type = hidden name = close value = 1>";
echo "<input type = submit name = butt value = Atsijungti>";

echo "<br>";
echo "<a href=sql_login.php>SQL Klientas</a>"."<br>";
echo "<a href=port.php>Informacijos rinkejas</a>"."<br>";
echo "<a href=Index.php>Atgal i prisijungimo langa.</a>"."<br>";

?>


</body>
</html>
Return current item: WWW-Admin