__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* RecordSet to HTML Table
*
* Convert a recordset to a html table. Multiple tables are generated
* if the number of rows is > $gSQLBlockRows. This is because
* web browsers normally require the whole table to be downloaded
* before it can be rendered, so we break the output into several
* smaller, faster rendering tables.
*
* This file is part of ADOdb, a Database Abstraction Layer library for PHP.
*
* @package ADOdb
* @link https://adodb.org Project's web site and documentation
* @link https://github.com/ADOdb/ADOdb Source code and issue tracker
*
* The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
* and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
* any later version. This means you can use it in proprietary products.
* See the LICENSE.md file distributed with this source code for details.
* @license BSD-3-Clause
* @license LGPL-2.1-or-later
*
* @copyright 2000-2013 John Lim
* @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
*/
// specific code for tohtml
GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND;
$ADODB_ROUND=4; // rounding
$gSQLMaxRows = 1000; // max no of rows to download
$gSQLBlockRows=20; // max no of rows per table block
// $rs: the recordset
// $ztabhtml: the table tag attributes (optional)
// $zheaderarray: contains the replacement strings for the headers (optional)
//
// USAGE:
// include('adodb.inc.php');
// $db = ADONewConnection('mysql');
// $db->Connect('mysql','userid','password','database');
// $rs = $db->Execute('select col1,col2,col3 from table');
// rs2html($rs, 'BORDER=2', array('Title1', 'Title2', 'Title3'));
// $rs->Close();
//
// RETURNS: number of rows displayed
function rs2html(&$rs,$ztabhtml=false,$zheaderarray=false,$htmlspecialchars=true,$echo = true)
{
$s ='';$rows=0;$docnt = false;
GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND;
if (!$rs) {
printf(ADODB_BAD_RS,'rs2html');
return false;
}
if (! $ztabhtml) $ztabhtml = "BORDER='1' WIDTH='98%'";
//else $docnt = true;
$typearr = array();
$ncols = $rs->FieldCount();
$hdr = "<TABLE COLS=$ncols $ztabhtml><tr>\n\n";
for ($i=0; $i < $ncols; $i++) {
$field = $rs->FetchField($i);
if ($field) {
if ($zheaderarray) $fname = $zheaderarray[$i];
else $fname = htmlspecialchars($field->name);
$typearr[$i] = $rs->MetaType($field->type,$field->max_length);
//print " $field->name $field->type $typearr[$i] ";
} else {
$fname = 'Field '.($i+1);
$typearr[$i] = 'C';
}
if (strlen($fname)==0) $fname = ' ';
$hdr .= "<TH>$fname</TH>";
}
$hdr .= "\n</tr>";
if ($echo) print $hdr."\n\n";
else $html = $hdr;
// smart algorithm - handles ADODB_FETCH_MODE's correctly by probing...
$numoffset = isset($rs->fields[0]) ||isset($rs->fields[1]) || isset($rs->fields[2]);
while (!$rs->EOF) {
$s .= "<TR valign=top>\n";
for ($i=0; $i < $ncols; $i++) {
if ($i===0) $v=($numoffset) ? $rs->fields[0] : reset($rs->fields);
else $v = ($numoffset) ? $rs->fields[$i] : next($rs->fields);
$type = $typearr[$i];
switch($type) {
case 'D':
if (strpos($v,':') !== false);
else {
if (empty($v)) {
$s .= "<TD> </TD>\n";
} else {
$s .= " <TD>".$rs->UserDate($v,"D d, M Y") ."</TD>\n";
}
break;
}
case 'T':
if (empty($v)) $s .= "<TD> </TD>\n";
else $s .= " <TD>".$rs->UserTimeStamp($v,"D d, M Y, H:i:s") ."</TD>\n";
break;
case 'N':
if (abs(abs($v) - round($v,0)) < 0.00000001)
$v = round($v);
else
$v = round($v,$ADODB_ROUND);
case 'I':
$vv = $v ? stripslashes(trim($v)) : '';
$vv = $vv ?: ' ';
if (strlen($vv) == 0) $vv .= ' ';
$s .= " <TD align=right>".$vv ."</TD>\n";
break;
/*
case 'B':
if (substr($v,8,2)=="BM" ) $v = substr($v,8);
$mtime = substr(str_replace(' ','_',microtime()),2);
$tmpname = "tmp/".uniqid($mtime).getmypid();
$fd = @fopen($tmpname,'a');
@ftruncate($fd,0);
@fwrite($fd,$v);
@fclose($fd);
if (!function_exists ("mime_content_type")) {
function mime_content_type ($file) {
return exec("file -bi ".escapeshellarg($file));
}
}
$t = mime_content_type($tmpname);
$s .= (substr($t,0,5)=="image") ? " <td><img src='$tmpname' alt='$t'></td>\\n" : " <td><a
href='$tmpname'>$t</a></td>\\n";
break;
*/
default:
if ($v) {
$v = trim($v);
if ($htmlspecialchars) {
$v = htmlspecialchars($v);
}
} elseif ($v === null) {
$v = '(NULL)';
} else {
$v = ' ';
}
$s .= " <TD>" . str_replace("\n", '<br>', $v) . "</TD>\n";
}
} // for
$s .= "</TR>\n\n";
$rows += 1;
if ($rows >= $gSQLMaxRows) {
$rows = "<p>Truncated at $gSQLMaxRows</p>";
break;
} // switch
$rs->MoveNext();
// additional EOF check to prevent a widow header
if (!$rs->EOF && $rows % $gSQLBlockRows == 0) {
//if (connection_aborted()) break;// not needed as PHP aborts script, unlike ASP
if ($echo) print $s . "</TABLE>\n\n";
else $html .= $s ."</TABLE>\n\n";
$s = $hdr;
}
} // while
if ($echo) print $s."</TABLE>\n\n";
else $html .= $s."</TABLE>\n\n";
if ($docnt) if ($echo) print "<H2>".$rows." Rows</H2>";
return ($echo) ? $rows : $html;
}
// pass in 2 dimensional array
function arr2html(&$arr,$ztabhtml='',$zheaderarray='')
{
if (!$ztabhtml) $ztabhtml = 'BORDER=1';
$s = "<TABLE $ztabhtml>";//';print_r($arr);
if ($zheaderarray) {
$s .= '<TR>';
for ($i=0; $i<sizeof($zheaderarray); $i++) {
$s .= " <TH>{$zheaderarray[$i]}</TH>\n";
}
$s .= "\n</TR>";
}
for ($i=0; $i<sizeof($arr); $i++) {
$s .= '<TR>';
$a = $arr[$i];
if (is_array($a))
for ($j=0; $j<sizeof($a); $j++) {
$val = $a[$j];
if (empty($val)) $val = ' ';
$s .= " <TD>$val</TD>\n";
}
else if ($a) {
$s .= ' <TD>'.$a."</TD>\n";
} else $s .= " <TD> </TD>\n";
$s .= "\n</TR>\n";
}
$s .= '</TABLE>';
print $s;
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| datadict | Folder | 0777 |
|
|
| drivers | Folder | 0777 |
|
|
| lang | Folder | 0777 |
|
|
| perf | Folder | 0777 |
|
|
| xsl | Folder | 0777 |
|
|
| LICENSE.md | File | 25.79 KB | 0777 |
|
| README.md | File | 4.32 KB | 0777 |
|
| SECURITY.md | File | 1.37 KB | 0777 |
|
| adodb-active-record.inc.php | File | 27.92 KB | 0777 |
|
| adodb-active-recordx.inc.php | File | 37.82 KB | 0777 |
|
| adodb-csvlib.inc.php | File | 8.62 KB | 0777 |
|
| adodb-datadict.inc.php | File | 28.53 KB | 0777 |
|
| adodb-error.inc.php | File | 9.21 KB | 0777 |
|
| adodb-errorhandler.inc.php | File | 3.31 KB | 0777 |
|
| adodb-errorpear.inc.php | File | 2.84 KB | 0777 |
|
| adodb-exceptions.inc.php | File | 2.92 KB | 0777 |
|
| adodb-lib.inc.php | File | 38.83 KB | 0777 |
|
| adodb-loadbalancer.inc.php | File | 26.22 KB | 0777 |
|
| adodb-memcache.lib.inc.php | File | 9.55 KB | 0777 |
|
| adodb-pager.inc.php | File | 7.87 KB | 0777 |
|
| adodb-pear.inc.php | File | 9.63 KB | 0777 |
|
| adodb-perf.inc.php | File | 30.53 KB | 0777 |
|
| adodb-time.inc.php | File | 42.8 KB | 0777 |
|
| adodb-xmlschema.inc.php | File | 54.01 KB | 0777 |
|
| adodb-xmlschema03.inc.php | File | 61.43 KB | 0777 |
|
| adodb.inc.php | File | 153.97 KB | 0777 |
|
| index.html | File | 0 B | 0777 |
|
| phpdoc | File | 732 B | 0777 |
|
| phpdoc.dist.xml | File | 542 B | 0777 |
|
| pivottable.inc.php | File | 6.46 KB | 0777 |
|
| readme_moodle.txt | File | 714 B | 0777 |
|
| rsfilter.inc.php | File | 1.74 KB | 0777 |
|
| toexport.inc.php | File | 3.69 KB | 0777 |
|
| tohtml.inc.php | File | 5.84 KB | 0777 |
|
| xmlschema.dtd | File | 1.42 KB | 0777 |
|
| xmlschema03.dtd | File | 1.64 KB | 0777 |
|