Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=109)
-   -   [09] New Config (http://www.bvlist.com/showthread.php?t=11691)

BamBam0077 20th July 2018 01:37

[09] New Config
 
Warning:
before you delete your /include/config.php
You should try running this new Config in /libs/
You will need to edit BitTorrent.php where it ask for the directory of config.php so you can test /libs/config.php

You will need to edit the following before hand also I named the $varible the same as the function which you can fiddle with either using this way or run your own path using dbconn() which would have MySQL we need MySQLi just to help some people advance as it can be daunting at first to program as your afraid you'll break it :lol: been there White pages, list of MySQL and MySQLi errors, php errors, etc the list goes on..... Now:

Code:

CREATE TABLE config (
  `mysql_host` varchar(255) NOT NULL default '',
  `mysql_db` varchar(255) NOT NULL default '',
  `mysql_user` varchar(255) NOT NULL default '',
  `mysql_pass` varchar(255) NOT NULL default '',
  `site_url` varchar(255) NOT NULL default '',
  `announce_url` varchar(255) NOT NULL default '',
  `site_online` varchar(255) NOT NULL default '',
  `members_only` varchar(255) NOT NULL default '',
  `site_mail` varchar(255) NOT NULL default '',
  `email_confirm` enum('true','false') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'true',
  `site_name` varchar(255) NOT NULL default '',
  `image_dic` varchar(255) NOT NULL default '',
  `torrent_dic` varchar(255) NOT NULL default '',
  `peer_limit` varchar(255) NOT NULL default '',
  `max_members` varchar(255) NOT NULL default '',
  `max_users_then_invite` int(10) UNSIGNED DEFAULT '5000' NOT NULL,
  `invites` int(10) UNSIGNED DEFAULT '2500' NOT NULL,
  `signup_timeout` varchar(255) NOT NULL default '',
  `min_votes` varchar(255) NOT NULL default '',
  `autoclean_interval` varchar(255) NOT NULL default '',
  `announce_interval` varchar(255) NOT NULL default '',
  `max_torrent_size` varchar(255) NOT NULL,
  `max_dead_torrent_time` varchar(255) NOT NULL default '',
  `posts_read_expiry` varchar(255) NOT NULL default '',
  `max_login_attempts` varchar(255) NOT NULL default '',
  `dictbreaker` varchar(255) NOT NULL default '',
  `delete_old_torrents` varchar(255) NOT NULL default '',
  `dead_torrents` varchar(255) NOT NULL default '',
  `site_reputation` enum('true','false') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'true',
  `maxfilesize` varchar(255) NOT NULL default '',
  `attachment_dir` varchar(255) NOT NULL default '',
  `forum_width` varchar(255) NOT NULL default '',
  `maxsubjectlength` varchar(255) NOT NULL default '',
  `postsperpage` varchar(255) NOT NULL default '',
  `use_attachment_mod` varchar(255) NOT NULL default '',
  `use_poll_mod` varchar(255) NOT NULL default '',
  `forum_stats_mod` varchar(255) NOT NULL default '',
  `use_flood_mod` varchar(255) NOT NULL default '',
  `limmit` varchar(255) NOT NULL default '',
  `minutes` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`mysql_host`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

If you don't edit above it would not connect to your server properly.

below can be found in the new config
Code:

$dbconn = mysqli_connect("localhost",
                        "root",
                        "",
                        "tbdev");

The empty space is for your password never leave your SQL without a password bad naughty :smack:

Now for you, I will share an official SQL just thought why do it now since via mobile, so to speed things up I got a snippet from our config.sql:

Now edit to match belows expecting requirements, if your unsure check all information against the original config which is found in /include/

how to edit above SQL, fill out the varchar where default '' < see the single speechs well in-between them you need to fill in your information from your original config setup now , say you don't have flood mod installed I would expect you to change name and fill out or simply remove that line `use_flood_mod` varchar(255) NOT NULL default '', outta the SQL config setup, So to edit what we need edited we would match up.

we have an example
Code:

`site_online` varchar(255) NOT NULL default '1',
above has been edited before adding into my phpmyadmin
If your confused don't be it matches up with:
Code:

// Settings
$TBDEV['site_online'] = $info["site_online"];

so the part with $varibles are simply stating that is where it belongs. So where we have 1 in the db it should work and run within our config if it doesn't I am sure it is a minor technically, you will edit till it works so be patient as I am not good with tutoring but I can help of course....back to

Code:

$TBDEV['time_adjust'] =  $info["time_adjust"];
$TBDEV['time_offset'] = $info["time_offset"];
$TBDEV['time_use_relative'] = $info["time_use_relative"];
$TBDEV['time_use_relative_format'] = $info["time_use_relative_format"];
$TBDEV['time_joined'] = $info["time_joined"];
$TBDEV['time_short'] = $info["time_short"];
$TBDEV['time_long'] = $info["time_long"];
$TBDEV['time_tiny'] = $info["time_tiny"];
$TBDEV['time_date'] = $info["time_date"];

Let's edit for above to work!
Code:

`time_adjust` varchar(255) NOT NULL default '',
`time_date` varchar(255) NOT NULL default '',
`time_joined` varchar(255) NOT NULL default 'j-F y',
`time_long` varchar(255) NOT NULL default 'F j Y, H:i',
`time_offset` varchar(255) NOT NULL default '0.0',
`time_short` varchar(255) NOT NULL default 'd m Y - H:i',
`time_tiny` varchar(255) NOT NULL default '',
`time_use_relative` varchar(255) NOT NULL default '1',
`time_use_relative_format` varchar(255) NOT NULL default '{--}, H:i',

Now add just after:
Code:

CREATE TABLE `config` (
fill the rest out, you will get use to SQL things like varchar is good could have used int(10) or enum("yes","no") once you get use to databases they become better...but if your a novice then keep it under varchar more experienced could use varchar,int or enum. Anyway hope this all helps I am gonna have test it myself :relax: we

Code:

/*********************************\
  DO NOT EDIT THIS FILE, PLEASE USE
  THE SETTINGS PANEL!!
\*********************************/
if(!defined('IN_INSTALLED'))
  die('Hacking attempt!');
 
error_reporting(E_ALL);
date_default_timezone_set('Europe/London');

define('SQL_DEBUG', 1);
define('TIME_NOW', time());
define('EMAIL_CONFIRM', false);
define('XBT_TRACKER', false);
define ('UC_USER', 0);
define ('UC_POWER_USER', 1);
define ('UC_VIP', 2);
define ('UC_UPLOADER', 3);
define ('UC_MODERATOR', 4);
define ('UC_ADMINISTRATOR', 5);
define ('UC_SYSOP', 6);

$dbconn = mysqli_connect("localhost",
                        "root",
                        "",
                        "tbdev");
// Check connection
if (mysqli_connect_errno()){

  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// start here!
// select * from config.sql
$sql = 'SELECT * FROM config';
// sql query to run above sql request
$result = sql_query($dbconn, $sql);
// while $result -> $config
while($info = mysqli_fetch_assoc($result)){

$TBDEV['time_adjust'] =  $info["time_adjust"];
$TBDEV['time_offset'] = $info["time_offset"];
$TBDEV['time_use_relative'] = $info["time_use_relative"];
$TBDEV['time_use_relative_format'] = $info["time_use_relative_format"];
$TBDEV['time_joined'] = $info["time_joined"];
$TBDEV['time_short'] = $info["time_short"];
$TBDEV['time_long'] = $info["time_long"];
$TBDEV['time_tiny'] = $info["time_tiny"];
$TBDEV['time_date'] = $info["time_date"];

// DB setup
$TBDEV['mysql_host'] = $info["mysql_host"];
$TBDEV['mysql_user'] = $info["mysql_user"];
$TBDEV['mysql_pass'] = $info["mysql_pass"];
$TBDEV['mysql_db']  = $info["mysql_db"];

// Settings
$TBDEV['site_online'] = $info["site_online"];
$TBDEV['maxusers'] = $info["maxusers"];
$TBDEV['domain'] = $info["domain"];
$TBDEV['site_name'] = $info["site_name"];
$TBDEV['site_email']  = $info["site_email"];
$TBDEV['language'] = $info["language"];
$TBDEV['char_set'] = $info["char_set"];
$TBDEV['announce_interval'] = $info["announce_interval"];
$TBDEV['tracker_post_key'] = $info["tracker_post_key"];
$TBDEV['max_torrent_size'] = $info["max_torrent_size"];
$TBDEV['max_dead_torrent_time'] = $info["max_dead_torrent_time"];
$TBDEV['signup_timeout'] = $info["signup_timeout"];
$TBDEV['pic_base_url'] = $info["pic_base_url"];
$TBDEV['stylesheet'] = $info["stylesheet"];
$TBDEV['readpost_expiry'] = $info["readpost_expiry"];
$TBDEV['autoclean_interval'] = $info["autoclean_interval"];
$TBDEV['announce_url'] = $info["announce_url"];
$TBDEV['msg_alert'] = $info["msg_alert"];
$TBDEV['minvotes'] = $info["minvotes"];
$TBDEV['av_img_height'] = $info["av_img_height"];
$TBDEV['av_img_width'] = $info["av_img_width"];
}

// Cookie setup
$TBDEV['cookie_prefix']  = 'alpha_'; // This allows you to have multiple trackers, eg for demos, testing etc.
$TBDEV['cookie_path']    = ''; // ATTENTION: You should never need this unless the above applies eg: /tbdev
$TBDEV['cookie_domain']  = ''; // set to eg: .somedomain.com or is subdomain set to: .sub.somedomain.com

//Do not modify -- versioning system
//This will help identify code for support issues at tbdev.net
define ('TBVERSION','TBDev_2009_svn');
?>


Napon 20th July 2018 09:20

My new FNEDition mysqli as this too ive done and works fine


All times are GMT +2. The time now is 15:12.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.