Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
<?php
2
/*************************
3
  Coppermine Photo Gallery
4
  ************************
5
  Copyright (c) 2003-2005 Coppermine Dev Team
6
  v1.1 originaly written by Gregory DEMAR
7
 
8
  This program is free software; you can redistribute it and/or modify
9
  it under the terms of the GNU General Public License as published by
10
  the Free Software Foundation; either version 2 of the License, or
11
  (at your option) any later version.
12
  ********************************************
13
  Coppermine version: 1.3.3
14
  $Source: /cvsroot/coppermine/stable/bridge/vbulletin.inc.php,v $
15
  $Revision: 1.7 $
16
  $Author: gaugau $
17
  $Date: 2005/04/19 03:17:13 $
18
**********************************************/
19
// ------------------------------------------------------------------------- //
20
// vBulletin 2.3 Integration for Coppermine
21
// ------------------------------------------------------------------------- //
22
 
23
// ------------------------------------------------------------------------- //
24
// Modify the values below according to your Board installation
25
// ------------------------------------------------------------------------- //
26
// database configuration
27
define('VB_DB_NAME', 'vbulletin23'); // The name of the database used by the board
28
define('VB_BD_HOST', 'localhost'); // The name of the database server
29
define('VB_DB_USERNAME', 'root'); // The username to use to connect to the database
30
define('VB_DB_PASSWORD', ''); // The password to use to connect to the database
31
 
32
// The web path to your vBulletin Board directory
33
// In this example http://yoursite_name.com/vbulletin23/
34
define('VB_WEB_PATH', '/vbulletin23/');
35
// ------------------------------------------------------------------------- //
36
// Nothing to edit below this line
37
// ------------------------------------------------------------------------- //
38
// Prefix and names for the database tables
39
define('VB_TABLE_PREFIX', ''); // Leave empty, not supported by vBulletin 2.3
40
define('VB_USER_TABLE', 'user'); // The members table
41
define('VB_SESSION_TABLE', 'session'); // The sessions table
42
define('VB_GROUP_TABLE', 'usergroup'); // The groups table
43
 
