mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
Fix - examples: Security updates to the server-side processing demo scripts from Chris Wright - specifically no MySQL error strings are shown to the end user.
This commit is contained in:
parent
284658e3c9
commit
dc3f9b148e
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -124,13 +138,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -139,7 +153,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -124,13 +138,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -139,7 +153,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -2,11 +2,30 @@
|
||||
/* MySQL connection */
|
||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); /* ;-) */
|
||||
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
|
||||
/* Paging */
|
||||
$sLimit = "";
|
||||
@ -65,12 +84,12 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -78,7 +97,7 @@
|
||||
SELECT COUNT(id)
|
||||
FROM ajax
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -124,13 +138,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -139,7 +153,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -124,13 +138,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -139,7 +153,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -124,13 +138,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -139,7 +153,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -126,13 +140,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -141,7 +155,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -126,13 +140,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -141,7 +155,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,14 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -123,13 +137,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -138,7 +152,7 @@
|
||||
SELECT COUNT(".$sIndexColumn.")
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -29,15 +29,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
/*
|
||||
* Paging
|
||||
@ -45,8 +58,8 @@
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
|
||||
mysql_real_escape_string( $_GET['iDisplayLength'] );
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
@ -124,13 +137,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -139,7 +152,7 @@
|
||||
SELECT COUNT(`".$sIndexColumn."`)
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
@ -111,14 +111,28 @@
|
||||
* no need to edit below this line
|
||||
*/
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
function fatal_error ( $sErrorMessage = '' )
|
||||
{
|
||||
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
|
||||
die( $sErrorMessage );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MySQL connection
|
||||
*/
|
||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
||||
die( 'Could not open connection to server' );
|
||||
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||
{
|
||||
fatal_error( 'Could not open connection to server' );
|
||||
}
|
||||
|
||||
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
|
||||
die( 'Could not select database '. $gaSql['db'] );
|
||||
if ( ! mysql_select_db( $gaSql['db'], $gaSql['link'] ) )
|
||||
{
|
||||
fatal_error( 'Could not select database ' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -203,13 +217,13 @@
|
||||
$sOrder
|
||||
$sLimit
|
||||
";
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
|
||||
/* Data set length after filtering */
|
||||
$sQuery = "
|
||||
SELECT FOUND_ROWS()
|
||||
";
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||
$iFilteredTotal = $aResultFilterTotal[0];
|
||||
|
||||
@ -218,7 +232,7 @@
|
||||
SELECT COUNT(`".$sIndexColumn."`)
|
||||
FROM $sTable
|
||||
";
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
|
||||
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user