Jump to content

net2ftp integration


jeremyhaber

Recommended Posts

Hey Guys;

 

Here is a very quick net2ftp integration I built. Feel free to use it as you please.

 

This will use your header and footer in the FTP program. The generic layouts they have will be loaded into your site. You may have to play a bit with ftp.tpl file to get to look really good on your site.

 

Create the folder: /includes/net2ftp

Upload the net2ftp application to: /includes/net2ftp/

The files to upload will be located in a folder "files_to_upload".

 

After you have uploaded the files you can setup the settings for the application in "/includes/net2ftp/settings.inc.php"

 

You can use your WHMCS database if you wish to log all the ftp transactions through webftp. To do this changing these variables (located in "/includes/net2ftp/settings.inc.php"):

$net2ftp_settings["dbusername"] = "";
$net2ftp_settings["dbpassword"] = "";
$net2ftp_settings["dbname"]     = "";
$net2ftp_settings["dbserver"]   = "localhost"; // on many configurations, this is "localhost"

To:

$net2ftp_settings["dbusername"] = $db_username;
$net2ftp_settings["dbpassword"] = $db_username;
$net2ftp_settings["dbname"]     = $db_name;
$net2ftp_settings["dbserver"]   = $db_host; // on many configurations, this is "localhost"

Should do the trick.

 

Home directory: ftp.php

<?php

define("CLIENTAREA",true);
define("FORCESSL",true);

require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");

$pagetitle = $_LANG['clientareatitle'];
$breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a>';
$breadcrumbnav .= ' > <a href="ftp.php">FTP</a>'; 

initialiseClientArea($pagetitle,'',$breadcrumbnav);

if ($_SESSION['uid']) {

// ------------------------------------------------------------------------
// 1. Define the constants NET2FTP_APPLICATION_ROOTDIR and NET2FTP_APPLICATION_ROOTDIR_URL
// ------------------------------------------------------------------------
define("NET2FTP_APPLICATION_ROOTDIR", dirname(__FILE__)."/includes/net2ftp/");
if     (isset($_SERVER["SCRIPT_NAME"]) == true) { define("NET2FTP_APPLICATION_ROOTDIR_URL", dirname($_SERVER["SCRIPT_NAME"])."includes/net2ftp"); }
elseif (isset($_SERVER["PHP_SELF"]) == true)    { define("NET2FTP_APPLICATION_ROOTDIR_URL", dirname($_SERVER["PHP_SELF"])."includes/net2ftp"); }

// ------------------------------------------------------------------------
// 2. Include the file /path/to/net2ftp/main.inc.php
// ------------------------------------------------------------------------
require_once("includes/net2ftp/main.inc.php");

// ------------------------------------------------------------------------
// 3. Execute net2ftp($action). Note that net2ftp("sendHttpHeaders") MUST 
//    be called once before the other net2ftp() calls!
// ------------------------------------------------------------------------
net2ftp("sendHttpHeaders");
if ($net2ftp_result["success"] == false) {
	require_once("./skins/mobile/error_wrapped.template.php");
	exit();
}

$smartyvalues["net2ftp_globals"] = $net2ftp_globals;
$smartyvalues["net2ftp_result"] = $net2ftp_result;

$templatefile = "ftp"; 

outputClientArea($templatefile);

} else {
header("location: login.php?goto=ftp.php");
}
?>

 

Template directory: ftp.tpl

<script type="text/javascript">
{php}net2ftp("printBodyOnload");{/php}
</script>
<div style="display: block; margin: 0 auto;">
   {php}
   net2ftp("printJavascript");
   net2ftp("printCss");
   net2ftp("printBody");
   if ($this->_tpl_vars['net2ftp_result']["success"] == false) {
       require_once($this->_tpl_vars['net2ftp_globals']["application_rootdir"] . "/skins/" . $this->_tpl_vars['net2ftp_globals']["skin"] . "/error.template.php");
   }
   {/php}
   <div style="clear:both;"></div>
</div>

 

Hope this helps.

 

- Enjoy :D

Please note this is not officially supported by me or any other member of WHMCS Addon. We will do our best to help you in this thread.

By no means is this script one of our official addons as we have no intent to keeping it updated.

For more support you can visit net2ftp's official forum.

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated