/// database details
$db_host= "localhost";
$db_username="fr1224_ecgusa";
$db_password="ecgusa123";
$db_name ="fr1224_ecgusa";
$conn = mysql_connect($db_host,$db_username,$db_password) or die("Could not connect to Server" .mysql_error());
mysql_select_db($db_name) or die("Could not connect to Database" .mysql_error());
function getSqlQuery($query) {
$result = mysql_query($query) or die(mysql_error());
return $result;
}
function getSqlFetch($rs) {
$res = mysql_fetch_assoc($rs);
return $res;
}
function getSqlRow($query) {
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
mysql_free_result($result);
return $row;
}
function getSqlNumber($sqlQuery) {
$query=@mysql_query($sqlQuery);
$result=@mysql_num_rows($query);
@mysql_free_result($query);
return $result;
}
function getSqlField($sqlQuery,$field) {
$isQuery = getSqlNumber($sqlQuery);
$query = @mysql_query($sqlQuery) or die (mysql_error()."
INVALID QUERY: ".$sqlQuery);
if ($isQuery>0) {
$result=@mysql_result($query,0,$field);
} else $result="n/a";
@mysql_free_result($query);
return $result;
}
function deleteFile($filepath,$filename) {
$success = FALSE;
if (file_exists($filepath.$filename)&&$filename!=""&&$filename!="n/a") {
unlink ($filepath.$filename);
$success = TRUE;
}
return $success;
}
function uploadFile($file,$destDir) {
$success = FALSE;
if (move_uploaded_file($file,$destDir))
{
$success = TRUE;
}
return $success;
}
function paginate($start,$limit,$total,$filePath,$otherParams) {
global $lang;
$allPages = ceil($total/$limit);
$currentPage = floor($start/$limit) + 1;
$pagination = "";
if ($allPages>10) {
$maxPages = ($allPages>9) ? 9 : $allPages;
if ($allPages>9) {
if ($currentPage>=1&&$currentPage<=$allPages) {
$pagination .= ($currentPage>4) ? " ... " : " ";
$minPages = ($currentPage>4) ? $currentPage : 5;
$maxPages = ($currentPage<$allPages-4) ? $currentPage : $allPages - 4;
for($i=$minPages-4; $i<$maxPages+5; $i++) {
$pagination .= ($i == $currentPage) ? "[".$i."] " : "".$i." ";
}
$pagination .= ($currentPage<$allPages-4) ? " ... " : " ";
} else {
$pagination .= " ... ";
}
}
} else {
for($i=1; $i<$allPages+1; $i++) {
$pagination .= ($i==$currentPage) ? "[".$i."] " : "".$i." ";
}
}
if ($currentPage>1) $pagination = "[first] [prev] ".$pagination;
if ($currentPage<$allPages) $pagination .= " [next] [last]";
echo $pagination;
}
function randomPrefix($length)
{
$random= "";
srand((double)microtime()*1000000);
$data = "AbcDE123IJKLMN67QRSTUVWXYZ";
$data .= "aBCdefghijklmn123opq45rs67tuv89wxyz";
$data .= "0FGH45OP89";
for($i = 0; $i < $length; $i++)
{
$random .= substr($data, (rand()%(strlen($data))), 1);
}
return $random;
}
?>
Advent Technology
|
Forgot Password |
|
Please enter your Email to start the password recovery process. |
|
|