Database integration with phpBB3

Please post here if you have problems in using Wing FTP Server.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Database integration with phpBB3

Post by FTP »

The modified PHP code will like this:

Code: Select all

//Wing FTP Server MOD start
$ftp_dbname = "wftp_database";                //Wing FTP Server's mysql database name, assume in the same server.
$ftp_domain_name = "default";                 //ftp's domain name.
$ftp_dirpath = "D:/ftp_data/".$data['username'];//user's directory path
$ftp_upload_limit = TRUE;                     //whether to limit the quota size
$ftp_maxuoload_size = 1024*1024*100;          //if $ftp_upload_limit = TRUE, this value means the max quota bytes.
$db->sql_query("USE ".$ftp_dbname.";");

$db->sql_query("INSERT INTO `wftp_mysqltable_user` VALUES ('".$ftp_domain_name."','".$data['username']."',1,1,'".md5($data['new_password'])."',63,0,NULL,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0,0,0,'0',NULL,0,0,0,".intval($ftp_upload_limit).",0,".$ftp_maxuoload_size.",0,0,0,'');");

$mkdir_result = @mkdir($ftp_dirpath);
if($mkdir_result == TRUE)
   $db->sql_query("INSERT INTO `wftp_mysqltable_dir` VALUES ('".$ftp_domain_name."','".$data['username']."','".$ftp_dirpath."','/',1,1,1,1,1,1,1,1,1,1,1,1);");

$db->sql_query("USE ".$db->dbname.";");
//Wing FTP Server end

I think the above code is OK, please make sure there exists database "wftp_database" in the same DB server. And the folder "D:/ftp_data/" already exists.
chaosnature
Posts: 16
Joined: Thu Sep 09, 2010 1:32 am

Re: Database integration with phpBB3

Post by chaosnature »

I think there was miss communication,

the issue is still not resolved,i am still not able to get the database to populate the ftp server from the phpBB3 yet with that code even though we have db Connectivity to the wingftp DB,

can you look into it for me please..

thanks in advance.....
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Database integration with phpBB3

Post by FTP »

We have tested this PHP script, no problem on our side.

Do you have any PHP programing experience? So please save the below code as "sqltest.php", and put it on your server side, then execute it, check its result. (please change parameters of mysql_connect() by yourself)

Code: Select all

<?php

//Wing FTP Server MOD start
$ftp_dbname = "wftp_database";                //Wing FTP Server's mysql database name, assume in the same server.
$ftp_domain_name = "default";                 //ftp's domain name.
$ftp_dirpath = "D:/ftp_data/test111";		  //user's directory path
$ftp_upload_limit = TRUE;                     //whether to limit the quota size
$ftp_maxuoload_size = 1024*1024*100;          //if $ftp_upload_limit = TRUE, this value means the max quota bytes.
mysql_connect("localhost", "USER","PASS");
mysql_select_db($ftp_dbname);
mysql_query("INSERT INTO `wftp_mysqltable_user` VALUES ('".$ftp_domain_name."','test111',1,1,'".md5("123")."',63,0,NULL,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0,0,0,'0',NULL,0,0,0,".intval($ftp_upload_limit).",0,".$ftp_maxuoload_size.",0,0,0,'');");
mysql_query("INSERT INTO `wftp_mysqltable_dir` VALUES ('".$ftp_domain_name."','test111','".$ftp_dirpath."','/',1,1,1,1,1,1,1,1,1,1,1,1);");

//Wing FTP Server end

?> 
chaosnature
Posts: 16
Joined: Thu Sep 09, 2010 1:32 am

Re: Database integration with phpBB3

Post by chaosnature »

Thanks you for your promt reply,

i am not an expert on php scripting so pls bear with me...

am i surppose to get a blank page when executed?

i am running this locally so the parameter remain local host so i don't need to change any parameter in the above code , pls confirm..

many thanks....
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Database integration with phpBB3

Post by FTP »

Of course you need to change parameter USER and PASS...

Please check whether records have been inserted in.
chaosnature
Posts: 16
Joined: Thu Sep 09, 2010 1:32 am

Re: Database integration with phpBB3

Post by chaosnature »

Sry , i missed that section, school boy error,

also should i expect a blank page when i run this script , cos that's what i'm getting,

i have updated the parameters,
localhost
user name
password

and what is this for? ($ftp_dirpath = "D:/ftp_data/test111"; )
chaosnature
Posts: 16
Joined: Thu Sep 09, 2010 1:32 am

Re: Database integration with phpBB3

Post by chaosnature »

i am hoping u do not loose patient with me :)

cos i know i am almost there with this......
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Database integration with phpBB3

Post by FTP »

I am patient with you.

In the testing script, you needn't concern $ftp_dirpath, you just need to concern whether records have been inserted.
chaosnature
Posts: 16
Joined: Thu Sep 09, 2010 1:32 am

Re: Database integration with phpBB3

Post by chaosnature »

This is my config Please tell me what i am missing

Code: Select all

//Wing FTP Server MOD start
$ftp_dbname = "wftp_database";                //Wing FTP Server's mysql database name, assume in the same server.
$ftp_domain_name = "default";                 //ftp's domain name.
$ftp_dirpath = "D:/ftp_data/test111";        //user's directory path
$ftp_upload_limit = TRUE;                     //whether to limit the quota size
$ftp_maxuoload_size = 1024*1024*100;          //if $ftp_upload_limit = TRUE, this value means the max quota bytes.
mysql_connect("localhost", "dbusername","dbpassword");
mysql_select_db($ftp_dbname);
mysql_query("INSERT INTO `wftp_mysqltable_user` VALUES ('".$ftp_domain_name."','test111',1,1,'".md5("123")."',63,0,NULL,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0,0,0,'0',NULL,0,0,0,".intval($ftp_upload_limit).",0,".$ftp_maxuoload_size.",0,0,0,'');");
mysql_query("INSERT INTO `wftp_mysqltable_dir` VALUES ('".$ftp_domain_name."','test111','".$ftp_dirpath."','/',1,1,1,1,1,1,1,1,1,1,1,1);");

//Wing FTP Server end
mysql_connect("localhost", "dbusername","dbpassword");
is the parameters i use to connect to mysql databese.....

should this not pull down the database from the phpBB3 database into the wingftp user panel?
chaosnature
Posts: 16
Joined: Thu Sep 09, 2010 1:32 am

Re: Database integration with phpBB3

Post by chaosnature »

U know i might be missing the concept of how all this work here,

in mysql database the users that are created within the wingftp management console appear in the database on a seperate table from the php users,
question is: how those the php user table get replicated into the wingftp database table, is this what the script is mearnt to do?
Locked