?> <h1>Select course</h1> <ul class="groups"> <?php $courses = admin_courses(); if (empty($courses) && !in_array($login, $conf_sysadmins)) { niceerror("There are no courses defined on system."); print "<p>Please contact the administrator to create some courses.</p>\n"; return 0; } if (isset($_REQUEST['year'])) { $year = intval($_REQUEST['year']); } else { $year = $conf_current_year; } $perms = admin_permissions($login, $year); function coursecmp($a, $b) { return $a['name'] > $b['name']; } usort($courses, "coursecmp"); foreach ($courses as $course) { if (!empty($perms)) { // Check permissions $c9id = $course['id'] . "_" . $year; if ($course['type'] == "external") { $c9id = "X" . $c9id; } $found = false; foreach ($perms as $perm) { if ($perm == $c9id) {
<?php include 'connection.php'; include 'uni-auth.php'; if (!USER_LOGGED || !admin_permissions($UserID, $conn)) { header("Location: main.php"); } else { ?> <!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="./styles/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="./styles/bootstrap-styles.css"> <link rel="stylesheet" type="text/css" href="./styles/style.css"> <script src="./js/jQuery/jquery-2.2.0.min.js"></script> <title>Registration</title> </head> <body class='register_pt them'> <?php include 'header.php'; ?> <div class="register-block"> <form class="" id="site-register" action="register.php?users=1" method="POST"> <div class='row'> <span class="collumn-1">Login:</span> <input type="text" class="form-control" name="new-user" id="new-user" placeholder="Login" autofocus> </div>
if (get_magic_quotes_gpc()) { //Если слеши автоматически добавляются $_POST['user'] = stripslashes($_POST['user']); $_POST['pass'] = stripslashes($_POST['pass']); } $user = mysqli_real_escape_string($conn, $_POST['user']); $pass = mysqli_real_escape_string($conn, $_POST['pass']); $pass = md5($pass); if (login($user, $pass, $conn)) { header("Location: main.php"); } else { header('Refresh: 3;'); die("<div style='margin: auto; width: 350px;'><h3>Неправильний логін або пароль!</h3></div>"); } } ##Действия при попытке выхода if (isset($_GET['logout'])) { logout(); } ##Действия при попытке регистрации if (isset($_GET['register'])) { if (USER_LOGGED && admin_permissions($UserID, $conn)) { header("Location: register.php"); } else { header("Location: main.php"); } } ## if (isset($_GET['main'])) { header("Location: main.php"); }
<div id="header"> <div class="exit"> <h4><a href="?logout">Вийти</a></h4> </div> <?php if (admin_permissions($UserID, $conn)) { if (isset($_GET["users"])) { ?> <div class="new-user"> <a href ="?main">Main Page</a> </div> <?php } else { ?> <div class="new-user"> <a href="?register">Новий користувач</a> </div> <?php } } ?> </div>