44
// Group definitions (default values used by the board)
45
define('VB_VALIDATING_GROUP', 3);
46
define('VB_GUEST_GROUP', 1);
47
define('VB_MEMBERS_GROUP', 2);
48
define('VB_ADMIN_GROUP', 6);
49
// Authenticate a user using cookies
50
function udb_authenticate()
51
{
52
    global $HTTP_COOKIE_VARS, $USER_DATA, $UDB_DB_LINK_ID, $UDB_DB_NAME_PREFIX, $CONFIG;
53
    global $HTTP_SERVER_VARS, $HTTP_X_FORWARDED_FOR, $HTTP_PROXY_USER, $REMOTE_ADDR;
54
    // For error checking
55
    $CONFIG['TABLE_USERS'] = '**ERROR**';
56
    // Permissions for a default group
57
    $default_group = array('group_id' => VB_GUEST_GROUP,
58
        'group_name' => 'Unknown',
59
        'has_admin_access' => 0,
60
        'can_send_ecards' => 0,
61
        'can_rate_pictures' => 0,
62
        'can_post_comments' => 0,
63
        'can_upload_pictures' => 0,
64
        'can_create_albums' => 0,
65
        'pub_upl_need_approval' => 1,
66
        'priv_upl_need_approval' => 1,
67
        );
68
    // get first 50 chars
69
    $HTTP_USER_AGENT = substr($HTTP_SERVER_VARS['HTTP_USER_AGENT'], 0, 50);
70
    $REMOTE_ADDR = substr($HTTP_SERVER_VARS['REMOTE_ADDR'], 0, 50);
71
 
72
    if (is_array($HTTP_COOKIE_VARS)) {
73
        $sessionhash = isset($HTTP_COOKIE_VARS['sessionhash']) ? $HTTP_COOKIE_VARS['sessionhash'] : '';
74
        $bbuserid = isset($HTTP_COOKIE_VARS['bbuserid']) ? $HTTP_COOKIE_VARS['bbuserid'] : 0;
75
        $bbpassword = isset($HTTP_COOKIE_VARS['bbpassword']) ? $HTTP_COOKIE_VARS['bbpassword'] : '';
76
        $bbalthash = isset($HTTP_COOKIE_VARS['bbalthash']) ? $HTTP_COOKIE_VARS['bbalthash'] : '';
77
    }
78
 
79
    if ($bbuserid && $bbpassword) {
80
        // If userid and password exist in cookies we use them to login
81
        $sql = "SELECT userid as user_id, username as user_name, usergroupid as mgroup " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE userid='" . addslashes($bbuserid) . "' AND password='" . addslashes($bbpassword) . "'";
82
    } elseif ($sessionhash) {
83
        // session hash exists
84
        // validate it:
85
        $sql = "SELECT sessionhash,userid,host,useragent,styleid " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_SESSION_TABLE . " " . "WHERE sessionhash='" . addslashes($sessionhash) . "' " . " AND (host='" . addslashes($REMOTE_ADDR) . "' " . "  OR (althash='" . addslashes($bbalthash) . "' AND althash<>'')) " . " AND useragent='" . addslashes($HTTP_USER_AGENT) . "'";
86
 
87
        $result = db_query($sql, $UDB_DB_LINK_ID);
88
 
89
        if (mysql_num_rows($result)) {
90
            // session hash exists
91
            $session_data = mysql_fetch_array($result);
92
            mysql_free_result($result);
93
 
94
            $sql = "SELECT userid as user_id, username as user_name, usergroupid as mgroup " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE userid='" . $session_data['userid'] . "'";
95
            $result = db_query($sql, $UDB_DB_LINK_ID);
96
        } else {
97
            $sql = "SELECT userid as user_id, username as user_name, usergroupid as mgroup " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE 0";
98
        }
99
    } else {
100
        $sql = "SELECT userid as user_id, username as user_name, usergroupid as mgroup " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE 0";
101
    }
102
 
103
    $result = db_query($sql, $UDB_DB_LINK_ID);
104
 
105
    if (mysql_num_rows($result)) {
106
        $USER_DATA = mysql_fetch_array($result);
107
        mysql_free_result($result);
108
 
109
        define('USER_ID', (int)$USER_DATA['user_id']);
110
        define('USER_NAME', $USER_DATA['user_name']);
111
        // Retrieve group information
112
        $sql = "SELECT * " . "FROM {$CONFIG['TABLE_USERGROUPS']} " . "WHERE group_id = '{$USER_DATA['mgroup']}'";
113
        $result = db_query($sql);
114
        if (mysql_num_rows($result)) {
115
            $USER_DATA2 = mysql_fetch_array($result);
116
        } else {
117
            $USER_DATA2 = $default_group;
118
        }
119
 
120
        $USER_DATA = array_merge($USER_DATA, $USER_DATA2);
121
 
122
        define('USER_GROUP', $USER_DATA['group_name']);
123
        define('USER_GROUP_SET', '(' . $USER_DATA['group_id'] . ')');
124
        define('USER_IS_ADMIN', ($USER_DATA['mgroup'] == VB_ADMIN_GROUP));
125
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
126
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
127
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
128
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
129
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
130
        mysql_free_result($result);
131
    } else {
132
        $result = db_query("SELECT * FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_id = " . VB_GUEST_GROUP);
133
        if (!mysql_num_rows($result)) {
134
            $USER_DATA = $default_group;
135
        } else {
136
            $USER_DATA = mysql_fetch_array($result);
137
        }
138
        define('USER_ID', 0);
139
        define('USER_NAME', 'Anonymous');
140
        define('USER_GROUP_SET', '(' . VB_GUEST_GROUP . ')');
141
        define('USER_IS_ADMIN', 0);
142
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
143
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
144
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
145
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
146
        define('USER_CAN_CREATE_ALBUMS', 0);
147
        mysql_free_result($result);
148
    }
149
}
150
// Retrieve the name of a user
151
function udb_get_user_name($uid)
152
{
153
    global $UDB_DB_LINK_ID, $UDB_DB_NAME_PREFIX, $CONFIG;
154
 
155
    $sql = "SELECT username as user_name " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE userid = '$uid'";
156
 
157
    $result = db_query($sql, $UDB_DB_LINK_ID);
158
 
159
    if (mysql_num_rows($result)) {
160
        $row = mysql_fetch_array($result);
161
        mysql_free_result($result);
162
        return $row['user_name'];
163
    } else {
164
        return '';
165
    }
166
}
167
// Redirect
168
function udb_redirect($target)
169
{
170
    header('Location: ' . VB_WEB_PATH . $target);
171
    exit;
172
}
173
// Register
174
function udb_register_page()
175
{
176
    $target = 'register.php';
177
    udb_redirect($target);
178
}
179
// Login
180
function udb_login_page()
181
{
182
    $target = 'index.php';
183
    udb_redirect($target);
184
}
185
// Logout
186
function udb_logout_page()
187
{
188
    $target = 'member.php?&action=logout';
189
    udb_redirect($target);
190
}
191
// Edit users
192
function udb_edit_users()
193
{
194
    $target = 'admin/index.php';
195
    udb_redirect($target);
196
}
197
// Get user information
198
function udb_get_user_infos($uid)
199
{
200
    global $CONFIG, $UDB_DB_NAME_PREFIX, $UDB_DB_LINK_ID;
201
    global $lang_register_php;
202
 
203
    $sql = "SELECT username as user_name, usergroupid as mgroup, email as user_email, joindate as user_regdate, " . "homepage as user_website " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE userid = '$uid'";
204
    $result = db_query($sql, $UDB_DB_LINK_ID);
205
 
206
    if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_register_php['err_unk_user'], __FILE__, __LINE__);
