diff -r 1d6e762433fe -r 0acb8d9a3194 htdocs/snippets.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htdocs/snippets.php Mon Aug 25 12:34:26 2008 -0400 @@ -0,0 +1,164 @@ +user_level < USER_LEVEL_ADMIN ) +{ + die_friendly('Access denied', '
Admin rights needed to use this script.
'); +} + +$db->close(); +unset($db, $session, $paths, $template, $plugins); +*/ + +// We're authed. +// Load config +require(ENANOBOT_ROOT . 'config.php'); + +// check config +if ( empty($mysql_host) || empty($mysql_user) || empty($mysql_dbname) ) +{ + die("Bad config file - have a look at config-sample.php.\n"); +} + +// connect to MySQL +$mysql_conn = @mysql_connect($mysql_host, $mysql_user, $mysql_pass); +if ( !$mysql_conn ) +{ + $m_e = mysql_error(); + echo "Error connecting to MySQL: $m_e\n"; + exit(1); +} +$q = @mysql_query('USE `' . $mysql_dbname . '`;', $mysql_conn); +if ( !$q ) +{ + $m_e = mysql_error(); + echo "Error selecting database: $m_e\n"; + exit(1); +} + +function mysql_die() +{ + $m_e = mysql_error(); + die("MySQL error: $m_e"); +} + +?> + + +