|
|
@ -32,13 +32,15 @@ if ($conn->connect_error) { |
|
|
|
echo json_encode(array('response' => "Database connection error (".$conn->connect_error.")")); |
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
if(isset($_POST["selectedschool"]) && $loggedin){ |
|
|
|
if(isset($_POST["selectedcompany"]) && $loggedin){ |
|
|
|
$_SESSION["selectedcompany"] = $_POST["selectedcompany"]; |
|
|
|
}elseif(isset($_POST["selectedschool"]) && $loggedin){ |
|
|
|
$_SESSION["selectedschool"] = $_POST["selectedschool"]; |
|
|
|
} |
|
|
|
|
|
|
|
if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
|
if(!isset($liteload) && !$loggedin && $isadmin && ($type == 1 || $type == 2)){ |
|
|
|
header("Location: ".$curdir."login.php"); |
|
|
|
die(); |
|
|
|
}else{ |
|
|
|
if($loggedin == true){ |
|
|
|
$id = $_SESSION["id"]; |
|
|
@ -49,7 +51,11 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
|
$username = $sqlvals["username"]; |
|
|
|
$type = $sqlvals["type"]; |
|
|
|
$connctdschids = explode(",", $sqlvals["connectedschoolids"]); |
|
|
|
if($type == 2){ |
|
|
|
$connctdcmps = explode(",", $sqlvals["connectedcompanyids"]); |
|
|
|
}else{ |
|
|
|
$connctdschids = explode(",", $sqlvals["connectedschoolids"]); |
|
|
|
} |
|
|
|
$sql = "SELECT * FROM `acctypes` WHERE `id` = '".$type."'"; |
|
|
|
mysqli_free_result($result); |
|
|
|
$result = $conn->query($sql); |
|
|
@ -77,32 +83,63 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for($i = 0; $i<count($connctdschids); $i++){ |
|
|
|
$viewsql = "SELECT * FROM `schools` WHERE `id` = ".$connctdschids[$i]; |
|
|
|
$result = $conn->query($viewsql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if(!isset($_SESSION["selectedschool"])) { |
|
|
|
$_SESSION["selectedschool"] = "s".$connctdschids[$i]; |
|
|
|
if($type == 2){ |
|
|
|
for($i = 0; $i<count($connctdcmps); $i++){ |
|
|
|
$viewsql = "SELECT * FROM `companies` WHERE `id` = ".$connctdcmps[$i]; |
|
|
|
$result = $conn->query($viewsql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if(!isset($_SESSION["selectedcompany"])) { |
|
|
|
$_SESSION["selectedcompany"] = "c".$connctdcmps[$i]; |
|
|
|
} |
|
|
|
if (empty($result) || $result->num_rows == 0) { |
|
|
|
$modsql = "INSERT INTO `companies` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`, `emailaddress`) VALUES ('".$connctdcmps[$i]."', '', '', '', '', '', '', '', '')"; |
|
|
|
$conn->query($modsql); |
|
|
|
} |
|
|
|
} |
|
|
|
if (empty($result) || $result->num_rows == 0) { |
|
|
|
$modsql = "INSERT INTO `schools` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`, `email`) VALUES ('".$connctdschids[$i]."', '', '', '', '', '', '', '', '')"; |
|
|
|
$conn->query($modsql); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
for($i = 0; $i<count($connctdschids); $i++){ |
|
|
|
$viewsql = "SELECT * FROM `schools` WHERE `id` = ".$connctdschids[$i]; |
|
|
|
$result = $conn->query($viewsql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if(!isset($_SESSION["selectedschool"])) { |
|
|
|
$_SESSION["selectedschool"] = "s".$connctdschids[$i]; |
|
|
|
} |
|
|
|
if (empty($result) || $result->num_rows == 0) { |
|
|
|
$modsql = "INSERT INTO `schools` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`, `emailaddress`) VALUES ('".$connctdschids[$i]."', '', '', '', '', '', '', '', '')"; |
|
|
|
$conn->query($modsql); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
mysqli_free_result($result); |
|
|
|
|
|
|
|
$viewsql = "SELECT * FROM `schools` WHERE `id` = ".substr($_SESSION["selectedschool"], 1); |
|
|
|
$result = $conn->query($viewsql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
|
$selschvals = $result->fetch_assoc(); |
|
|
|
if($type == 2){ |
|
|
|
$viewsql = "SELECT * FROM `companies` WHERE `id` = ".substr($_SESSION["selectedcompany"], 1); |
|
|
|
$result = $conn->query($viewsql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
|
$selcomvals = $result->fetch_assoc(); |
|
|
|
} |
|
|
|
//else{ |
|
|
|
//$modsql = "INSERT INTO `schools` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`) VALUES ('".substr($_SESSION["selectedschool"], 1)."', '', '', '', '', '', '', '')"; |
|
|
|
//$conn->query($modsql); |
|
|
|
//header("Refresh:0"); |
|
|
|
//} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
$viewsql = "SELECT * FROM `schools` WHERE `id` = ".substr($_SESSION["selectedschool"], 1); |
|
|
|
$result = $conn->query($viewsql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
|
$selschvals = $result->fetch_assoc(); |
|
|
|
} |
|
|
|
//else{ |
|
|
|
//$modsql = "INSERT INTO `schools` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`) VALUES ('".substr($_SESSION["selectedschool"], 1)."', '', '', '', '', '', '', '')"; |
|
|
|
//$conn->query($modsql); |
|
|
|
//header("Refresh:0"); |
|
|
|
//} |
|
|
|
} |
|
|
|
//else{ |
|
|
|
//$modsql = "INSERT INTO `schools` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`) VALUES ('".substr($_SESSION["selectedschool"], 1)."', '', '', '', '', '', '', '')"; |
|
|
|
//$conn->query($modsql); |
|
|
|
//header("Refresh:0"); |
|
|
|
//} |
|
|
|
} |
|
|
|
mysqli_free_result($result); |
|
|
|
}else{ |
|
|
@ -279,37 +316,69 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
|
<i class="material-icons">business</i> |
|
|
|
</a> |
|
|
|
<ul class="dropdown-menu"> |
|
|
|
<li class="header">INTÉZMÉNYVÁLASZTÁS</li> |
|
|
|
<li class="header"><?php if($type == 2) { echo "VÁLLALATVÁLASZTÁS"; } else { echo "INTÉZMÉNYVÁLASZTÁS"; } ?></li> |
|
|
|
<li class="body"> |
|
|
|
<ul class="menu"> |
|
|
|
<form method="POST" action="#"> |
|
|
|
<?php |
|
|
|
$ssname = "Nincs iskola kiválasztva"; |
|
|
|
for($i = 0; $i < count($connctdschids); $i++){ |
|
|
|
$sql = "SELECT * FROM `schools` WHERE `id` = ".$connctdschids[$i]; |
|
|
|
$result = $conn->query($sql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if(!isset($_SESSION["selectedschool"])){ |
|
|
|
$_SESSION["selectedschool"] = "s".$sqlvals["id"]; |
|
|
|
} |
|
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
|
if($sqlvals["name"] == ""){ |
|
|
|
$sname = "Ismeretlen"; |
|
|
|
if($type == 2){ |
|
|
|
$ssname = "Nincs vállalat kiválasztva"; |
|
|
|
for($i = 0; $i < count($connctdcmps); $i++){ |
|
|
|
$sql = "SELECT * FROM `companies` WHERE `id` = ".$connctdcmps[$i]; |
|
|
|
$result = $conn->query($sql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if(!isset($_SESSION["selectedcompany"])){ |
|
|
|
$_SESSION["selectedcompany"] = "c".$sqlvals["id"]; |
|
|
|
} |
|
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
|
if($sqlvals["name"] == ""){ |
|
|
|
$sname = "Ismeretlen"; |
|
|
|
}else{ |
|
|
|
$sname = $sqlvals["name"]; |
|
|
|
} |
|
|
|
if(("c".$sqlvals["id"]) == $_SESSION["selectedcompany"]){ |
|
|
|
$ssname = $sname; |
|
|
|
$sname = "(<b>Kiválasztott</b>) ".$sname; |
|
|
|
} |
|
|
|
echo '<button type="submit" name="selectedcompany" value="c'.$sqlvals["id"].'" class="btn bg-transparent waves-effect" style="width: 100%; box-shadow: 0 0 0 0 !important; -webkit-border-radius: 0px;"> |
|
|
|
'.$sname.' (#'.$sqlvals["id"].') |
|
|
|
</button>'; |
|
|
|
}else{ |
|
|
|
$sname = $sqlvals["name"]; |
|
|
|
echo '<button type="submit" name="selectedcompany" value="c'.$connctdcmps[$i].'" class="btn bg-transparent waves-effect" style="width: 100%; box-shadow: 0 0 0 0 !important;"> |
|
|
|
Ismeretlen (#'.$connctdcmps[$i].') |
|
|
|
</button>'; |
|
|
|
} |
|
|
|
if(("s".$sqlvals["id"]) == $_SESSION["selectedschool"]){ |
|
|
|
$ssname = $sname; |
|
|
|
$sname = "(<b>Kiválasztott</b>) ".$sname; |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
$ssname = "Nincs iskola kiválasztva"; |
|
|
|
for($i = 0; $i < count($connctdschids); $i++){ |
|
|
|
$sql = "SELECT * FROM `schools` WHERE `id` = ".$connctdschids[$i]; |
|
|
|
$result = $conn->query($sql); |
|
|
|
if ($result == TRUE) { |
|
|
|
if(!isset($_SESSION["selectedschool"])){ |
|
|
|
$_SESSION["selectedschool"] = "s".$sqlvals["id"]; |
|
|
|
} |
|
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
|
if($sqlvals["name"] == ""){ |
|
|
|
$sname = "Ismeretlen"; |
|
|
|
}else{ |
|
|
|
$sname = $sqlvals["name"]; |
|
|
|
} |
|
|
|
if(("s".$sqlvals["id"]) == $_SESSION["selectedschool"]){ |
|
|
|
$ssname = $sname; |
|
|
|
$sname = "(<b>Kiválasztott</b>) ".$sname; |
|
|
|
} |
|
|
|
echo '<button type="submit" name="selectedschool" value="s'.$sqlvals["id"].'" class="btn bg-transparent waves-effect" style="width: 100%; box-shadow: 0 0 0 0 !important; -webkit-border-radius: 0px;"> |
|
|
|
'.$sname.' (#'.$sqlvals["id"].') |
|
|
|
</button>'; |
|
|
|
}else{ |
|
|
|
echo '<button type="submit" name="selectedschool" value="s'.$connctdschids[$i].'" class="btn bg-transparent waves-effect" style="width: 100%; box-shadow: 0 0 0 0 !important;"> |
|
|
|
Ismeretlen (#'.$connctdschids[$i].') |
|
|
|
</button>'; |
|
|
|
} |
|
|
|
echo '<button type="submit" name="selectedschool" value="s'.$sqlvals["id"].'" class="btn bg-transparent waves-effect" style="width: 100%; box-shadow: 0 0 0 0 !important; -webkit-border-radius: 0px;"> |
|
|
|
'.$sname.' (#'.$sqlvals["id"].') |
|
|
|
</button>'; |
|
|
|
}else{ |
|
|
|
echo '<button type="submit" name="selectedschool" value="s'.$connctdschids[$i].'" class="btn bg-transparent waves-effect" style="width: 100%; box-shadow: 0 0 0 0 !important;"> |
|
|
|
Ismeretlen (#'.$connctdschids[$i].') |
|
|
|
</button>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -318,7 +387,7 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
|
</ul> |
|
|
|
</li> |
|
|
|
<li class="footer"> |
|
|
|
<a href="javascript:void(0);">Intézmények kezelése</a> |
|
|
|
<a href="javascript:void(0);"><?php if($type == 2) { echo "Vállalkozások kezelése"; }else{ echo "Intézmények kezelése"; } ?></a> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</li> |
|
|
@ -358,7 +427,7 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
|
<div class="menu"> |
|
|
|
<ul class="list"> |
|
|
|
<?php if(!$isadmin){ |
|
|
|
if($type == 1){ ?> |
|
|
|
if($type == 1 || $type == 2){ #School admin and partner ?> |
|
|
|
<li class="header">ADMINISZTRÁTOR</li> |
|
|
|
<li> |
|
|
|
<a href="admin"> |
|
|
|