|
@ -32,13 +32,15 @@ if ($conn->connect_error) { |
|
|
echo json_encode(array('response' => "Database connection error (".$conn->connect_error.")")); |
|
|
echo json_encode(array('response' => "Database connection error (".$conn->connect_error.")")); |
|
|
exit; |
|
|
exit; |
|
|
} |
|
|
} |
|
|
|
|
|
if(isset($_POST["selectedcompany"]) && $loggedin){ |
|
|
if(isset($_POST["selectedschool"]) && $loggedin){ |
|
|
$_SESSION["selectedcompany"] = $_POST["selectedcompany"]; |
|
|
|
|
|
}elseif(isset($_POST["selectedschool"]) && $loggedin){ |
|
|
$_SESSION["selectedschool"] = $_POST["selectedschool"]; |
|
|
$_SESSION["selectedschool"] = $_POST["selectedschool"]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
if(!isset($liteload) && !$loggedin && $isadmin && ($type == 1 || $type == 2)){ |
|
|
header("Location: ".$curdir."login.php"); |
|
|
header("Location: ".$curdir."login.php"); |
|
|
|
|
|
die(); |
|
|
}else{ |
|
|
}else{ |
|
|
if($loggedin == true){ |
|
|
if($loggedin == true){ |
|
|
$id = $_SESSION["id"]; |
|
|
$id = $_SESSION["id"]; |
|
@ -49,7 +51,11 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
$username = $sqlvals["username"]; |
|
|
$username = $sqlvals["username"]; |
|
|
$type = $sqlvals["type"]; |
|
|
$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."'"; |
|
|
$sql = "SELECT * FROM `acctypes` WHERE `id` = '".$type."'"; |
|
|
mysqli_free_result($result); |
|
|
mysqli_free_result($result); |
|
|
$result = $conn->query($sql); |
|
|
$result = $conn->query($sql); |
|
@ -77,32 +83,63 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for($i = 0; $i<count($connctdschids); $i++){ |
|
|
if($type == 2){ |
|
|
$viewsql = "SELECT * FROM `schools` WHERE `id` = ".$connctdschids[$i]; |
|
|
for($i = 0; $i<count($connctdcmps); $i++){ |
|
|
$result = $conn->query($viewsql); |
|
|
$viewsql = "SELECT * FROM `companies` WHERE `id` = ".$connctdcmps[$i]; |
|
|
if ($result == TRUE) { |
|
|
$result = $conn->query($viewsql); |
|
|
if(!isset($_SESSION["selectedschool"])) { |
|
|
if ($result == TRUE) { |
|
|
$_SESSION["selectedschool"] = "s".$connctdschids[$i]; |
|
|
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]."', '', '', '', '', '', '', '', '')"; |
|
|
}else{ |
|
|
$conn->query($modsql); |
|
|
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); |
|
|
mysqli_free_result($result); |
|
|
|
|
|
|
|
|
$viewsql = "SELECT * FROM `schools` WHERE `id` = ".substr($_SESSION["selectedschool"], 1); |
|
|
if($type == 2){ |
|
|
$result = $conn->query($viewsql); |
|
|
$viewsql = "SELECT * FROM `companies` WHERE `id` = ".substr($_SESSION["selectedcompany"], 1); |
|
|
if ($result == TRUE) { |
|
|
$result = $conn->query($viewsql); |
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
if ($result == TRUE) { |
|
|
$selschvals = $result->fetch_assoc(); |
|
|
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); |
|
|
mysqli_free_result($result); |
|
|
}else{ |
|
|
}else{ |
|
@ -279,37 +316,69 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
<i class="material-icons">business</i> |
|
|
<i class="material-icons">business</i> |
|
|
</a> |
|
|
</a> |
|
|
<ul class="dropdown-menu"> |
|
|
<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"> |
|
|
<li class="body"> |
|
|
<ul class="menu"> |
|
|
<ul class="menu"> |
|
|
<form method="POST" action="#"> |
|
|
<form method="POST" action="#"> |
|
|
<?php |
|
|
<?php |
|
|
$ssname = "Nincs iskola kiválasztva"; |
|
|
if($type == 2){ |
|
|
for($i = 0; $i < count($connctdschids); $i++){ |
|
|
$ssname = "Nincs vállalat kiválasztva"; |
|
|
$sql = "SELECT * FROM `schools` WHERE `id` = ".$connctdschids[$i]; |
|
|
for($i = 0; $i < count($connctdcmps); $i++){ |
|
|
$result = $conn->query($sql); |
|
|
$sql = "SELECT * FROM `companies` WHERE `id` = ".$connctdcmps[$i]; |
|
|
if ($result == TRUE) { |
|
|
$result = $conn->query($sql); |
|
|
if(!isset($_SESSION["selectedschool"])){ |
|
|
if ($result == TRUE) { |
|
|
$_SESSION["selectedschool"] = "s".$sqlvals["id"]; |
|
|
if(!isset($_SESSION["selectedcompany"])){ |
|
|
} |
|
|
$_SESSION["selectedcompany"] = "c".$sqlvals["id"]; |
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
} |
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
if (!empty($result) && $result->num_rows > 0) { |
|
|
if($sqlvals["name"] == ""){ |
|
|
$sqlvals = $result->fetch_assoc(); |
|
|
$sname = "Ismeretlen"; |
|
|
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{ |
|
|
}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> |
|
|
</ul> |
|
|
</li> |
|
|
</li> |
|
|
<li class="footer"> |
|
|
<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> |
|
|
</li> |
|
|
</ul> |
|
|
</ul> |
|
|
</li> |
|
|
</li> |
|
@ -358,7 +427,7 @@ if(!isset($liteload) && !$loggedin && $isadmin){ |
|
|
<div class="menu"> |
|
|
<div class="menu"> |
|
|
<ul class="list"> |
|
|
<ul class="list"> |
|
|
<?php if(!$isadmin){ |
|
|
<?php if(!$isadmin){ |
|
|
if($type == 1){ ?> |
|
|
if($type == 1 || $type == 2){ #School admin and partner ?> |
|
|
<li class="header">ADMINISZTRÁTOR</li> |
|
|
<li class="header">ADMINISZTRÁTOR</li> |
|
|
<li> |
|
|
<li> |
|
|
<a href="admin"> |
|
|
<a href="admin"> |
|
|