mysql.php

You need additional help with phplogcon, then write into this forum.

mysql.php

Postby help-needed on Fri Jul 06, 2007 3:20 pm

Hi there,


I need help with the mysql.php file.

The thing is that i have installed mysql along with phplogcon.

Based on that i see the messages stored in the mysql/Syslog databases I have events in the SystemEvents table.


although I don't see anything on the web

below is my mysql.php file

btw databases is Syslog

/*
* This file contains the function for database connection
* via mysql
*/

/*! \addtogroup DB Converter
*
* All converter functions using to prepare things to work with database queries
* use the prefix "dbc_"
* @{
*/

/*
* Generate the tags for a time argument using in a sql statment
* \param timestamp which need tags
* \return timestamp_with_tags returns the timestamp with tags in the nesessary format
*/
function dbc_sql_timeformat($times)
{
if (defined('_UTCtime') && _UTCtime)
{
$times = GetUTCtime($times);
}
return "'".date("Y-m-d H:i:s", $times)."'";
}

/*! @} */

/*
* Database driver
*/

/*
* Attempts to establish a connection to the database.
* /return the connection handle if the connection was successful, NULL if the connection was unsuccessful.
*/
function db_connection()
{
if (!isset($_SESSION['database']))
{
$_SESSION['database'] = _DBNAME;
}
# $db = mysql_connect(_DBSERVER, _DBUSERID, _DBPWD) or db_die_with_error(_MSGNoDBCon);
# mysql_select_db(_DBNAME) or db_die_with_error(_MSGChDB);
return $db;
}

function db_own_connection($host, $port, $user, $pass, $dbname)
{
if($port != 0)
$db = mysql_connect($host . ":" . $port, $user, $pass) or db_die_with_error(_MSGNoDBCon);
else
$db = mysql_connect($host, $user, $pass) or db_die_with_error(_MSGNoDBCon);
mysql_select_db($dbname) or db_die_with_error(_MSGChDB);
return $db;
}

/*
* Executes the SQL.
* /param db Database connection handle
* /param cmdSQL SQL statement
*
* /return Resource handle
*/
function db_exec($db, $cmdSQL)
{
//echo "<br><br><b>" . $cmdSQL . "</b><br><br>";
$result = mysql_query($cmdSQL, $db) or db_die_with_error(_MSGInvQur);
return $result;
}

/*
* Executes the SQL.
* /param res Rescource hanndle
*
* /return The number of rows in the result set.
*/
function db_num_rows($res)
{
$result = mysql_num_rows($res);
return $result;
}

/*
* Fetch a result row as an associative array, a numeric array, or both.
* /param res Rescource hanndle
*
* /return Returns an array that corresponds to the fetched row, or FALSE if there are no more rows.
*/
function db_fetch_array($res)
{
$result = mysql_fetch_array($res);
return $result;
}

/*
* db_fetch_singleresult is need in ODBC mode, so db_fetch_singleresult and db_fetch_array
* are the same in MySQL
*/
function db_fetch_singleresult($result)
{
$result = mysql_fetch_array($result);
return $result;
}

/*
* Get the result data.
* /param res Rescource hanndle
* /param res_name either be an integer containing the column number of the field you want;
or it can be a string containing the name of the field. For example:
*
* /return the contents of one cell from the result set.
*/
function db_result($res, $res_name)
{
$result = mysql_result($res, 1, $res_name) or db_die_with_error(_MSGNoRes);
return $result;
}

function db_close($db)
{
mysql_close($db) or db_die_with_error(_MSGNoDBHan);
}

function db_num_count($cmdSQLwhere_part)
{
return 'SELECT COUNT(*) AS num FROM ' . _DBTABLENAME . $cmdSQLwhere_part;
}

/*
* fetch a result row as an a numeric array
* the array points to the first data record you want to display
* at current page. You need it for paging.
*/
function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage, $order)
{
$cmdSQL = $cmdSQLfirst_part . $cmdSQLmain_part . $cmdSQLwhere_part . " limit ".($limitlower-1)."," . $perpage;
return db_exec($db, $cmdSQL);
}

function db_free_result($result)
{
return mysql_free_result($result);
}

function db_get_tables($dbCon, $dbName)
{
$query = "SHOW TABLES FROM " . $dbName;
return mysql_query($query);
}

function db_errno()
{
return mysql_errno();
}

function db_error()
{
return mysql_error();
}

function db_die_with_error($MyErrorMsg)
{
$errdesc = mysql_error();
$errno = mysql_errno();

$errormsg="<br>Database error: $MyErrorMsg <br>";
$errormsg.="mysql error: $errdesc <br>";
$errormsg.="mysql error number: $errno<br>";
$errormsg.="Date: ".date("d.m.Y @ H:i")."<br>";
$errormsg.="Script: ".getenv("REQUEST_URI")."<br>";
$errormsg.="Referer: ".getenv("HTTP_REFERER")."<br><br>";

echo $errormsg;
exit;
}

/*
* Returns what wildcut the database use (e.g. %, *, ...)
*/
function db_get_wildcut()
{
return '%';
}