207
    $user_data = mysql_fetch_array($result);
208
    mysql_free_result($result);
209
 
210
    $user_data['group_name'] = '';
211
    $user_data['user_occupation'] = '';
212
    $user_data['user_location'] = '';
213
    $user_data['user_interests'] = '';
214
 
215
    $sql = "SELECT group_name " . "FROM {$CONFIG['TABLE_USERGROUPS']} " . "WHERE group_id = {$user_data['mgroup']} ";
216
    $result = db_query($sql);
217
 
218
    if (mysql_num_rows($result)) {
219
        $row = mysql_fetch_array($result);
220
        $user_data['group_name'] = $row['group_name'];
221
    }
222
    mysql_free_result($result);
223
 
224
    return $user_data;
225
}
226
// Edit user profile
227
function udb_edit_profile($uid)
228
{
229
    $target = 'usercp.php';
230
    udb_redirect($target);
231
}
232
// Query used to list users
233
function udb_list_users_query(&$user_count)
234
{
235
    global $CONFIG, $FORBIDDEN_SET;
236
 
237
        if ($FORBIDDEN_SET != "") $forbidden = "AND $FORBIDDEN_SET";
238
    $sql = "SELECT (category - " . FIRST_USER_CAT . ") as user_id," . "                '???' as user_name," . "                COUNT(DISTINCT a.aid) as alb_count," . "                COUNT(DISTINCT pid) as pic_count," . "                MAX(pid) as thumb_pid " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid " . "WHERE approved = 'YES' AND category > " . FIRST_USER_CAT . " $forbidden GROUP BY category " . "ORDER BY category ";
239
    $result = db_query($sql);
240
 
241
    $user_count = mysql_num_rows($result);
242
 
243
    return $result;
244
}
245
 
