* @version 04-03-07
* @package MailZu
*
* Copyright (C) 2005 - 2007 MailZu
* License: GPL, see LICENSE
*/
/**
* Include Template class
*/
include_once('lib/Template.class.php');
/**
* Include common output functions
*/
include_once('templates/common.template.php');
/**
* Include quarantine-specific output functions
*/
include_once('templates/quarantine.template.php');
/**
* Include DB class
*/
include_once('lib/DBEngine.class.php');
if (!Auth::is_logged_in()) {
Auth::print_login_msg(); // Check if user is logged in
}
//Get content type
$content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A');
$_SESSION['sessionNav'] = "Multiple Accounts";
$t = new Template(translate('Multiple Accounts'));
$db = new DBEngine();
$t->printHTMLHeader();
$t->printWelcome();
$t->startMain();
// Break table into 2 columns, put quick links on left side and all other tables on the right
startQuickLinksCol();
showQuickLinks(); // Print out My Quick Links
startDataDisplayCol();
echo '
';
// Print a loading message until database returns...
printMessage(translate('Retrieving Messages...'));
// Connect to mysql and database
$db_connect = @mysql_pconnect($conf['db']['hostSpec'],$conf['db']['dbUser'],$conf['db']['dbPass']) or die ("
ERROR connecting to server
"."\n");
mysql_select_db ( $conf['db']['dbName'], $db_connect ) or die ("ERROR opening db
"."\n");
// A simple query to the "Multiple" table to detect if we need to create one
if(!(mysql_query("SELECT * FROM mailzu_multiple")))
{
// It didn exist so create one.
$sql_mult_create = mysql_query("
CREATE TABLE IF NOT EXISTS `mailzu_multiple` (
`mult_id` int(11) NOT NULL auto_increment,
`mult_email` varchar(64) default NULL,
`mult_attach` varchar(64) default NULL,
PRIMARY KEY (`mult_id`)
)
");
// Simple Javascript to force a page reload
echo "
";
}
else
{
// Fetch all entries query
$sql_emails_query = mysql_query("SELECT * FROM mailzu_multiple ORDER BY mult_email");
$sql_emails_rows = mysql_num_rows($sql_emails_query);
// Delete entry
if ($_GET['del']>='0')
{
$multi_delete = "DELETE FROM mailzu_multiple WHERE mult_id='".$_GET['del']."'";
mysql_query($multi_delete);
echo "
// Reload page
";
}
// Insert entry
else if ($_GET['edit']>='new')
{
mysql_query("insert into mailzu_multiple(mult_email,mult_attach) values('".$_POST[mult_emailacc]."','".$_POST[mult_emailatt]."')");
echo "
// Reload page
";
}
else
{
// Draw the table
echo '
'; echo translate('Email address'); echo ' |
'; echo translate('Attached Email'); echo ' |
';
// Fetch entries one by one
while($fetch_row = mysql_fetch_array($sql_emails_query))
{
if ($sql_emails_rows!=0)
{
extract($fetch_row);
echo "
$mult_email |
$mult_attach |
|
";
}
}
// Display option to create a new entry
echo "
";
}
}
// Hide the message after the table loads.
hideMessage(translate('Retrieving Messages...'));
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
?>