$mydb = new db(); $mydb->connect(); // Upload Images Function function upload_image($file, $folder, $file_name){ $uploaded_image_path = ""; if($file['name'] != ""){ if (($file['type'] == "image/gif") || ($file['type'] == "image/jpg") || ($file['type'] == "image/pjpeg") || ($file['type'] == "image/jpeg")){ $ext = strtolower(substr($file['name'], -3, 3)); $uploaded_image_path = $folder . $file_name.".". $ext; copy($file['tmp_name'], "../" . $uploaded_image_path) or die("Could not upload the image"); } } return $uploaded_image_path; } //end of upload image function //######################################################### // Delete File function delFile($file){ if( is_file($file) and file_exists($file) ){ unlink($file); return true; } else return false; } //end of delete File function //######################################################### function validImage($file_path){ if(is_file($file_path) and file_exists($file_path)) return true; else return false; } function showImage($image, $width, $height, $alt="", $title="") { if(validImage($image)){ if($width=="") $w = ""; else $w = "width=$width"; if($height=="") $h = ""; else $h = "height=$height"; $alt = ($alt=="")?"":" alt='".$alt."'"; $title = ($title=="")?"":" title='".$title."'"; echo ""; } else echo ""; } // end of showimage //######################################################### function showLink($value,$path) { echo "$value"; } //######################################################### function myDate($date) { if($date != NULL or $date != '') return date("d-m-Y",strtotime($date)); } //######################################################### function sendmail($mailTo, $mailFrom, $mailFromName, $mailSubject, $mailMessage ) { $mailCharset = "charset=iso-8859-1"; // must be accurate (e.g. "Windows - 1252" is invalid) $headers = "From: $mailFromName <$mailFrom>\r\n"; $headers .= "Content-type: text/html; charset=$mailCharset\r\n"; if(mail($mailTo, $mailSubject, stripslashes($mailMessage), $headers)) return true; }//End of function sendMail // Function that returns the value of next or previous month function cal_month($year, $month, $move){ switch($move){ case 'n'; if($month==12){ $month=1; $year++; } else{ $month++; } break; case 'p'; if($month==1) { $month=12; $year--; } else { $month--; } break; } return $year.'-'.$month.'-01'; }// End of Function //############################################################ function micro_time($start_time) { list($usec, $sec) = explode(" ", microtime()); $micro_time = ((float)$usec + (float)$sec); if ($start_time == 0) { return $micro_time; } else { $total_time = $micro_time - $start_time; return $total_time; } } //############################################################# function pagination($total_pages, $on_page, $base_url){ $base_url .= (strpos($base_url, '?') === false) ? '?' : '&'; $seperator = ' '; if ($total_pages <2 ) { return false; } $page_string='
switch ($_GET['pag'])
{
case "videos":
include "videos.php";
break;
case "news":
include "news.php";
break;
case "u-news":
include "unews.php";
break;
case "gallery":
include "gallery.php";
break;
case "books":
include "books.php";
break;
case "pdfbooks":
include "pdfbooks.php";
break;
case "readbook":
include "readbook.php";
break;
case "transcript":
include "transcript.php";
break;
case "comments":
include "comments.php";
break;
case "u-comments":
include "ucomments.php";
break;
case "detail":
include "detail.php";
break;
default:
include "main.php";
}
?>
|