246
function udb_list_users_retrieve_data($result, $lower_limit, $count)
247
{
248
    global $CONFIG, $UDB_DB_NAME_PREFIX, $UDB_DB_LINK_ID;
249
 
250
    mysql_data_seek($result, $lower_limit);
251
 
252
    $rowset = array();
253
    $i = 0;
254
    $user_id_set = '';
255
 
256
    while (($row = mysql_fetch_array($result)) && ($i++ < $count)) {
257
        $user_id_set .= $row['user_id'] . ',';
258
        $rowset[] = $row;
259
    }
260
    mysql_free_result($result);
261
 
262
    $user_id_set = '(' . substr($user_id_set, 0, -1) . ')';
263
    $sql = "SELECT userid as user_id, username as user_name " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE userid IN $user_id_set";
264
    $result = db_query($sql, $UDB_DB_LINK_ID);
265
    while ($row = mysql_fetch_array($result)) {
266
        $name[$row['user_id']] = $row['user_name'];
267
    }
268
    for($i = 0; $i < count($rowset); $i++) {
269
        $rowset[$i]['user_name'] = empty($name[$rowset[$i]['user_id']]) ? '???' : $name[$rowset[$i]['user_id']];
270
    }
271
 
272
    return $rowset;
273
}
274
// Group table synchronisation
275
function udb_synchronize_groups()
276
{
277
    global $CONFIG, $UDB_DB_NAME_PREFIX, $UDB_DB_LINK_ID;
278
 
279
    $result = db_query("SELECT usergroupid, title FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_GROUP_TABLE . " WHERE 1", $UDB_DB_LINK_ID);
280
    while ($row = mysql_fetch_array($result)) {
281
        $VB_groups[$row['usergroupid']] = $row['title'];
282
    }
283
    mysql_free_result($result);
284
 
285
    $result = db_query("SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} WHERE 1");
286
    while ($row = mysql_fetch_array($result)) {
287
        $cpg_groups[$row['group_id']] = $row['group_name'];
288
    }
289
    mysql_free_result($result);
290
    // Scan Coppermine groups that need to be deleted
291
    foreach($cpg_groups as $c_group_id => $c_group_name) {
292
        if ((!isset($VB_groups[$c_group_id]))) {
293
            db_query("DELETE FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_id = '" . $c_group_id . "' LIMIT 1");
294
            unset($cpg_groups[$c_group_id]);
295
        }
296
    }
297
    // Scan vBulletin Board groups that need to be created inside Coppermine table
298
    foreach($VB_groups as $i_group_id => $i_group_name) {
299
        if ((!isset($cpg_groups[$i_group_id]))) {
300
            db_query("INSERT INTO {$CONFIG['TABLE_USERGROUPS']} (group_id, group_name) VALUES ('$i_group_id', '" . addslashes($i_group_name) . "')");
301
            $cpg_groups[$i_group_id] = $i_group_name;
302
        }
303
    }
304
    // Update Group names
305
    foreach($VB_groups as $i_group_id => $i_group_name) {
306
        if ($cpg_groups[$i_group_id] != $i_group_name) {
307
            db_query("UPDATE {$CONFIG['TABLE_USERGROUPS']} SET group_name = '" . addslashes($i_group_name) . "' WHERE group_id = '$i_group_id' LIMIT 1");
308
        }
309
    }
310
}
311
// Retrieve the album list used in gallery admin mode
312
function udb_get_admin_album_list()
313
{
314
    global $CONFIG, $UDB_DB_NAME_PREFIX, $UDB_DB_LINK_ID, $FORBIDDEN_SET;
315
 
316
    if (UDB_CAN_JOIN_TABLES) {
317
        $sql = "SELECT aid, CONCAT('(', username, ') ', a.title) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " AS u ON category = (" . FIRST_USER_CAT . " + userid) " . "ORDER BY title";
318
        return $sql;
319
    } else {
320
        $sql = "SELECT aid, IF(category > " . FIRST_USER_CAT . ", CONCAT('* ', title), CONCAT(' ', title)) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} " . "ORDER BY title";
321
        return $sql;
322
    }
323
}
324
 
325
function udb_util_filloptions()
326
{
327
    global $albumtbl, $picturetbl, $categorytbl, $lang_util_php, $CONFIG, $UDB_DB_NAME_PREFIX, $UDB_DB_LINK_ID;
328
 
329
    $usertbl = $UDB_DB_NAME_PREFIX.VB_TABLE_PREFIX.VB_USER_TABLE;
330
 
331
    if (UDB_CAN_JOIN_TABLES) {
332
 
333
        $query = "SELECT aid, category, IF(username IS NOT NULL, CONCAT('(', username, ') ', a.title), CONCAT(' - ', a.title)) AS title " . "FROM $albumtbl AS a " . "LEFT JOIN $usertbl AS u ON category = (" . FIRST_USER_CAT . " + userid) " . "ORDER BY category, title";
334
        $result = db_query($query, $UDB_DB_LINK_ID);
335
        // $num=mysql_numrows($result);
336
        echo '<select size="1" name="albumid">';
337
 
338
        while ($row = mysql_fetch_array($result)) {
339
            $sql = "SELECT name FROM $categorytbl WHERE cid = " . $row["category"];
340
            $result2 = db_query($sql);
341
            $row2 = mysql_fetch_array($result2);
342
 
343
            print "<option value=\"" . $row["aid"] . "\">" . $row2["name"] . $row["title"] . "</option>\n";
344
        }
345
 
346
        print '</select> (3)';
347
        print '&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="'.$lang_util_php['submit_form'].'" class="submit" /> (4)';
348
        print '</form>';
349
 
350
    } else {
351
 
352
        // Query for list of public albums
353
 
354
        $public_albums = db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
355
 
356
        if (mysql_num_rows($public_albums)) {
357
            $public_result = db_fetch_rowset($public_albums);
358
        } else {
359
            $public_result = array();
360
        }
361
 
362
        // Initialize $merged_array
363
        $merged_array = array();
364
 
365
        // Count the number of albums returned.
366
        $end = count($public_result);
367
 
368
        // Cylce through the User albums.
369
        for($i=0;$i<$end;$i++) {
370
 
371
            //Create a new array sow we may sort the final results.
372
            $merged_array[$i]['id'] = $public_result[$i]['aid'];
373
            $merged_array[$i]['album_name'] = $public_result[$i]['title'];
374
 
375
            // Query the database to get the category name.
376
            $vQuery = "SELECT name, parent FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $public_result[$i]['category'] . "'";
377
            $vRes = mysql_query($vQuery);
378
            $vRes = mysql_fetch_array($vRes);
379
            if (isset($merged_array[$i]['username_category'])) {
380
                $merged_array[$i]['username_category'] = (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '').$merged_array[$i]['username_category'];
381
            } else {
382
                $merged_array[$i]['username_category'] = (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '');
383
            }
384
 
385
        }
386
 
387
        // We transpose and divide the matrix into columns to prepare it for use in array_multisort().
388
        foreach ($merged_array as $key => $row) {
389
           $aid[$key] = $row['id'];
390
           $title[$key] = $row['album_name'];
391
           $album_lineage[$key] = $row['username_category'];
392
        }
393
 
394
        // We sort all columns in descending order and plug in $album_menu at the end so it is sorted by the common key.
395
        array_multisort($album_lineage, SORT_ASC, $title, SORT_ASC, $aid, SORT_ASC, $merged_array);
396
 
397
        // Query for list of user albums
398
 
399
        $user_albums = db_query("SELECT aid, title, category FROM {$CONFIG['TABLE_ALBUMS']} WHERE category >= " . FIRST_USER_CAT . " ORDER BY aid");
400
        if (mysql_num_rows($user_albums)) {
401
            $user_albums_list = db_fetch_rowset($user_albums);
402
        } else {
403
            $user_albums_list = array();
404
        }
405
 
406
        // Query for list of user IDs and names
407
 
408
        $user_album_ids_and_names = db_query("SELECT (userid + ".FIRST_USER_CAT.") as id, CONCAT('(', username, ') ') as name FROM $usertbl ORDER BY name ASC",$UDB_DB_LINK_ID);
409
 
410
        if (mysql_num_rows($user_album_ids_and_names)) {
411
            $user_album_ids_and_names_list = db_fetch_rowset($user_album_ids_and_names);
412
        } else {
413
            $user_album_ids_and_names_list = array();
414
        }
415
 
416
        // Glue what we've got together.
417
 
418
        // Initialize $udb_i as a counter.
419
        if (count($merged_array)) {
420
            $udb_i = count($merged_array);
421
        } else {
422
            $udb_i = 0;
423
        }
424
 
425
        //Begin a set of nested loops to merge the various query results.
426
        foreach ($user_albums_list as $aq) {
427
            foreach ($user_album_ids_and_names_list as $uq) {
428
                if ($aq['category'] == $uq['id']) {
429
                    $merged_array[$udb_i]['id']= $aq['category'];
430
                    $merged_array[$udb_i]['album_name']= $aq['title'];
431
                    $merged_array[$udb_i]['username_category']= $uq['name'];
432
                    $udb_i++;
433
                }
434
            }
435
        }
436
 
437
        // The user albums and public albums have been merged into one list. Print the dropdown.
438
        echo '<select size="1" name="albumid">';
439
 
440
        foreach ($merged_array as $menu_item) {
441
 
442
            echo "<option value=\"" . $menu_item['id'] . "\">" . (isset($menu_item['username_category']) ? $menu_item['username_category'] : '') . $menu_item['album_name'] . "</option>\n";
443
 
444
        }
445
 
446
        // Close list, etc.
447
        print '</select> (3)';
448
        print '&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="'.$lang_util_php['submit_form'].'" class="submit" /> (4)';
449
        print '</form>';
450
 
451
    }
452
 
453
}
454
 
455
// ------------------------------------------------------------------------- //
456
// Define wheter we can join tables or not in SQL queries (same host & same db or user)
457
define('UDB_CAN_JOIN_TABLES', (VB_BD_HOST == $CONFIG['dbserver'] && (VB_DB_NAME == $CONFIG['dbname'] || VB_DB_USERNAME == $CONFIG['dbuser'])));
458
// Connect to vBulletin Board Database if necessary
459
$UDB_DB_LINK_ID = 0;
460
$UDB_DB_NAME_PREFIX = VB_DB_NAME ? '`' . VB_DB_NAME . '`.' : '';
461
if (!UDB_CAN_JOIN_TABLES) {
462
    $UDB_DB_LINK_ID = @mysql_connect(VB_BD_HOST, VB_DB_USERNAME, VB_DB_PASSWORD);
463
    if (!$UDB_DB_LINK_ID) die("<b>Coppermine critical error</b>:<br />Unable to connect to vBulletin Board database !<br /><br />MySQL said: <b>" . mysql_error() . "</b>");
464
}
465
 
466
?>