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
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -139,7 +153,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -139,7 +153,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -2,11 +2,30 @@
|
|||||||
/* MySQL connection */
|
/* MySQL connection */
|
||||||
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); /* ;-) */
|
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_select_db( $gaSql['db'], $gaSql['link'] ) or
|
/*
|
||||||
die( 'Could not select database '. $gaSql['db'] );
|
* 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 ' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Paging */
|
/* Paging */
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
@ -65,12 +84,12 @@
|
|||||||
$sOrder
|
$sOrder
|
||||||
$sLimit
|
$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 = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -78,7 +97,7 @@
|
|||||||
SELECT COUNT(id)
|
SELECT COUNT(id)
|
||||||
FROM ajax
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -139,7 +153,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -139,7 +153,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -139,7 +153,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -141,7 +155,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -141,7 +155,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,14 +29,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -138,7 +152,7 @@
|
|||||||
SELECT COUNT(".$sIndexColumn.")
|
SELECT COUNT(".$sIndexColumn.")
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -29,24 +29,37 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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 ' );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paging
|
* Paging
|
||||||
*/
|
*/
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||||
{
|
{
|
||||||
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
|
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||||
mysql_real_escape_string( $_GET['iDisplayLength'] );
|
intval( $_GET['iDisplayLength'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,13 +137,13 @@
|
|||||||
$sOrder
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -139,7 +152,7 @@
|
|||||||
SELECT COUNT(`".$sIndexColumn."`)
|
SELECT COUNT(`".$sIndexColumn."`)
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
@ -111,14 +111,28 @@
|
|||||||
* no need to edit below this line
|
* 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
|
* MySQL connection
|
||||||
*/
|
*/
|
||||||
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
|
if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )
|
||||||
die( 'Could not open connection to server' );
|
{
|
||||||
|
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
|
$sOrder
|
||||||
$sLimit
|
$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 */
|
/* Data set length after filtering */
|
||||||
$sQuery = "
|
$sQuery = "
|
||||||
SELECT FOUND_ROWS()
|
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);
|
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
|
||||||
$iFilteredTotal = $aResultFilterTotal[0];
|
$iFilteredTotal = $aResultFilterTotal[0];
|
||||||
|
|
||||||
@ -218,7 +232,7 @@
|
|||||||
SELECT COUNT(`".$sIndexColumn."`)
|
SELECT COUNT(`".$sIndexColumn."`)
|
||||||
FROM $sTable
|
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);
|
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||||
$iTotal = $aResultTotal[0];
|
$iTotal = $aResultTotal[0];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user