diff -r 8f62a406d9d9 -r fcc1eac04772 snippets.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/snippets.php Wed May 07 23:56:26 2008 -0400 @@ -0,0 +1,162 @@ +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"); +} + +?> + + +