Location: PHPKode > scripts > lib_dictionary > lib_dictionary/example_add_wordlist.php
<?php
/***************************************************************************
 *   example_add_wordlist.php
 *   Copyright (c) 2007 David Frendin (hide@address.com)
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version. See the GNU General Public License
 *   for more details.
 *
 ***************************************************************************/

/***************************************************************************
 *   Example: How to add a new wordlist
 *   This example will append words from a textfile to the dictionary
 *
 ***************************************************************************/


/* ___[ Below is example code ]_____________________ */
require_once('mysql4.php');	//from phpbb2
require_once('lib_dictionary.php');

define('DICTIONARY_TABLE', 'dictionary');

//connect to db
$db = new sql_db('localhost', 'username', 'password', 'table', false);
if(!$db->db_connect_id)
{
	die("Could not connect to the database");
}

$dict = new dictclass();

$dict->add_from_file("some_wordlist.txt");		//<-- the magic command
die("done!");

/* ___[ End of example code ]_____________________ */
?>
Return current item: lib_dictionary