1.

Solve : Putting FTP and SSH clients into website?

Answer»

Hello to all. This is not my first time in web design by far, but first time trying anything besides my normal HTML, CSS and a small bit of Javascript

My FTP server is on port 22, instead of the standard 21, and my current code, which i FOUND open source  here: http://www.codeproject.com/Articles/5861/A-Simple-FTP-Solution

So, this is the code for the HTML

Code: [Select]<!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=utf-8" />
<title>NightBlade MC</title>
<style type="text/css">
<!--
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: url(img/back.jpg);
background-attachment: fixed;
margin: 0;
padding: 0;
color: #000;
}

ul, ol, dl {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
padding-right: 15px;
padding-left: 15px;
}
a img {
border: none;
}

a:link {
color:#0FF;
text-decoration: underline;
}
a:visited {
color: #0FF;
text-decoration: underline;
}
a:hover, a:active, a:focus {
text-decoration: none;
}

.container {
width: 80%;
max-width: 1260px;
min-width: 780px;
color: #ffffff;
margin: 0 AUTO;
}

.header {
}

.navi {
width: 80%;
max-width: 12600px;
min-width: 780px;
}

*/
.content {
padding: 10px 0
}
.content ul, .content ol {
padding: 0 15px 15px 40px;
}
.footer {
padding: 10px 0;
background: #550000;
color: #ffffff;
}
.fltrt {
float: right;
margin-left: 8px;
}
.fltlft {
float: left;
margin-right: 8px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}

-->
</style>
<script language="'javascript'" src='ftp.js'></script>
</head>

<body>

<div class="container">
  <div class="header"><img src="img/Banner2.gif" width="800" height="80" />
    <!-- end .header --></div>
  <div class="content">
  <div class="navi">
<table width="100%" border="0">
  <tr>
    <td width="33.3%"><center> <a href="index.html"> Home </a></center></td>
    <td width="33.3%">
    <p>
  <script type="text/javascript"
src="java/photo.js"></script>
                        <center><a href="javascript:void(viewer.show(0))"> Pictures </a></center></p>
  <script type="text/javascript">
<!--
var viewer = new PhotoViewer();
viewer.add('img/slideshow2.png');
viewer.add('img/slideshow3.png');
viewer.add('img/slideshow4.png');
viewer.add('img/slideshow5.png');
viewer.add('img/slideshow6.png');
viewer.add('img/slideshow7.png');
viewer.add('img/slideshow8.png');
viewer.add('img/slideshow9.png');
//--></script></td>
    <td width="33.3%"><center> <a href="rules.html"> Rules </a> </center></td>

  </tr>
</table>
</div>
<h1> Welcome Server Admin!!!! </h1>
<h3> FTP </h3>
    <p><table border='0' cellpadding='0' cellspacing='1' align='center' width='98%'><form name=login>
        <tr><td class='brgtcell' align='right'>&nbsp;Username&nbsp;</td>
        <td class='darkcell'>&nbsp;<input type='text' name='username' value='administrator' size='20' maxlength='20'>&nbsp;&nbsp;</td></tr>
        <tr><td class='brgtcell' align='right'>&nbsp;Password&nbsp;</td>
        <td class='darkcell'>&nbsp;<input type='text' name='password' value='&nbsp;' size='20' maxlength='20'>&nbsp;&nbsp;</td></tr>
        <tr><td class='brgtcell' align='right'>&nbsp;Server&nbsp;</td>
        <td class='darkcell'>&nbsp;<input type='text' name='server' value='67.190.22.207' size='60' maxlength='120'>&nbsp;&nbsp;</td></tr>
        <tr><td class='brgtcell' align='right'>&nbsp;Local&nbsp;</td>
        <td class='darkcell'>&nbsp;<input type='text' name='local' value='/' size='60' maxlength='200'>&nbsp;&nbsp;</td></tr>
    </table>
    <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>
    <td align='left'><input style='color:#000000' type='button' value='Connect' onClick='Login(this.form)'></td>
    </tr></form></table>
</div>
  <div class="footer">
    <p>Site created for NightBladeMC server by Jared Kat AKA Eric Robinson. &copy; 2012. All rights reserved</p>
    <!-- end .footer --></div>
  <!-- end .container --></div>
  </div>
</body>
</html>

I will be doing later orginization in the website directory to sort the java files, as later i will be adding a login script to get to that page (help with that is also apreciated)

I have not yet found any code for the SSH client yet. Im trying to make this so that administrators to the server i host for gaming, can log directly into the server, edit properties files, ext.

I will appreciate all help.

With the SSH client, a link to another site is fine. Thanks. Also, i will post the javascript code

Code: [Select]function Login(form) {
    var username = form.username.value;
    var password = form.password.value;
    var server = form.server.value;
    var local = form.local.value;
    if (username && password && server && local) {
            window.open(local, '_blank', 'toolbar=yes,location=yes,status=yes,scrollbars=auto,copyhistory=no,menubar=no,width=' + ((screen.AvailWidth/2)-12) + ',height=' + (screen.AvailHeight-124) +',left=0,top=0,resizable=yes');
            window.open("ftp://" + username + ":" + password + "" + server, '_blank', 'toolbar=yes,location=yes,status=yes,scrollbars=auto,copyhistory=no,menubar=no,width=' + ((screen.AvailWidth/2)-12) + ',height=' + (screen.AvailHeight-124) +',left=' + ((screen.AvailWidth/2)) + '),top=0,resizable=yes');
            }
        else {
            alert("NO BLANK FIELDS!");
            }
    }

If you're just wanting to do file management I don't believe trying to do an SSH or FTP client on the server is the best approach. You should only need to have a file manager on the server that would allow other sot modify files. Try ajaxplorer, which imo is one of the better ones available.

http://ajaxplorer.info/Thank you very much for sharing that resource. I do appreciate it. I will need to try it out.  SSH is a real PITA to script.  You probably need to use a Java SSH module.  They come with certainly technological limitations, due to Java's security model.  Personally I would leave users to connect via a proper SSH client like PUTTY or TeraTerm, etc.  Similarly with FTP, if you REALLY want to give FTP access, a client like Cyberduck or FileZilla is a much better option.

Alternatively if what you need is content management with granular access permissions, look into the various CMS systems that are out there (Drupal, Joomla, Wordpress, etc.).



Discussion

No Comment Found