<?php
//$db->debug_all= true;
$db->use_disk_cache = false;
$db->cache_queries = false;
$cloak = 1;
$ezsql_version = EZSQL_VERSION;
// check if PageNum param passsed
$PageNum = isset($_GET['PageNum'])?(int)$_GET['PageNum']:1;
// rows per page
$PageSize = 3;
// start offset for mySQL query
$startIndex = $PageSize*($PageNum-1);
$TBS = new clsTinyButStrong ;
//$TBS->LoadTemplate('bypage_eff_ezsql.html') ;
$TBS->LoadTemplate(basename($_SERVER['SCRIPT_NAME'], ".php").".html") ;
$sql = "SELECT SQL_CALC_FOUND_ROWS id,lname,fname,email,ph_home FROM mycontacts ORDER BY lname LIMIT $startIndex,$PageSize";
$query = $db->get_results($sql); // do the basic query using SQL_CALC_FOUND_ROWS trick
//$db2->debug();
$TBS->MergeBlock('blk', $db);
$found = $db->get_row("SELECT FOUND_ROWS() as rows");
$rowCount = $found->rows;
$RecCnt = $found->rows;
//$TBS->MergeNavigationBar('nv',10,$PageNum,$rowCount,$pageSize); // get rid of this - change to TBS v3.00 plugin below
$TBS->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt,$PageSize) ;
$TBS->Show() ;
// ======================== ondata funcs ==========================
function f_mail_cloak($BlockName,&$CurrRec,$RecNum) {
// === TJH === this func assumes you already have tested to be sure you have a properly formatted email address
$db_email_field = "email";
$db_caption_field = $CurrRec['fname']." ".$CurrRec['lname'];
if($CurrRec[$db_email_field]!=""){
$saddress = $CurrRec[$db_email_field]; // the field that holds the email address to be cloaked
$scaption= "eMail ".$db_caption_field; // the caption/ link text label
$stitle= "eMail ".$db_caption_field; // the mouseover field of subject/title
$subject="The subject of email cloaking";
$pathtoform = "/contact/"; // If the user has js turned off (or bad browser) this should link to a default contact form location
$eaddress= ""; $sdomain= ""; $aextra = "";
//begin parsing
list($eaddress, $sdomain)= split('@', $saddress);
$sdomain = ereg_replace('\.', '#', $sdomain);
//create the js address
$smailme = "makeupStamp('".urlencode( $sdomain );
if($subject != ""){
$smailme .= "?subject=" . trim($subject) ;
}
$smailme .= "','" . urlencode( $eaddress ) . "')";
//build the js events
// $sbuild =' onmouseover="javascript:this.href=$smailme;"';
// $sbuild.=' onfocus="javascript:this.href=$smailme;" ';
//return
// $CurrRec['email'] = '<a href="" onmouseover="javascript:this.href='.$smailme.';" onfocus="javascript:this.href='.$smailme.';" title="'.$stitle.'">'.$scaption.'</a>'; // === WORKS === use this if no image desired ===
$CurrRec[$db_email_field] = '<a href="'.$pathtoform.'" onmouseover="javascript:this.href='.$smailme.';" onfocus="javascript:this.href='.$smailme.';" title="'.$stitle.'"><img border=0 hspace=2 vspace=2 src="emailButton.png"></a>';
}
else{
$CurrRec[$db_email_field] = 'no';
}
}// === END === TBS ondata function
?>