?>
help-needed
New
 
Posts: 3
Joined: Fri Jul 06, 2007 3:16 pm

Postby mmeckelein on Fri Jul 06, 2007 4:43 pm

Did you use the install/install.php script to install phplogon? Please verify that the 'config.php' file contains the right settings.

What kind of error do you get browsing to phplogcon's website? If you are getting no error, please change the following line in include.php from
Code:
// error_reporting(E_ALL);

to
Code:
error_reporting(E_ALL);

Michael
mmeckelein
Adiscon Support
 
Posts: 167
Joined: Wed Mar 12, 2003 12:07 pm

Postby help-needed on Fri Jul 06, 2007 4:45 pm

Hi


Thank you for your prompt response.

I do see web page but i can 't select any database no events are shown


Thanks
help-needed
New
 
Posts: 3
Joined: Fri Jul 06, 2007 3:16 pm

Postby help-needed on Fri Jul 06, 2007 4:53 pm

below is my config.pgp file


***** BEGIN DATABASE SETTINGS *****
*/

//Server name (only needed if you not use ODBC)
define('_DBSERVER', '127.0.01');

// DSN (ODBC) or database name (Mysql)
# define('_DBNAME', 'phplogcon');
define('_DBNAME', 'Syslog');

// Userid for database connection ***
# define('_DBUSERID', 'MonitorWareUser');
define('_DBUSERID', 'test');

// Password for database connection ***
# define('_DBPWD', 'UsersPassword');
define('_DBPWD', 'test');

// table name
define('_DBTABLENAME', 'SystemEvents');

// Switch for connection mode
// Currently only odbc and native works
define('_CON_MODE', 'native');

// Defines the Database Application you are using,
// because for example thx ODBC syntax of MySQL
// and Microsoft Access/SQL Server/etc are different
// Currently available are:
// with native: mysql
// with ODBC: mysql and mssql are available
define('_DB_APP', 'mysql');

/*
***** END DATABASE SETTINGS *****
*/
/*
***** BEGIN FOLDER SETTINGS *****
*/

//The folder where the classes are stored
define('_CLASSES', 'classes/');

//The folder where the forms are stored
define('_FORMS', 'forms/');

//The folder where the database drivers are stored
define('_DB_DRV', 'db-drv/');

//The folder where the language files are stored
define('_LANG', 'lang/');

//your image folder
define('_ADLibPathImage', 'images/');

//folder for scripts i.g. extern javascript
define('_ADLibPathScript', 'layout/');

/*
***** END FOLDER SETTINGS *****
*/
/*
***** BEGIN VARIOUS SETTINGS *****
*/
//Set to 1 and the Header (image/introduce sentence) will be used! Set 0 to disable it.
define('_ENABLEHEADER', 1);

//Set to 1 and User Interface will be used! Set 0 to disable it.
define('_ENABLEUI', 0);

//This sets the default language that will be used.
define('_DEFLANG', 'en');

// Use UTC time, indicates if the records are stored in utc time
define('_UTCtime', 1);
// Show localtime, indicates if the records should be displayed in local time or utc time
define('_SHOWLocaltime', 1);
// Time format
define('_TIMEFormat', 'Y-m-d H:i:s');

// Get messages date by ReceivedAt or DeviceReportedTime
define('_DATE', 'ReceivedAt');

// Coloring priority
define('_COLPriority', 1);

// Custom Admin Message (appears on the homepage)
define('_AdminMessage', "");

// Version Number
define('_VersionMajor', "1");
define('_VersionMinor', "2");
define('_VersionPatchLevel', "3");

/*
***** END VARIOUS SETTINGS *****
*/

/*
******************************************************
* * ** * *
* From this point you shouldn't change something *
* * ** * *
* Only change if it is really required *
******************************************************
*/

// Show quick filter enabled = 1, disabled = 0:
define('_FilterInfoUnit', 1);
define('_FilterOrderby', 1);
define('_FilterRefresh', 1);
define('_FilterColExp', 1);
define('_FilterHost', 1);
define('_FilterMsg', 1);

//Session expire time. Unix-Timestamp. To set this value:
//call time(), that returns the seconds from 1.1.1970 (begin Unix-epoch) and add the
//time in seconds when the cookie should expire.
$session_time = (time()+(60*10));

//Cookie expire time. Unix-Timestamp. How to set this value, see "session_time".
define('_COOKIE_EXPIRE', (time()+60*60*24*30));
help-needed
New
 
Posts: 3
Joined: Fri Jul 06, 2007 3:16 pm

Postby mmeckelein on Mon Jul 09, 2007 11:14 am

Your config.php file looks fine. Please do the following as suggested above:

If you are getting no error, please change the following line in include.php from
Code:
// error_reporting(E_ALL);

to
Code:
error_reporting(E_ALL);


You can also check your webserver/mysql logs for error.
mmeckelein
Adiscon Support
 
Posts: 167
Joined: Wed Mar 12, 2003 12:07 pm

Google Ads



Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron