X7ROOT File Manager
Current Path:
/var/www/vhosts/hwtw.com.tw/httpdocs/backend/func
var
/
www
/
vhosts
/
hwtw.com.tw
/
httpdocs
/
backend
/
func
/
📁
..
📁
form_elements
📄
form_func.php
(2.16 KB)
📄
func.php
(16.64 KB)
📄
send_mail.php
(114 B)
Editing: func.php
<?php function backend_page_function($rs, $PHPSELF, $last_page, $arr) { if (!empty($arr)) { while (list($kk, $vv) = each($arr)) { $tmp1 .= "$kk=$vv&"; } } $tmp1 = substr($tmp1, 0, strlen($tmp1) - 1); if (strlen($tmp1) > 0) $tmp1 = '&' . $tmp1; $tmp2 = '【 <a href="' . $PHPSELF . '?next_page=1' . $tmp1 . '">最前頁</a> | <a href="' . $PHPSELF . '?next_page=' . ($rs->AbsolutePage() - 1) . $tmp1 . '">上一頁</a> | <a href="' . $PHPSELF . '?next_page=' . ($rs->AbsolutePage() + 1) . $tmp1 . '">下一頁</a>| <a href="' . $PHPSELF . '?next_page=' . $last_page . $tmp1 . '">最後頁</a> 】' . "( " . $rs->AbsolutePage() . " / $last_page )"; return $tmp2; } function msg_box($msg) { if ($msg != "") { echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; echo '<script language="javascript">alert("' . $msg . '");</script>'; } return ""; } function go_to($go) { if ($go == 1 || $go == -1) echo '<script language="javascript">history.go(' . $go . ')</script>'; elseif ($go == -2) echo '<script language="javascript">history.back()</script>'; else echo '<script language="javascript">window.location="' . $go . '"</script>'; } function p_go_to($go) { if ($go == 1 || $go == -1) echo '<script language="javascript">history.go(' . $go . ')</script>'; elseif ($go == -2) echo '<script language="javascript">history.back()</script>'; else echo '<script language="javascript">parent.window.location="' . $go . '"</script>'; } function get_client_ip() { global $_SERVER; if (isset($_SERVER['HTTP_VIA']) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { list($IP, $USE_DNS) = split(",", $_SERVER['HTTP_X_FORWARDED_FOR']); $PROXY = $_SERVER['REMOTE_ADDR']; } else { $IP = $_SERVER['REMOTE_ADDR']; } return $IP; } function GetSQLValueString($theValue) { //$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; if (version_compare(PHP_VERSION, '5.3.0', '<')) { if (get_magic_quotes_gpc()) { if ($theValue != '') { $theValue = stripslashes($theValue); } } } //$theValue = function_exists("mysql_real_escape_string") ?mysql_real_escape_string($theValue) : mysql_escape_string($theValue); $theValue = mysql_real_escape_string($theValue); return $theValue; } /* * 生成MENU * $arr_menu menu array * $now_menu_id */ function Make_Menu($arr_menu) { global $now_menu; $now_menu_id = $now_menu['id']; if (is_array($arr_menu)) { foreach ($arr_menu as $kk => $vv) { //是否有SUB MENU if (is_array($vv['sub_menu'])) { if (in_array($now_menu_id, $vv['sub_menu_id'])) { echo '<li class="dropdown open active">'; } else { echo '<li class="dropdown">'; } echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $vv['menu_name'] . '<b class="caret"></b></a>'; echo '<ul class="dropdown-menu open">'; foreach ($vv['sub_menu'] as $kkk => $vvv) { if ($vvv['is_blank'] == '1') { $is_blank = 'target="_blank"'; } else { $is_blank = ''; } if ($now_menu_id == $vvv['id']) { echo '<li class="active"><a href="' . $vvv['menu_path'] . '" ' . $is_blank . '>' . $vvv['menu_name'] . '</a></li>'; $now_menu['path'] = $vv['menu_name'] . ' > ' . $vvv['menu_name']; } else { echo '<li><a href="' . $vvv['menu_path'] . '" ' . $is_blank . '>' . $vvv['menu_name'] . '</a></li>'; } } echo '</ul>'; echo '</li>'; } else { if ($vv['is_blank'] == '1') { $is_blank = 'target="_blank"'; } else { $is_blank = ''; } if ($now_menu_id == $vv['id']) { echo '<li class="active"><a href="' . $vv['menu_path'] . '" ' . $is_blank . '>' . $vv['menu_name'] . '</a></li>'; $now_menu['path'] = $vv['menu_name']; } else { echo '<li><a href="' . $vv['menu_path'] . '" ' . $is_blank . '>' . $vv['menu_name'] . '</a></li>'; } } } } } function Get_Menu_Data($filename) { global $db; $menu_path = basename($filename); $strSQL = "select * from u_menu_detail where menu_path='{$menu_path}'"; $rs = $db->Execute($strSQL); if ($rs->EOF) { return 0; } else { $now_menu['id'] = $rs->fields['id']; $now_menu['menu_name'] = $rs->fields['menu_name']; $now_menu['func_page'] = basename($filename, '.php'); return $now_menu; } } function ImageResize($from_filename, $save_filename = '', $in_width = 400, $in_height = 300, $quality = 100) { $allow_format = array('jpeg', 'png', 'gif'); $sub_name = $t = ''; // Get new dimensions $img_info = getimagesize($from_filename); $width = $img_info['0']; $height = $img_info['1']; $imgtype = $img_info['2']; $imgtag = $img_info['3']; $bits = $img_info['bits']; $channels = $img_info['channels']; $mime = $img_info['mime']; list($t, $sub_name) = split('/', $mime); if ($sub_name == 'jpg') { $sub_name = 'jpeg'; } if (!in_array($sub_name, $allow_format)) { return false; } // 取得縮在此範圍內的比例 $percent = getResizePercent($width, $height, $in_width, $in_height); $new_width = $width * $percent; $new_height = $height * $percent; // Resample $image_new = imagecreatetruecolor($new_width, $new_height); // $function_name: set function name // => imagecreatefromjpeg, imagecreatefrompng, imagecreatefromgif /* // $sub_name = jpeg, png, gif $function_name = 'imagecreatefrom'.$sub_name; $image = $function_name($filename); //$image = imagecreatefromjpeg($filename); */ switch ($sub_name) { case 'jpeg': $image = imagecreatefromjpeg($from_filename); break; case 'png': $image = imagecreatefrompng($from_filename); break; case 'gif': $image = imagecreatefromgif($from_filename); break; } imagecopyresampled($image_new, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); //return imagejpeg($image_new, $save_filename, $quality); //header('Content-type: image/jpeg'); imagejpeg($image_new, $save_filename, $quality); imagedestroy($image_new); } /** * 抓取要縮圖的比例 * $source_w : 來源圖片寬度 * $source_h : 來源圖片高度 * $inside_w : 縮圖預定寬度 * $inside_h : 縮圖預定高度 * * Test: * $v = (getResizePercent(1024, 768, 400, 300)); * echo 1024 * $v . "\n"; * echo 768 * $v . "\n"; */ function getResizePercent($source_w, $source_h, $inside_w, $inside_h) { if ($source_w < $inside_w && $source_h < $inside_h) { return 1; // Percent = 1, 如果都比預計縮圖的小就不用縮 } $w_percent = $inside_w / $source_w; $h_percent = $inside_h / $source_h; return ($w_percent > $h_percent) ? $h_percent : $w_percent; } function fore_page($curr_page, $last_page, $arg = '') { if ($last_page <= 0) { return 0; } if (is_array($arg)) { foreach ($arg as $kk => $vv) { $page_tmp .= "{$kk}={$vv}&"; } } echo '<ul class="pagination pagination-sm">'; if ($curr_page <= 1) { echo '<li class="disabled"> <a href="#" onclick="return false;">«</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=1">«</a> </li>'; } for ($i = 1; $i <= $last_page; $i++) { if ($i == $curr_page) { echo '<li class="active"> <a href="?' . $page_tmp . 'curr_page=' . $i . '">' . $i . '</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $i . '">' . $i . '</a> </li>'; } } if ($curr_page >= $last_page) { echo '<li class="disabled"> <a href="#" onclick="return false;">»</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $last_page . '">»</a> </li>'; } echo '</ul>'; } function fore_page1($curr_page, $last_page, $arg = '', $class_id) { if ($last_page <= 0) { return 0; } if (is_array($arg)) { foreach ($arg as $kk => $vv) { $page_tmp .= "{$kk}={$vv}&"; } } echo '<ul class="pagination pagination-sm">'; if ($curr_page <= 1) { echo '<li class="disabled"> <a href="#" onclick="return false;">«</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=1&class_id=' . $class_id . '">«</a> </li>'; } for ($i = 1; $i <= $last_page; $i++) { if ($i == $curr_page) { echo '<li class="active"> <a href="?' . $page_tmp . 'curr_page=' . $i . '&class_id=' . $class_id . '">' . $i . '</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $i . '&class_id=' . $class_id . '">' . $i . '</a> </li>'; } } if ($curr_page >= $last_page) { echo '<li class="disabled"> <a href="#" onclick="return false;">»</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $last_page . '&class_id=' . $class_id . '">»</a> </li>'; } echo '</ul>'; } function fore_page2($curr_page, $last_page, $arg = '', $unit) { if ($last_page <= 0) { return 0; } if (is_array($arg)) { foreach ($arg as $kk => $vv) { $page_tmp .= "{$kk}={$vv}&"; } } echo '<ul class="pagination pagination-sm">'; if ($curr_page <= 1) { echo '<li class="disabled"> <a href="#" onclick="return false;">«</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=1&unit=' . $unit . '">«</a> </li>'; } for ($i = 1; $i <= $last_page; $i++) { if ($i == $curr_page) { echo '<li class="active"> <a href="?' . $page_tmp . 'curr_page=' . $i . '&unit=' . $unit . '">' . $i . '</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $i . '&unit=' . $unit . '">' . $i . '</a> </li>'; } } if ($curr_page >= $last_page) { echo '<li class="disabled"> <a href="#" onclick="return false;">»</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $last_page . '&unit=' . $unit . '">»</a> </li>'; } echo '</ul>'; } function fore_page4($curr_page, $last_page, $arg = '', $type) { if ($last_page <= 0) { return 0; } if (is_array($arg)) { foreach ($arg as $kk => $vv) { $page_tmp .= "{$kk}={$vv}&"; } } echo '<ul class="pagination pagination-sm">'; if ($curr_page <= 1) { echo '<li class="disabled"> <a href="#" onclick="return false;">«</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=1&type=' . $type . '">«</a> </li>'; } for ($i = 1; $i <= $last_page; $i++) { if ($i == $curr_page) { echo '<li class="active"> <a href="?' . $page_tmp . 'curr_page=' . $i . '&type=' . $type . '">' . $i . '</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $i . '&type=' . $type . '">' . $i . '</a> </li>'; } } if ($curr_page >= $last_page) { echo '<li class="disabled"> <a href="#" onclick="return false;">»</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $last_page . '&type=' . $type . '">»</a> </li>'; } echo '</ul>'; } function fore_page5($curr_page, $last_page, $arg = '', $class_id, $type) { if ($last_page <= 0) { return 0; } if (is_array($arg)) { foreach ($arg as $kk => $vv) { $page_tmp .= "{$kk}={$vv}&"; } } echo '<ul class="pagination pagination-sm">'; if ($curr_page <= 1) { echo '<li class="disabled"> <a href="#" onclick="return false;">«</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=1&class_id=' . $class_id . '&type=' . $type . '">«</a> </li>'; } for ($i = 1; $i <= $last_page; $i++) { if ($i == $curr_page) { echo '<li class="active"> <a href="?' . $page_tmp . 'curr_page=' . $i . '&class_id=' . $class_id . '&type=' . $type . '">' . $i . '</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $i . '&class_id=' . $class_id . '&type=' . $type . '">' . $i . '</a> </li>'; } } if ($curr_page >= $last_page) { echo '<li class="disabled"> <a href="#" onclick="return false;">»</a> </li>'; } else { echo '<li> <a href="?' . $page_tmp . 'curr_page=' . $last_page . '&class_id=' . $class_id . '&type=' . $type . '">»</a> </li>'; } echo '</ul>'; } function goo_gl_short_url($longUrl) { $GoogleApiKey = 'AIzaSyD2znL9R0dGJRk4_YLaTKRQD-0BCiRda0s'; $postData = array('longUrl' => $longUrl, 'key' => $GoogleApiKey); $jsonData = json_encode($postData); $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url'); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); //As the API is on https, set the value for CURLOPT_SSL_VERIFYPEER to false. This will stop cURL from verifying the SSL certificate. curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($curlObj); $json = json_decode($response); curl_close($curlObj); return $json->id; } function get_age_id($birthday) { global $db; $age = floor((mktime() - $birthday) / 365.25 / 86400); switch (true) { case($age <= 20): return 1; break; case($age > 20 && $age <= 25): return 2; break; case($age > 25 && $age <= 30): return 3; break; case($age > 30 && $age <= 35): return 4; break; case($age > 35 && $age <= 40): return 5; break; case($age > 40 && $age <= 45): return 6; break; case($age > 45 && $age <= 50): return 7; break; default: return 8; } } ?>
Upload File
Create Folder