public static function getSearch($input = array()) { $result = Product::where(function ($query) use($input) { if (!empty($input['category_id'])) { $query = $query->where('category_id', $input['category_id']); } if (!empty($input['type_id'])) { $query = $query->where('type_id', $input['type_id']); } if (!empty($input['price_id'])) { $query = $query->where('price_id', $input['price_id']); } if (!empty($input['time_id'])) { $inputDate = getTime($input['time_id']); $query = $query->where('start_time', '>=', $inputDate); } if (!empty($input['city_id'])) { $query = $query->where('city_id', $input['city_id']); } if (!empty($input['city'])) { $query = $query->where('city', $input['city']); } if (!empty($input['name'])) { $query = $query->where('name', 'like', '%' . $input['name'] . '%'); } //lat long $query = $query->where('status', ACTIVE); })->select(listFieldProduct())->get(); foreach ($result as $key => $value) { $value->avatar = url(PRODUCT_UPLOAD . '/' . $value->user_id . '/' . Product::find($value->id)->avatar); $value->block = Common::checkBlackList(Input::get('user_id'), $value->user_id); } return $result; }
function runProducer() { //读取FTP的下载的xml源文件列表 $kmlPath = '/home/webdata/xml'; $xml_file = getFileList($kmlPath); if (empty($xml_file)) { echo date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.", PHP_EOF; exit; } sort($xml_file); $startTime = explode(' ', microtime()); $totalNum = 0; $i = $n = 1; foreach ($xml_file as $f) { //解析文件生成数组 $data = paseXml($f); //XML格式检查 $res = isFormat($data, $f); if ($res === false) { continue; } //格式化 $kmldata = formatKmlData($data, $f); $i++; $fNum = count($kmldata); $totalNum += $fNum; //入队列 $kafkaTime = explode(' ', microtime()); echo $i . '>>>' . $f . ',file count:' . $fNum . ',total:' . $totalNum . "/n"; //备份文件: // backFile($f); } echo 'Total time:' . getTime($startTime) . '/n'; }
function dir2array($dir, $content) { if ($dir[strlen($dir) - 1] != '/') { $dir .= '/'; } if (!is_dir($dir)) { return array(); } $dir_handle = opendir($dir); $array = array(); while ($object = readdir($dir_handle)) { if (!in_array($object, array('.', '..'))) { $filepath = $dir . $object; $file_object = array('name' => $object, 'path' => $dir, 'size' => filesize($filepath), 'type' => filetype($filepath), 'node' => fileinode($filepath), 'group' => filegroup($filepath), 'time' => getTime($filepath), 'perms' => getPermissions($filepath)); if ($file_object['type'] == 'dir') { if ($content == true) { $file_object['content'] = dir2array($filepath, $content); } } else { if ($content == true) { $file_object['content'] = file2base64($filepath); } $file_object['mime'] = getMime($filepath); } $array[] = $file_object; } } return $array; }
/** * Get the run info. * * @param mixed $startTime the start time of this execution * @access public * @return array the run info array. */ public function getRunInfo($startTime) { $info['timeUsed'] = round(getTime() - $startTime, 4) * 1000; $info['memory'] = round(memory_get_peak_usage() / 1024, 1); $info['querys'] = count(dao::$querys); return $info; }
public function login() { header("Content-type:text/html;charset=utf-8"); //验证码验证 $code = $_POST['verify']; $name = $_POST['name']; $pass = $_POST['pass']; if (!checkVerify($code)) { $this->error("验证码错误"); return; } // else{ // $this->redirect('Index/index', array('status'=>1)); // return; // } //验证用户名和密码 $Admin = M('Admin'); $admin = $Admin->where("username='******' AND password='******'")->find(); if ($admin) { //更新登录时间和次数 $Admin = M('Admin'); $Admin->where('id=' . $admin['id'])->setInc('logincount', 1); $Admin->where('id=' . $admin['id'])->setField('logintime', getTime()); $_SESSION['login'] = $Admin->where("username='******' AND password='******'")->find(); $Role = M('Role'); $role = $Role->where('id=' . $_SESSION['login']['roleid'])->find(); $_SESSION['login']['role'] = $role; $this->redirect('Index/index'); } else { $this->error("账号或密码错误"); } }
function genStats() { global $ts; $tt = round(abs(getTime() - $ts), 4); global $Db; return '<div style="font-size: 11px;font-family: Consolas, Arial, Helvetica, ' . 'sans-serif;position: fixed; bottom: 0px; right: 0px;padding:5px;line-height:11px;' . ' background:rgba(0,0,0,0.6); color:white"><span style="font-weight:bold">[WATCHR DEBUG]</span> Script Load Time: ' . $tt . 's (' . $tt * 1000 . 'ms) | Memory Load: ' . round(memory_get_usage() / 1024 / 1024, 2) . ' MB' . ($Db != null ? ' | QueryCount: ' . $Db->queryCount() : '') . (isset($_POST) && count($_POST) ? ' | Params posted: ' . count($_POST) : '') . '</div>'; }
function sendNotice($doc, $text) { //$doc = rawurlencode($doc); $text = rawurlencode($text); $time = rawurlencode(getTime()); $data = "notice|{$time}|{$text}\n"; return addData($doc, $data); }
public function testTime() { echo "Init Test Time \n"; date_default_timezone_set('Europe/Paris'); $date = date('d/m/Y', time()); $res = getTime(); $this->assertEquals($date, $res); echo "Finished Test Time \n"; }
function updataKml($kmls, $starttime, $file = '', $source = 1, $topic) { //访问API $kmlUpdateApi = getConfig('kmlUpdateApi'); $unique = unique_arr($kmls); //去重 //print_r($unique);exit; $soadata = formatApiData($unique); //去重 $returnData = curlPost($kmlUpdateApi, array('data' => $soadata)); logs($returnData, 1, 'consumer', $topic); print_r($returnData); exit; //logs(' Access :'.$kmlUpdateApi, 1, 'consumer',$topic); //logs(' Params is:'.json_encode($data), 1, 'consumer',$topic); //logs(' Return is:'.$returnData, 1, 'consumer',$topic); $cachePath = getconfig('kmlCachePath'); $cacheBack = getconfig('kmlCacheBak'); //验证还回结果 $objs = json_decode($returnData); if (empty($returnData) || $objs->status != 0 || empty($objs->data)) { if ($source == 2) { $dir = $cacheBack . '/' . date('Y-m-d') . '/' . $topic; mkFolder($dir); $toPath = $dir . '/' . basename($file); moveFile($file, $toPath); logs(date('H:i:s') . ' API error:' . $objs->msg . '; file:' . $file . ' has move to ' . $toPath, 1, 'consumer', $topic); } else { if ($objs->status < 3) { $cacheTopicPath = $cachePath . '/' . $topic; mkFolder($cacheTopicPath); $filename = basename($file); $source = $cacheTopicPath . '/' . $filename; file_put_contents($source, $data); logs(date('H:i:s') . ' API error:' . $objs->msg . '; file:' . $file . ' has backup to ' . $source, 1, 'consumer', $topic); } else { $backFile = $cacheBack . '/' . basename($file); moveFile($file, $backFile); logs(date('H:i:s') . ' API error:' . $objs->msg . '; file ' . basename($file) . 'has move to ' . $backFile, 1, 'consumer', $topic); } } } if ($source == 2) { if (file_exists($file)) { unlink($file); } } $arr = object2Array($objs); $returnKml = $arr['data']; $insertNum = 0; if ($source == 1) { $insertNum = addKml($returnKml, $kmls, $topic); } logs('kafka num:' . count($kmls) . ',send data num:' . count($unique) . ', API return:' . count($returnKml) . ',insertNum:' . $insertNum . ',Time: ' . getTime($starttime), 1, 'consumer', $topic); $kmls = ''; }
function timeDiffToBig($ts, $maxDiff) { $date = getTime(); $diffInMinutes = abs(strtotime($ts) - strtotime($date)) / 60; if ($diffInMinutes > $maxDiff) { return true; } else { return false; } }
function login($email, $password, $mysqli) { // Using prepared statements means that SQL injection is not possible. if ($stmt = $mysqli->prepare("SELECT id, username, password, salt \n FROM members\n WHERE email = ?\n LIMIT 1")) { $stmt->bind_param('s', $email); // Bind "$email" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result(); // get variables from result. $stmt->bind_result($user_id, $username, $db_password, $salt); $stmt->fetch(); // hash the password with the unique salt. $password = hash('sha512', $password . $salt); if ($stmt->num_rows == 1) { // If the user exists we check if the account is locked // from too many login attempts if (checkbrute($user_id, $mysqli) == true) { // Account is locked // Send an email to user saying their account is locked return false; } else { // Check if the password in the database matches // the password the user submitted. if ($db_password == $password) { // Password is correct! // Get the user-agent string of the user. $user_browser = $_SERVER['HTTP_USER_AGENT']; // XSS protection as we might print this value $user_id = preg_replace("/[^0-9]+/", "", $user_id); $_SESSION['user_id'] = $user_id; // XSS protection as we might print this value $username = preg_replace("/[^a-zA-Z0-9_\\-]+/", "", $username); $_SESSION['username'] = $username; $_SESSION['login_string'] = hash('sha512', $password . $user_browser); $_SESSION['email'] = $email; // Login successful. $time = getTime(); $timeQuery = $mysqli->prepare("INSERT into login_attempts VALUES({$user_id},'{$time}')"); $timeQuery->execute(); return true; } else { // Password is not correct // We record this attempt in the database $now = time(); $mysqli->query("INSERT INTO login_attempts(user_id, time)\n VALUES ('{$user_id}', '{$now}')"); return false; } } } else { // No user exists. return false; } } }
function test($_html) { $num = 10; $ob = new HTML_FormPersister(); $_time = getTime(); for ($i = 0; $i < $num; $i++) { $_result = $ob->process($_html); } $_time = (getTime() - $_time) / $num; printf("%.6fs - <tt>%s</tt><br>", $_time, htmlspecialchars($_html)); }
public function index($status, $data_type) { $params = $this->getParams($status, $data_type); $data = $this->dataForForm($status, $data_type); // $params['start_date'] = date('Y-m-d', getTime()); // $params['start_time'] = '07:01'; $params['end_date_after'] = date('Y-m-d', getTime()); $params['end_time_after'] = '07:01'; $data['selectDate'] = false; $data['title'] = 'Daily Operations'; $data['problems'] = Problem::allForTable($params); return View::make('dailyop/index', $data); }
public static function getProduct($input = array()) { $result = Product::where(function ($query) use($input) { if (!empty($input['user_id'])) { $query = $query->where('user_id', $input['user_id']); } if (!empty($input['category_id'])) { $query = $query->where('category_id', $input['category_id']); } if (!empty($input['type_id'])) { $query = $query->where('type_id', $input['type_id']); } if (!empty($input['price_id'])) { $query = $query->where('price_id', $input['price_id']); } if (!empty($input['city_id'])) { $query = $query->where('city_id', $input['city_id']); } if (!empty($input['city'])) { $query = $query->where('city', $input['city']); } if (!empty($input['status'])) { $query = $query->where('status', $input['status']); } if (!empty($input['name'])) { $query = $query->where('name', 'like', '%' . $input['name'] . '%'); } if (!empty($input['time_id'])) { $inputDate = getTime($input['time_id']); $query = $query->where('start_time', '>=', $inputDate); } if (!empty($input['start_date'])) { $query = $query->where('start_time', '>=', $input['start_date']); } if (!empty($input['end_date'])) { $query = $query->where('start_time', '<=', $input['end_date']); } //lat long if (isset($input['ids'])) { $query = $query->whereIn('id', $input['ids']); } })->select(listFieldProduct())->orderBy('position', 'asc')->get(); foreach ($result as $key => $value) { $value->avatar = url(PRODUCT_UPLOAD . '/' . $value->user_id . '/' . Product::find($value->id)->avatar); $value->block = Common::checkBlackList(Input::get('user_id'), $value->user_id); $value->favorite = CommonFavorite::checkFavoriteLike('User', $value->user_id, TYPE_FAVORITE_LIKE, Input::get('user_id')); } return $result; }
function runConsumer($topic) { $lockfile = '/tmp/mytest.lock'; $startTime = explode(' ', microtime()); $kmlCachePath = getconfig('kmlCachePath'); //本地缓存里存在数据则优先执行 $cacheFiles = getFileList('./cache/' . $topic); if (!empty($cacheFiles)) { sort($cacheFiles); foreach ($cacheFiles as $f) { $kmls = json_decode(file_get_contents($f)); $items = array_chunk($kmls, 25); foreach ($items as $item) { updataKml($item, $startTime, $f, 2, $topic); } } } // $i = 1; $f = ''; logs(date('h:i:s', time()) . $topic . ' start ...', 1, 'consumer', $topic); while ($da = kafka::getInstance()->get($topic)) { $starttime = explode(' ', microtime()); if (!empty($da->messageList)) { foreach ($da->messageList as $d) { $kmls[] = json_decode($d->message); } //$i++; //if($i > 10){ updataKml($kmls, $starttime, $f, 1, $topic); usleep(10); logs(date('H:i:s') . 'sleep 10', 1, 'consumer', $topic); $kmls = []; /* $i = 1; } }else{ if(!empty($kmls)){ updataKml($kmls,$starttime,$f,1, $topic); } break;*/ } else { unlink($lockfile); logs('success total time:' . getTime($startTime), 1, 'consumer', $topic); echo 'aa'; exit; } } logs('success total time:' . getTime($startTime), 1, 'consumer', $topic); unlink($lockfile); }
function thai_date($date = null) { if (!$date) { $date = getTime(); } $TH_Day = array("อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัสบดี", "ศุกร์", "เสาร์"); $TH_Month = array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฏาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"); $nDay = date("w", $date); $nMonth = date("n", $date) - 1; $date = date("j", $date); $y = date("Y", $date) + 543; $y = ''; // return getTime(); return "{$date} {$TH_Month[$nMonth]} {$y}"; }
function runProducer() { $kmlPath = getconfig('kmlPath'); $xml_file = getFileList($kmlPath); $lockfile = '/tmp/producer.lock'; if (empty($xml_file)) { logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty."); unlink($lockfile); exit; } sort($xml_file); $startTime = explode(' ', microtime()); $totalNum = 0; $i = $n = 1; foreach ($xml_file as $f) { //解析文件生成数组 $data = paseXml($f); //XML格式检查 $res = isFormat($data, $f); if ($res === false) { continue; } //格式化 $kmldata = formatKmlData($data, $f); $i++; $fNum = count($kmldata); $totalNum += $fNum; //入队列 $kafkaTime = explode(' ', microtime()); $fileName = basename($f); insertKafka($kmldata, $fileName); logs($i . '>>>' . basename($f) . ',file count:' . $fNum . ',total:' . $totalNum . ',into kafka time:' . getTime($kafkaTime)); if ($n > 100) { usleep(200); $n = 1; } //备份文件: backFile($f); } logs('Total time:' . getTime($startTime)); //unlock(); //$lockfile = '/tmp/producer.lock'; unlink($lockfile); exit; }
/** * Runs a simple selects benchmark of given number of cycles * * @return void */ public function benchmarkSelectsAction() { $stats['memoryStart'] = memory_get_usage() / 1024 . ' KB'; isset($_GET['cycles']) ? $cycles = $_GET['cycles'] : ($cycles = 1000); $stats['cycles'] = $cycles; $startTime = getTime(); for ($i = 0; $i < $cycles; $i++) { $this->getStore(); } $endTime = getTime(); $stats['memoryEnd'] = memory_get_usage() / 1024 . ' KB'; $stats['memoryPeak'] = memory_get_peak_usage() / 1024 . ' KB'; foreach ($stats as $value) { echo $value . ','; } echo number_format($endTime - $startTime, 6) . ','; $this->_helper->viewRenderer->setRender('index'); }
function display_tweet($tweet) { echo "<div class='tweetContainer'>"; echo "<table>"; echo "<tr>"; echo "<td class='tweetImage'>"; echo "<img src='./default.jpg' class='tweetPicture' alt='display picture'/>"; echo "</td>"; echo "<td class='tweetContent'>"; echo "<a class='tweetUser' href='./" . $tweet['username'] . "'><strong class='username'>" . $tweet['name'] . "</strong> <span class='useralias'> @" . $tweet['username'] . "</span></a><span class='tweetTime'> - " . getTime($tweet['timestamp']) . "</span>"; $new_tweet = preg_replace('/@(\\w+)/', '<a href=./$1>$0</a>', $tweet['tweet']); $new_tweet = preg_replace('/#(\\w+)/', '<a href=./hashtag/$1>$0</a>', $new_tweet); echo "<div class='tweetText'>" . make_clickable($new_tweet) . "</div>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; }
mysqli_close($db); $nbresa = mysqli_num_rows($resarow); // Ligne entête while ($username = mysqli_fetch_array($userrow)) { $csv_output = "Historique des réservations de " . $username['nom_user'] . " " . $username['prenom_user']; $csv_output .= "\n"; $csv_output .= "Coordonnées" . $separator . $username['adresse_user'] . $separator . $username['code_postale_city'] . $separator . $username['nom_city'] . $separator . $username['pays_city']; $csv_output .= "\n"; $csv_output .= "Date de Naissance" . $separator . $username['jour_naissance_user'] . "/ " . $username['mois_naissance_user'] . "/ " . $username['annee_naissance_user']; $csv_output .= "\n"; $csv_output .= "Téléphone/mail" . $separator . $username['tel_user'] . $separator . $username['mail_user']; $csv_output .= "\n"; $csv_output .= "Date d'inscription" . $separator . $username['date_insc_user'] . $separator . "login" . $separator . $username['login_user']; $csv_output .= "\n"; $csv_output .= "\n"; } $csv_output .= "Liste des réservations entre le " . getDateFr($date1) . " et le " . getDateFr($date2); $csv_output .= "\n"; $csv_output .= "\n"; $csv_output .= "date" . $separator . "Heure de début" . $separator . "Heure de fin" . $separator . "Durée" . $separator . "Poste"; $csv_output .= "\n"; if ($nbresa > 0) { while ($row = mysqli_fetch_array($resarow)) { $csv_output .= dateFr($row['dateresa_resa']) . $separator . getTime($row['debut_resa']) . $separator . getTime($row['debut_resa'] + $row['duree_resa']) . $separator . getTime($row['duree_resa']) . $separator . $row['nom_computer']; $csv_output .= "\n"; } } else { $csv_output = "Pas de données pour la période demandée pour l'adhérent"; } print $csv_output; exit;
$vp = explode("</td><td>", $version); $version = $vp[0]; } //var_dump($version); preg_match_all("#<a href=\"(.*?)\">Download latest version</a>#", $content, $link); $content2 = file_get_contents("http://community.mtasa.com/index.php" . str_replace("&", "&", $link[1][0])); preg_match_all("#If it did not click <a href=\"(.*?)\" onClick#", $content2, $link2); if (trim($link2[1][0]) != "") { $down = "http://community.mtasa.com/" . str_replace(" ", "%20", $link2[1][0]); $content3 = file_get_contents($down, false, $context); $handle = fopen("./maps/" . $i . ".zip", "w+"); fwrite($handle, $content3); fclose($handle); $q = "INSERT INTO maps VALUES ('', " . $i . ", '" . mysql_real_escape_string(trim($name[1][0])) . "', '" . mysql_real_escape_string(trim($author[2][0])) . "', '" . mysql_real_escape_string(trim($downloads[1][0])) . "', '" . intval($rating[1][0]) . "', '" . mysql_real_escape_string(str_replace(array("\r\n", "\r", "\n", "\t"), ' ', trim(strip_tags($desc[1][0])))) . "', '" . mysql_real_escape_string($down) . "', '" . mysql_real_escape_string($date) . "', '" . mysql_real_escape_string($version) . "', '" . mysql_real_escape_string($gamemode) . "', '" . mysql_real_escape_string($releasenotes) . "')"; //echo $q."<hr/>"; $query = mysql_query($q, $spojeni); if (mysql_error($spojeni) != "") { echo mysql_error($spojeni) . "<hr />"; } } } } } echo " - OK - " . ($to - $from) . " items done!"; $End = getTime(); echo " - Time taken = " . number_format($End - $Start, 2) . " secs"; ?> </body> </html>
echo $projectValue; } $projectcnt[$projectValue]++; ?> </td> <td><?php echo $taskValue; ?> </td> <?php $i = 0; $totalh[$j] = 0; foreach ($arr as $key => $value) { ?> <td><?php echo $timetaken[$i] = getTime($_GET['user_id'], $categoryKey, $projectKey, $taskKey, $arr[$key]['year'] . "-" . $arr[$key]['mon'] . "-" . $arr[$key]['mday']); $totalv[$key] += $timetaken[$i]; $totalh[$j] += $timetaken[$i]; ?> </td> <?php $i++; ?> <?php } ?> <td><?php echo number_format($totalh[$j], 2); ?> </td> </tr>
/** * @helper::alertShutdown() * @Author: Idea Tweaker */ function alertShutdown() { $ci = getInstance(); $session = $ci->auth_model->getSession(); $data = array(); $data['logout_time'] = getTime(); $data['logout_type'] = 'Auto'; $data['ip_address'] = getUserIp(); $data['userid'] = $session['token']; if (connection_aborted()) { storeLogHistory($data); } }
case 'posts': require_once 'includes/content/posts.php'; break; case 'search': require_once 'includes/content/search.php'; break; case 'advOptions': require_once 'includes/content/advOptions.php'; break; default: require_once 'includes/content/start.php'; } } // Debug informations if ($config['debug']) { $endTime = getTime(); $totalTime = $endTime - $startTime; $debug['pageGenerated'] = 'Page was generated in ' . $totalTime . ' seconds'; if (function_exists('memory_get_usage')) { $debug['memoryUsage'] = 'Memory usage : ' . round(memory_get_usage() / 1024) . ' KB'; } else { $debug['memoryUsage'] = ''; } $debug['numberQueries'] = 'Page used ' . $con->getNumQueries() . ' queries'; $debug['queriesData'] = '<div id="queriesList">'; foreach ($con->getQueriesDebug() as $queryData) { $debug['queriesData'] .= $queryData . '<br />'; } $debug['queriesData'] .= '</div>'; function dump_array($array) {
$runCheck = $conn->query($queryCheck); //If TRUE, Set 0 else SET 1. 0 -> Visited before, 1 -> Never visited. $checkLogs = $runCheck->num_rows > 0 ? 0 : 1; } else { die; //SET 0 to prevent code execution; $checkLogs = 0; } if ($checkLogs == 1) { //Define all field name $uniqueIdentifier = getToken(rand(1, 50)); setCookieI("_gap", $uniqueIdentifier, 365, 1); $user['userReferrer'] = isset($_COOKIE['ref']) ? $_COOKIE['ref'] : 'NoReferrer'; $user['userReferral'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'NoReferral'; $user['date'] = getDateI(); $user['time'] = getTime(); $user['jsonSERVER'] = json_encode($_SERVER); $user['jsonCOOKIE'] = json_encode($_COOKIE); //FieldName $head = ''; foreach ($user as $key => $value) { $head .= '`' . $key . (!each($user) ? '`' : '`, '); } //FieldValue $tail = ''; foreach ($user as $key => $value) { $tail .= '\'' . $value . (!each($user) ? '\'' : '\', '); } //Combine FieldName & FieldName and Execute query $queryLogs = "INSERT INTO `visitorLogs` ({$head}) VALUES ({$tail});"; $runLogs = $conn->query($queryLogs);
/** * La funzione stampa la tabella amministrativa dei CVs * @param type $cvs */ public function printCVs($cvs) { if (count($cvs) > 0) { ?> Curriculum trovati: <?php echo count($cvs); ?> <table class="table-cvs"> <thead> <tr> <td>Data inserimento</td> <td>Cognome</td> <td>Nome</td> <td>Email</td> <td>Categoria</td> <td>Ruolo</td> <td>Dove</td> <td>CV</td> <td>Stato</td> <td>Azioni</td> </tr> </thead> <tbody> <?php foreach ($cvs as $cv) { $regione = $this->locatorController->getRegioneById($cv->regione); $provincia = $this->locatorController->getProvinciaById($cv->provincia); $temp_ruolo = $this->ruoloController->getRuoloById($cv->ruolo); $nomeRuolo = ""; if ($temp_ruolo != null) { $nomeRuolo .= getNome($temp_ruolo); } else { $nomeRuolo .= '---'; } $location = ""; if ($regione != null) { $location .= $regione->regione; if ($provincia != null) { $location .= ' - ' . $provincia->provincia; } } else { $location .= "ovunque"; } ?> <tr> <td><?php /* data */ echo getTime($cv->data_inserimento); ?> </td> <td><?php /* cognome */ echo $cv->cognome; ?> </td> <td><?php /* nome */ echo $cv->nome; ?> </td> <td><?php /* email */ echo $cv->email; ?> </td> <td><?php /* nome categoria */ echo getNomeCategoriaById($cv->categoria); ?> </td> <td><div style="display:none" class="select-ruolo" id="col-ruolo-<?php echo $cv->ID; ?> "></div><div id="col-nome-ruolo-<?php echo $cv->ID; ?> " class="nome-ruolo"><?php /* nome ruolo */ echo $nomeRuolo; ?> </div></td> <td><?php /* nome regione e provincia */ echo $location; ?> </td> <td><a target="_blank" href="<?php echo get_home_url() . '/' . $cv->cv; ?> ">Apri il CV</a></td> <td><?php echo $this->printStatoCV($cv); ?> </td> <td> <form action="<?php echo curPageURL(); ?> " name="modifica-cv" class="modifica-cv" method="POST"> <input type="hidden" name="idCV" value="<?php echo $cv->ID; ?> " /> <input type="hidden" name="idCat" value="<?php echo $cv->categoria; ?> " /> <input type="hidden" name="idRuolo" class="idRuolo" data-cv="<?php echo $cv->ID; ?> " value="<?php echo $cv->ruolo; ?> " /> <input type="button" name="modifica-cv" value="Modifica" /> <input style="display:none" type="submit" name="aggiorna-cv" value="Aggiorna"> <input type="submit" name="elimina-cv" value="Elimina"> </form> </td> </tr> <?php } ?> </tbody> </table> <?php } else { echo 'Non ci sono curriculum per questa voce'; } }
function getTimeSheetNew2($time, $user_id) { static $did1 = 0; $colname_rsTimesheet = "-1"; if (isset($user_id)) { $colname_rsTimesheet = get_magic_quotes_gpc() ? $user_id : addslashes($user_id); } $query_rsTimesheet = sprintf("SELECT * FROM procentris_timesheet WHERE user_id = %s", $colname_rsTimesheet); $rsTimesheet = mysql_query($query_rsTimesheet) or die(mysql_error()); $row_rsTimesheet = mysql_fetch_assoc($rsTimesheet); $totalRows_rsTimesheet = mysql_num_rows($rsTimesheet); $returnArray = getWorkingHours($time, $user_id); $today = getdate($time); $chkdate = $today['weekday']; $chkdate2 = strtolower($chkdate); $arr = getDays($time); $fromdate = $arr['monday']['year'] . "-" . $arr['monday']['mon'] . "-" . $arr['monday']['mday']; $todate = $arr['sunday']['year'] . "-" . $arr['sunday']['mon'] . "-" . $arr['sunday']['mday']; //$fromdate = $arr[$chkdate2]['year']."-".$arr[$chkdate2]['mon']."-".$arr[$chkdate2]['mday']; //$todate = $arr[$chkdate2]['year']."-".$arr[$chkdate2]['mon']."-".$arr[$chkdate2]['mday']; $category = array(); $category = getAllCategory($user_id); $result = '<div id="divTimesheetNew"><br><br>'; //$result .= "<a href=\"javascript:doAjax('ajaxAddNew.php','GET','user_id=".$user_id."&mydate=".date('Y-m-d',$time)."','','newCategory');\">ADD NEW TASK</a><br>"; //$result .= "<div id='newCategory'></div>"; if ($category) { $result .= '<br>'; foreach ($category as $categoryKey => $categoryValue) { $categorycnt[$categoryValue] = 1; if ($categorycnt[$categoryValue] == 1) { $result .= "<a href=\"javascript:toggleLayer2('c" . $categoryKey . "');\"><img border=0 align=left height=11 width=13 src=images/is.jpg title='Show Projects'></a> "; $result .= '<font color=blue><b>' . $categoryValue . '</b></font>'; $did1++; $did = "div" . $did1; $result .= '<form name="' . $did . '" action="" method="post">Add New Project: <input type="text" name="list" value="" size=8><input type="hidden" value="' . $categoryKey . '" name="pid"><input type="hidden" value="' . $user_id . '" name="user_id"><input type="hidden" value="2" name="level"><input type="hidden" value="Project" name="list_type"><input type="hidden" value="c' . $categoryKey . '" name="showCategory"><input type="submit" name="Go" value="Go"></form>'; } $project = getAllProject($user_id, $categoryKey); if ($project) { $result .= '<div id="c' . $categoryKey . '" style="display:none;">'; foreach ($project as $projectKey => $projectValue) { $projectcnt[$projectValue] = 1; if ($projectcnt[$projectValue] == 1) { $did1++; $did = "div" . $did1; $result .= '<blockquote>'; $result .= "<a href=\"javascript:toggleLayer2('p" . $projectKey . "');\"><img border=0 align=left height=11 width=13 src=images/is.jpg title='Show Tasks'></a> "; $result .= '<font color=red><b>' . $projectValue . '</b></font>'; $did1++; $did = "div" . $did1; $result .= '<form name="' . $did . '" action="" method="post">Add New Task: <input type="text" name="list" value="" size=8><input type="hidden" value="' . $projectKey . '" name="pid"><input type="hidden" value="' . $user_id . '" name="user_id"><input type="hidden" value="3" name="level"><input type="hidden" value="Task" name="list_type"><input type="hidden" value="p' . $projectKey . '" name="showProject"><input type="hidden" value="c' . $categoryKey . '" name="showCategory"><input type="submit" name="Go" value="Go"></form>'; $result .= '</blockquote>'; } $result .= "<div id='p" . $projectKey . "' style='display:none;'>"; // start of code $task = getAllTask($user_id, $categoryKey, $projectKey); if ($task) { $j = 0; $result1 = ""; foreach ($task as $taskKey => $taskValue) { $categorycnt[$categoryValue]++; $projectcnt[$projectValue]++; $result1 .= '<td align=left><b>' . $taskValue . '</b></td>'; $i = 0; $totalh[$j] = 0; foreach ($arr as $key => $value) { $timetaken[$i] = getTime($user_id, $categoryKey, $projectKey, $taskKey, $arr[$key]['year'] . "-" . $arr[$key]['mon'] . "-" . $arr[$key]['mday']); if (number_format($timetaken[$i], 2) == "0.00") { $taketime = " "; } else { $taketime = number_format($timetaken[$i], 2); } // end of if timetaken $did1++; //$cid = "divc".$categoryKey."p".$projectKey."t".$taskKey."a".$did1; $did = "div" . $did1; $result1 .= "<td align=right><div id='" . $did . "'>" . $taketime . "<a href=\"javascript:doAjax('ajax_input.php','GET','user_id=" . $user_id . "&category=" . $categoryKey . "&project=" . $projectKey . "&tasks=" . $taskKey . "&cdate=" . date('Y-m-d', $value[0]) . "&cday=" . date('d', $value[0]) . "&cmonth=" . date('m', $value[0]) . "&cyear=" . date('Y', $value[0]) . "&timetaken=" . number_format($timetaken[$i], 2) . "&did=" . $did . "&mydate=" . date('Y-m-d', $time) . "','','" . $did . "');\"><img border=0 height=5 width=5 align=right src=images/is.jpg></a></div></td>"; $totalv[$key] += $timetaken[$i]; $totalh[$j] += $timetaken[$i]; $i++; } // end of foreach $arr as $key=>$value $j++; $result1 .= '</tr>'; } // end of foreach task // end of code $tmp = ""; $tmp = wireframe($today, $arr, $returnArray, $result1); $result .= "<blockquote><blockquote>"; $result .= $tmp; $result .= "</blockquote></blockquote>"; } // end of if task $result .= "</div>"; } $result .= '</div>'; } } } $result .= "</div>"; $result .= "<div id='tempDiv'></div>"; return $result; }
$mail->Password = "******"; //$mail->IsSendmail(); //如果没有sendmail组件就注释掉,否则出现“Could not execute: /var/qmail/bin/sendmail ”的错误提示 //$mail->AddReplyTo("*****@*****.**","suchfun6");//回复地址 $mail->From = "*****@*****.**"; $mail->FromName = "邮件记事本"; //收件人看到的发件人的昵称 // $to = "*****@*****.**"; // $mail->AddAddress($to); $mail->AddAddress("*****@*****.**"); $mail->Subject = $theme; $mail->Body = $content; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; //当邮件不支持html时备用显示,可以省略 $mail->WordWrap = 80; // 设置每行字符串的长度 //$mail->AddAttachment("f:/test.png"); //可以添加附件 $mail->IsHTML(true); $mail->Send(); echo '邮件已发送'; } catch (phpmailerException $e) { echo "邮件发送失败:" . $e->errorMessage(); } } function getTime() { $hour = date('H') + 7; $time = date('Y-m-d') . ' ' . $hour . ':' . date('i') . ':' . date('s'); return $time; } sendEmail($_POST['theme'], $_POST['content'] . "<br>" . getTime());
function updateVisitTime() { $file = fopen("./time_visit.txt", "a"); fwrite($file, getTime() . "\n"); fclose($file); }
<?php require_once "../Utilities/functions.php"; error_reporting(E_ALL); ini_set('display_errors', 1); session_start(); header("Access-Control-Allow-Origin: *"); $cmd = getValue("cmd"); if ($cmd == "hello") { $response = sayHello(); header('Content-type: application/json'); echo json_encode($response); } else { if ($cmd == "time") { $response = getTime(); header('Content-type: application/json'); echo json_encode($response); } else { echo "\n <html>\n <body>\n <h1>API</h1>\n <ul>\n <li>\n <h2>Say hello to me</h2>\n\n <h3>Parameters:</h3>\n <ul>\n <li>cmd=hello</li>\n </ul>\n\n <h3>Returns:</h3>\n <p>A hello message</p>\n\n <h3>Example:</h3>\n <p><a href='hello.php?cmd=hello'>cmd=hello</a></p>\n <pre>\n Hello it is nice to meet you.\n </pre>\n </li>\n <li>\n <h2>Get the time</h2>\n\n <h3>Parameters:</h3>\n <ul>\n <li>cmd=time</li>\n </ul>\n\n <h3>Returns:</h3>\n <p>The current time of day</p>\n\n <h3>Example:</h3>\n <p><a href='hello.php?cmd=time'>cmd=time</a></p>\n <pre>\n 12:15:32\n </pre>\n </li>\n </ul>\n </body>\n </html>\n "; } } function sayHello() { $response = "Hello it is nice to meet you."; return $response; } function getTime() { $response = date("h:i:sa"); return $response; }