} } elseif (in_array($p, $user_paths)) { $user = user_load($uid); if (isset($_SESSION['username']) && $_SESSION['username'] == $user['User_Username'] || $_SESSION['rid'] == 1) { $title = 'Account of ' . $user['User_Username']; $body_class = 'admin user list'; } else { $title = 'Not authorized'; $body_class = 'not-authorized'; } } elseif (in_array($p, $profile_paths)) { $user = user_load_from_name($username); $title = 'Profile of ' . (isset($user['User_Fullname']) ? $user['User_Fullname'] : $user['User_Username']); $body_class = 'profile'; } elseif (in_array($p, $profile_follow_paths)) { $user = user_load_from_name($username); $title = 'Following posts of ' . (isset($user['User_Fullname']) ? $user['User_Fullname'] : $user['User_Username']); $body_class = 'profile'; } elseif (in_array($p, $post_paths)) { $post = post_load($pid); $title = $post['Post_Title']; $body_class = 'post'; } elseif (in_array($p, $week_paths)) { $title = 'Week ' . $week; $body_class = 'week week-' . $week; } elseif (in_array($p, $course_paths)) { $course = course_load($cid); $title = $course['Course_Code'] . ': ' . $course['Course_Name'] . (isset($_SESSION['uid']) && $course['User_ID'] == $_SESSION['uid'] ? ' - You are coordinator' : ''); $body_class = 'course'; } elseif (in_array($p, $course_week_paths)) { $cid = $course_week['cid'];
$profiles[] = $data; } fclose($handle); } for ($i = 0; $i < count($profiles); $i++) { if (isset($_POST['query']) && $_POST['query'] == 'update_pass') { $pass = md5($profiles[$i][1]); csv_update_pass($profiles[$i][0], $pass); } if (isset($_POST['query']) && $_POST['query'] == 'update_email') { csv_update_pass($profiles[$i][0], $profiles[$i][2]); } if (isset($_POST['query']) && $_POST['query'] == 'create') { csv_create_user($profiles[$i][0], $profiles[$i][1], $profiles[$i][2]); } if (isset($_POST['query']) && $_POST['query'] == 'delete') { $user = user_load_from_name($profiles[$i][0]); $uid = $user['uid']; delete_user($uid); } } $s = count($profiles) == 0 || count($profiles) == 1 ? '' : 's'; print count($profiles) . ' row' . $s; print isset($_POST['query']) && $_POST['query'] == 'create' ? ' (CREATE)' : ''; print isset($_POST['query']) && $_POST['query'] == 'update_pass' ? ' (UPDATE PASS)' : ''; print isset($_POST['query']) && $_POST['query'] == 'update_email' ? ' (UPDATE EMAIL)' : ''; print isset($_POST['query']) && $_POST['query'] == 'delete' ? ' (DELETE)' : ''; print isset($_POST['query']) && $_POST['query'] != 'none' ? ' executed' : ' not executed'; print '<pre>'; print_r($profiles); print '</pre>';
function username_existed($name) { //Check if username existed $user = user_load_from_name($name); if (isset($user)) { return true; } else { return false; } }