<?php $rows[] = array(); $file = fopen('tanuloi_adatbazis/2016-17/StudentListFinished2016-17_v5.csv', 'r'); while (($line = fgetcsv($file)) !== FALSE) { $rows[] = $line; } fclose($file); include "include/dbconnect.php"; include "include/functions.php"; for ($i = 2; $i < 613; $i++) { $OM = sha1($rows[$i][0]); $fullname = $rows[$i][4]; $firstname = $rows[$i][1]; $class = $rows[$i][2]; $username = nameString($rows[$i][3]); $cookie = 452318 + $i * 7926; echo "INSERT INTO students (OM, fullname, firstname, class, username, cookie) VALUES ('" . $OM . "', '" . $fullname . "', '" . $firstname . "', '" . $class . "', '" . $username . "', " . $cookie . " );"; }
// HTTP 1.1. header("Pragma: no-cache"); // HTTP 1.0. header("Expires: 0"); // Proxies. #region //including the required files require_once "include/dbconnect.php"; require_once "include/functions.php"; require_once "theme/currentTheme.php"; $title = $maintitle; $style = "asd"; require_once "include/head.php"; #endregion if (isset($_POST["username"])) { if ($_POST["username"] != "" and $_POST["password"] != "") { $username = nameString(res($_POST["username"])); $password = res($_POST["password"]); $password = sha1($password); if ($result = $db->query("SELECT * FROM students WHERE username = '******' AND OM = '" . $password . "' ")) { if ($result->num_rows == 1) { $user = $result->fetch_assoc(); $cookie = sha1($user["cookie"]); setcookie("cookie", $cookie, time() + 1800, '/'); setcookie("username", $user["username"], time() + 1800, '/'); header("Location: index.php"); exit; } else { /*echo(" <div align='center'><img src='style/" .$theme. "/head_line.png'></div> <hr align='center'size='10' width='816px'>
<?php if (!(include "../../include/cookiecheck.php")) { header("Location: ../../logout.php"); } echo "<html><head><meta charset='UTF-8' /></head><body>"; $q = $_GET["q"]; $q = nameString($q); $hintSearchResult = $db->query("SELECT firstName, fullname, class, username FROM students"); $rows = array(); while ($row = $hintSearchResult->fetch_assoc()) { $rows[] = $row; } $hint = ""; if (strlen($q) > 2) { for ($i = 0; $i < count($rows); $i++) { $fullnameToCompare = nameString($rows[$i]["fullname"]); if (stristr($fullnameToCompare, $q)) { $toHint = "<a onClick='addUser(" . '"' . $rows[$i]["username"] . '"' . ")' href='#addUserField' >" . $rows[$i]["fullname"] . " - " . $rows[$i]["class"] . "</a><br />"; $hint = $hint . $toHint; } } } else { $hint = "Legalább három karaktert meg kell adnod!"; } if ($hint == "") { $hint = "Nincs találat!"; } echo $hint; $hintSearchResult->free(); exit;
<?php if (!(include "../../include/cookiecheck.php")) { header("Location: ../../logout.php"); } echo "<html><head><meta charset='UTF-8' /></head><body>"; if (!isset($_GET["newPswrd"])) { $q = nameString(res($_GET["q"])); $result = $db->query("SELECT * FROM students WHERE username = '******'") or die($db->error); $rows = array(); while ($row = $result->fetch_array()) { $rows[] = $row; } $result->free(); echo "\n\t\t<form action='theme/illyesnapok/newPswrd.php?newPswrd' method='POST'>\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>ID</th>\n\t\t\t\t\t<th>username</th>\n\t\t\t\t\t<th>fullname</th>\n\t\t\t\t\t<th>class</th>\n\t\t\t\t\t<th>acces level</th>\n\t\t\t\t\t<th>new password</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td><input type='text' value='" . $rows[0]["id"] . "' disabled><input type='hidden' name='id' value='" . $rows[0]["id"] . "'></td>\n\t\t\t\t\t<td><input type='text' value='" . $rows[0]["username"] . "' disabled></td>\n\t\t\t\t\t<td><input type='text' value='" . $rows[0]["fullname"] . "' disabled></td>\n\t\t\t\t\t<td><input type='text' value='" . $rows[0]["class"] . "' disabled></td>\n\t\t\t\t\t<td><input type='text' value='" . $rows[0]["accessLevel"] . "' disabled></td>\n\t\t\t\t\t<td><input type='password' maxLength='15' name='newPswrd'></td>\n\t\t\t\t\t<td><input type='submit' value='Új jelszó mentése'></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</form>\n\t\t"; } else { if (isset($_GET["newPswrd"])) { $id = $_POST["id"]; $newPswrd = sha1($_POST["newPswrd"]); if ($stmt = $db->prepare("UPDATE students SET OM=? WHERE id=?")) { } else { die($db->error); } $stmt->bind_param("si", $newPswrd, $id); if ($stmt->execute()) { echo "<p>A jelszó sikeresen megváltozott</p>"; } else { die($db->error); } $stmt->close(); header("Refresh: 3; url=../../index.php?adminpage=4");