function login_user($mylogin) { $row = fetch_user($mylogin); //error_log("row=".print_r($row, true)); $db = get_conn(); // 尚未註冊, 註冊 if ($row === FALSE || count($row) == 0) { $sql = sprintf("INSERT INTO \"user\" (\"uid\", \"email\", \"type\", \"name\", \"limit\", \"cdate\", \"login\") VALUES (DEFAULT, '%s', '%s', '%s', 30, CURRENT_TIMESTAMP, 1)", $mylogin['email'], $mylogin['type'], $mylogin['nick']); $rs = $db->Execute($sql); logsql($sql, $rs); } else { // 新增 counter $sql = sprintf("update \"user\" SET \"login\"=%d, \"name\"='%s' WHERE \"uid\"=%d", $row['login'] + 1, pg_escape_string($mylogin['nick']), $row['uid']); //$res = mysql_query($sql); $rs = $db->Execute($sql); logsql($sql, $rs); } // 是否加上 login record ? // return fetch_user($mylogin); }
<?php // Besoin de $_SESSION, pour récupérer user_id (cf login.php) session_start(); // Si l'utilisateur à cliquer sur mettre à jour son profil et validé le form if (isset($_POST['submit'])) { // On update le profil avec les champs remplis update_profile($_POST); } // Si l'utilisateur ne se logge pas (login.php) et a direct sur profil.php // user_id n'existe pas, donc affichage du profil interdit if (!isset($_SESSION['user_id'])) { echo "Vous n'êtes pas connecté !"; } else { // Sinon, on récupère son identifiant en BDD, et on récupère toutes ses infos // On stocke dans $user $user = fetch_user($_SESSION['user_id']); ?> <header> <div class="avatar"> <img src="../images/<?php echo $user['avatar']; ?> " /> </div> <div class="welcome"> Bienvenue <?php echo $user['login']; ?> ! <!-- @TODO mieux formater la date: "Le dd/mm/yyyy à hh:mm:ss" --> <span>Dernière connexion le <?php
if ($version < 1 || $version > 3) { $version = 3; } $shiftx = $inp['shiftx']; $shifty = $inp['shifty']; $title = $inp['title']; $startx = $inp['startx']; $starty = $inp['starty']; $xx = $startx * 1000; $yy = $starty * 1000; $ph = $inp['ph']; // 澎湖 $gpx = $inp['gps'] > 0 ? 1 : 0; // error_log("$stbpath, $startx, $starty, $shiftx, $shifty"); // 1. 檢查產生地圖數量是否超過上限 $user = fetch_user($_SESSION['mylogin']); // 1. 看看本圖是否為重新產生? if (map_exists($_SESSION['uid'], $xx, $yy, $shiftx, $shifty, $version, $gpx)) { $recreate_flag = 1; } else { $recreate_flag = 0; } if (map_full($_SESSION['uid'], $user['limit'], $recreate_flag)) { error_out("{$recreate_flag} 已經達到數量限制" . $user['limit']); } $block_msg = map_blocked($out_root, $_SESSION['uid']); if ($block_msg != null) { error_out($block_msg); } $outpath = sprintf("%s/%06d", $out_root, $_SESSION['uid']); $outfile_prefix = sprintf("%s/%dx%d-%dx%d-v%d%s", $outpath, $startx * 1000, $starty * 1000, $shiftx, $shifty, $version, $ph == 1 ? 'p' : "");
</script> <table id="project_tasks" class="zebra-striped"> <thead> <th class="red">Task</th> <th class="blue">User</th> <th class="green">Duration</th> <th class="orange">Priority</th> <th class="purple">Status</th> </thead> <?php for ($i = 0; $i < $project_task_history_number; $i++) { $tid = $db_array_task[$i]['tid']; $task = $db_array_task[$i]['name']; $start = time_uk($db_array_task[$i]['start']); $end = time_uk($db_array_task[$i]['end']); $array_user = fetch_user($db_array_task[$i]['uid']); $user = $array_user[0]['name_nickname'] . ' (' . $array_user[0]['name_first'] . ' ' . $array_user[0]['name_last'] . ')'; $priority = $db_array_task[$i]['priority']; $status = task_status($db_array_task[$i]['tid']); echo '<tr class="td_link" onclick="location.href=\'task.php?t=' . $tid . '\'"><td class="black">'; echo "<strong>" . $task . "</strong>"; echo "</td><td>"; echo $user; echo "</td><td>"; echo "[" . $start . "] → [" . $end . "]"; echo "</td><td>"; echo $priority; echo "</td><td>"; echo $status; echo "</td></tr>"; }
<?php include 'libraries/initial.inc.php'; include 'libraries/project.lib.php'; if (!user_logged_in()) { } else { $u = user_logged_in(); //read user information and his/her tasks, page title, page sub title $db_array_user = fetch_user($u); $db_array_fetch_user_task = fetch_user_task($u); $page_title = "Summary"; $page_title_sub = ""; $tasks_number = count($db_array_fetch_user_task); //Task Doing $array_task_doing = array(); for ($i = 0; $i < $tasks_number; $i++) { $tid = $db_array_fetch_user_task[$i]['tid']; if (fetch_task_doing($tid)) { $array_task_doing_index = count($array_task_doing); $array_task_doing[$array_task_doing_index] = $db_array_fetch_user_task[$i]; } } $array_task_doing_number = count($array_task_doing); if ($array_task_doing_number <= 1) { $array_task_doing_number_label = "task"; } else { $array_task_doing_number_label = "tasks"; } //Task To Do $array_task_ready = array(); for ($i = 0; $i < $tasks_number; $i++) {