/** * @desc function destructor */ function __destruct() { //$this->free_result(); dbcon::$instance = false; }
function dbConnect() { $dbcon = new dbcon(); $db = $dbcon->getConnection(); return $db; }
<?php session_start(); if (!session_is_registered(myusername)) { $url = "http://" . $_SERVER['HTTP_HOST'] . "/"; die('<script type="text/javascript">window.location=\'' . $url . '\';</script>'); } //include 'dbcon.php'; include "/seudot/class_coll.php"; $dbcon = new dbcon(); $dbcon->con2db(); date_default_timezone_set('Asia/Jerusalem'); $select = $_REQUEST['xls_query']; $xls_filename = $_REQUEST['filename']; $filedate = date("Y-m-d_h-i-sa"); $xls_filename = $xls_filename . $filedate; $result = @mysql_query($select) or die("Failed to execute query:<br />" . mysql_error() . "<br />" . mysql_errno()); // Header info settings header("Content-Type: application/xls"); header("Content-Disposition: attachment; filename={$xls_filename}"); header("Pragma: no-cache"); header("Expires: 0"); /***** Start of Formatting for Excel *****/ // Define separator (defines columns in excel & tabs in word) $sep = "\t"; // tabbed character // Start of printing column names as names of MySQL fields for ($i = 0; $i < mysql_num_fields($result); $i++) { echo mysql_field_name($result, $i) . "\t"; } print "\n";