XFileSharing Pro - Adding custom field on user database

Powerfull XFileSharing version

Moderator: admin

Message
Author
pandusetiawan
Posts: 15
Joined: May 11, 2009 8:57 am

Adding custom field on user database

#1 Postby pandusetiawan » Apr 17, 2011 3:49 am

Hi...I'd like to add a custom field on my XFile user database. Since my file server are commercialed through my forum site, I want my file server user fill their forum username when they register on my file server,or they can edit the field on their Account page.
Anyone can help me?Thanks.

verzing
Posts: 141
Joined: Mar 02, 2011 7:00 pm

#2 Postby verzing » Apr 18, 2011 3:19 am

You can put database together, like the database name of xfilesharing is: image_host so you can import the database of forum in to xfilesharing database image_host.

pandusetiawan
Posts: 15
Joined: May 11, 2009 8:57 am

#3 Postby pandusetiawan » Apr 20, 2011 11:17 am

verzing wrote:You can put database together, like the database name of xfilesharing is: image_host so you can import the database of forum in to xfilesharing database image_host.


Thank's for the reply...but I'm sorry...I'm not getting what you mean.Can you give me more details explanation?thanks :)

RootShell
Posts: 35
Joined: Jul 23, 2009 9:11 pm
Location: Casablanca, Morocco

Re: Adding custom field on user database

#4 Postby RootShell » Apr 24, 2011 1:52 pm

pandusetiawan wrote:Hi...I'd like to add a custom field on my XFile user database. Since my file server are commercialed through my forum site, I want my file server user fill their forum username when they register on my file server,or they can edit the field on their Account page.
Anyone can help me?Thanks.


1-
Sure you can, if you have phpmyadmin installed, just add the field from it in User table, else use your SSH root access to add the field and set the data type.

2-
you have to add in register.html + my_account.html template the user field text form for example.

3-
edit index.cgi file in cgi-bin folder located in Main Server :

Search this line :

Code: Select all

$db->Exec("INSERT INTO Users


* Add for example after this code :

Code: Select all

usr_login=?,


this :

Code: Select all

your_field=?,


* Add after this code :

Code: Select all

$f->{usr_login},


this :

Code: Select all

$f->{your_field},


Remember the HTML field name/id have to be set to your field name ex : your_field

4- Search this line again :

Code: Select all

$db->Exec("UPDATE Users


and do the same steps.

PS : you can verify if the field is empty or contain bad data via simple JS and some Regex ;)

Keep a backup file before doing this changes :)

Correct me if I'm wrong.

Cheers,
Hamza.


Return to “XFileSharing Pro”

Who is online

Users browsing this forum: No registered users and 0 guests