Location: PHPKode > scripts > Amailer > amailer/commono_db.php
<?
##################################################################################
# Anonymous Mailer Copyright Termix 2002 - 2003. All rights researved.           #
# Just don't change anything.                                                    #
# and don't take out the copyright even though there is an option to take it out #
# and thats all                                                                  #
# Site: http://termix.ath.cx                                                     #
# Auther: Aaron                                                                  #
# E-Mail: hide@address.com                                               #
#                                                                                #
# File: commono_db.php                                                           #
##################################################################################
//including the config.php
include "confi.php";
//common_db.php
$dbhost = "$hhost";
$dbusername = "$ssqlusername";
$dbuserpassword = "$ssqlpassword";
$default_dbname = "$ddname";
$default_sort_order = 'ASC';
$default_order_by = 'id';
$records_per_page = 5;
$mail_logname = 'maillog';

function db_connect() {
   global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
   global $MYSQL_ERRNO, $MYSQL_ERROR;

   $link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);
   if(!$link_id) {
      $MYSQL_ERRNO = 0;
      $MYSQL_ERROR = "Connection failed to the host $dbhost";
      
      return 0;
  
   }
   else return $link_id;
 }
 
 function sql_error() {
  global $MYSQL_ERRON, $MYSQl_ERROR;
  
  if(empty($MYSQL_ERROR)) {
      $MYSQL_ERRNO = mysql_errno();
      $MYSQL_ERROR = mysql_error();
      
   }
   return "$MYSQL_ERRNO: $MYSQL_ERROR";
}   


$new_win_width = 600;
$new_win_hight = 400;


function html_header() {
global $new_win_width, $new_win_hight;
?>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT": TYPE-"TEXT/JAVASCRIPT">
<!--
function open_window(url) {
   var NEW_WIN = null;
   NEW_WUN = window.open ("", "RecordViewer", "toolbar=no, width="+ <?php echo $new_win_width ?>+ ",hight="+<?php echo $new_win_hight ?>+",directories=no,status=no,scrollbars=yes,resize=no,menubar=no");
NEW_WIN.location.href = url;
}
//-->
</SCRIPT>
<TITLE> Amailer - Log Viewer</TITLE>
</HEAD>
<BODY>
<?
}
function html_footer() {
?>
</BODY>
</HTML>
<?
}
function error_message($msg) {
   html_header();
   echo "<SCRIPT>alert(\"Error: $msg\");history.go(-1)</SCRIPT>";
   html_footer();
   exit;
 }
$link_id = db_connect();
if(!$link_id) die(sql_error());

mysql_select_db("$default_dbname");
if(!mysql_select_db("$default_dbname")) die("<b><h1>" .sql_error() . "</h1><br><hr><br><font color=\"#800000\" size=\"4\">Please run your setup.php to creat your database!</font>");
?>
Return current item: Amailer