diff --git a/.gitignore b/.gitignore index e037f59..252f3fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ creds.php +images/company +images/school +images/user \ No newline at end of file diff --git a/API/request.php b/API/request.php index 7a091d8..164e909 100644 --- a/API/request.php +++ b/API/request.php @@ -59,13 +59,22 @@ if($type == null){ include "../images/default.png"; } break; + case "company": + header('Content-Type: image/png'); + $file = "../images/company/".$_GET["id"].".png"; + if(file_exists($file)){ + include $file; + }else{ + include "../images/default.png"; + } + break; case "user": header('Content-Type: image/png'); $file = "../images/user/".$_GET["id"].".png"; if(file_exists($file)){ include $file; }else{ - include "../images/user/default.png"; + include "../images/defaultuser.png"; } break; default: @@ -96,6 +105,17 @@ if($type == null){ $result->close(); $conn->close(); break; + case "company": + $list = array(); + if ($result = $conn->query("SELECT * FROM `schooltypes`")) { + while($row = $result->fetch_assoc()) { + $list[] = $row; + } + echo json_encode($list); + } + $result->close(); + $conn->close(); + break; case "user": $list = array(); if ($result = $conn->query("SELECT * FROM `acctypes`")) { diff --git a/admin/dataupload.php b/admin/dataupload.php index a156a87..46c30f3 100644 --- a/admin/dataupload.php +++ b/admin/dataupload.php @@ -12,13 +12,20 @@
-
+
Sikertelen feltöltés. Kérjük vegye fel a kapcsolatot az adminisztrátorokkal.
'; - }elseif($_GET["uploaded"] == 1){ echo '
Sikeres feltöltés
';} + if(isset($_GET["uploaded"]) || isset($_GET["addedfaculty"])){ + if(isset($_GET["uploaded"])){ + if($_GET["uploaded"] == 0){ echo '
Sikertelen feltöltés. Kérjük vegye fel a kapcsolatot az adminisztrátorokkal.
'; + }elseif($_GET["uploaded"] == 1){ echo '
Sikeres feltöltés
'; + } + }else{ + if($_GET["addedfaculty"] == 0){ echo '
A kar hozzáadása sikertelen. Kérjük vegye fel a kapcsolatot az adminisztrátorokkal.
'; + }elseif($_GET["addedfaculty"] == 1){ echo '
Az új kar sikeresen hozzáadva az intézményhez
'; + } + } ?>

- INTÉZMÉNY ADATAI + ADATAI

- Intézmény Neve + Neve
edit
- "> + ">
- Intézmény Típusa + Típusa
school
- + + + + + + + +
@@ -86,14 +98,15 @@
- Intézmény fotója + fotója
- " height="100px" width="100px"> + &id=" height="100px" width="100px">
-
+
Intézmény által oktatott szakok
@@ -112,8 +126,9 @@
+
- Intézmény telefonszáma + telefonszáma
phone @@ -124,7 +139,7 @@
- Intézmény e-mail címe + e-mail címe
email @@ -180,9 +195,102 @@ $result = $conn->query($viewsql); if ($result == TRUE) { if (!empty($result) && $result->num_rows > 0) { - for($i = 0; $i < $result->num_rows; $i++){ + for($i = 0; $i < $result->num_rows; $i++){ + echo '

Kar '.($i+1).'

'; $facvals = $result->fetch_assoc(); - echo "
s".$facvals["facultyid"]."
"; + //echo "
s".$facvals["facultyid"]."
"; + ?> +
+
+ Egyedi Azonosító (ID) +
+ + fact_check + +
+ " value="#" readOnly> +
+
+
+
+ Kar Neve +
+ + edit + +
+ " placeholder="Név" value=""> +
+
+
+
+ Kar által oktatott szakok +
+ + assignment + +
+ " name="facultyspec_"> +
+
+
+
+ Kar telefonszáma +
+ + phone + +
+ " placeholder="Pl.: +36 00/000-0000" value=""> +
+
+
+
+ Kar e-mail címe +
+ + email + +
+ " placeholder="Pl.: kar@intezmeny.hu" value=""> +
+
+
+
+ Irányítószám +
+ + local_post_office + +
+ "> +
+
+
+
+ Város +
+ + location_city + +
+ "> +
+
+
+
+ Utca, házszám +
+ + label + +
+ "> +
+
+
+
+ query($viewsql); + for($i = 0; $i < $result2->num_rows; $i++){ + if ($result2 == TRUE) { + if (!empty($result2) && $result2->num_rows > 0) { + $vals = $result2->fetch_assoc(); + $connctdschids[$i] = $vals["id"]; + } + } + } + mysqli_free_result($result2); }else{ $connctdschids = explode(",", $sqlvals["connectedschoolids"]); } - $sql = "SELECT * FROM `acctypes` WHERE `id` = '".$type."'"; mysqli_free_result($result); + $sql = "SELECT * FROM `acctypes` WHERE `id` = '".$type."'"; $result = $conn->query($sql); $sqlvals = $result->fetch_assoc(); $fulltype = $sqlvals["name_hun"]; @@ -66,19 +79,57 @@ if(!isset($liteload) && !$loggedin && $isadmin && ($type == 1 || $type == 2)){ mysqli_free_result($result); if(isset($data_upload)){ + ini_set("file_uploads", 1); if(isset($_POST["submit"])){ - $modsql = "UPDATE `schools` SET `name` = '".$conn->real_escape_string($_POST['schoolname'])."', `type` = '".$conn->real_escape_string($_POST['schooltype'])."', `postalcode` = '".$conn->real_escape_string($_POST['postcode'])."', `spec` = '".str_replace(', ', ',', preg_replace('/\s+/', ' ', trim($conn->real_escape_string($_POST['spec']))))."', `location` = '".$conn->real_escape_string($_POST['loc'])."', `locationspec` = '".$conn->real_escape_string($_POST['locspec'])."', `phonenumber` = '".$conn->real_escape_string($_POST['phnnum'])."', `emailaddress` = '".$conn->real_escape_string($_POST['email'])."' WHERE `schools`.`id` = ".substr($_SESSION["selectedschool"], 1); - if ($conn->query($modsql) === TRUE) { - header("Location: dataupload.php?uploaded=1"); - } else { + if($type == 2){ + $modsql = "UPDATE `companies` SET `name` = '".$conn->real_escape_string($_POST['formname'])."', `type` = '".$conn->real_escape_string($_POST['formtype'])."', `postalcode` = '".$conn->real_escape_string($_POST['postcode'])."', `spec` = '".str_replace(', ', ',', preg_replace('/\s+/', ' ', trim($conn->real_escape_string($_POST['spec']))))."', `location` = '".$conn->real_escape_string($_POST['loc'])."', `locationspec` = '".$conn->real_escape_string($_POST['locspec'])."', `phonenumber` = '".$conn->real_escape_string($_POST['phnnum'])."', `emailaddress` = '".$conn->real_escape_string($_POST['email'])."' WHERE `companies`.`id` = ".substr($_SESSION["selectedcompany"], 1); + $filepath = $curdir."images/company/".substr($_SESSION["selectedcompany"], 1).".png"; + }else{ + $modsql = "UPDATE `schools` SET `name` = '".$conn->real_escape_string($_POST['formname'])."', `type` = '".$conn->real_escape_string($_POST['formtype'])."', `postalcode` = '".$conn->real_escape_string($_POST['postcode'])."', `spec` = '".str_replace(', ', ',', preg_replace('/\s+/', ' ', trim($conn->real_escape_string($_POST['spec']))))."', `location` = '".$conn->real_escape_string($_POST['loc'])."', `locationspec` = '".$conn->real_escape_string($_POST['locspec'])."', `phonenumber` = '".$conn->real_escape_string($_POST['phnnum'])."', `emailaddress` = '".$conn->real_escape_string($_POST['email'])."' WHERE `schools`.`id` = ".substr($_SESSION["selectedschool"], 1); + $filepath = $curdir."images/school/".substr($_SESSION["selectedschool"], 1).".png"; + } + if(isset($_FILES["formfile"]) && $_FILES["formfile"]['error'] != UPLOAD_ERR_NO_FILE){ + $check = getimagesize($_FILES["formfile"]["tmp_name"]); + if($check !== false) { + $filetype = $_FILES["formfile"]["type"]; + if($filetype != "image/jpg" && $filetype != "image/png" && $filetype != "image/jpeg" && $filetype != "image/gif" ) { + $uploadProblem = 0; + }else{ + if ($_FILES["formfile"]["size"] > 900000) { + $uploadProblem = 1; + }else{ + //move_uploaded_file($_FILES["formfile"]["tmp_name"], $filepath); + copy($_FILES["formfile"]["tmp_name"], $filepath); + } + } + if(isset($uploadProblem)){ + header("Location: dataupload.php?imageuploaded=".$uploadProblem); + die(); + }else{ + header("Location: dataupload.php?imageuploaded=2"); + die(); + } + } + }else{ + if ($conn->query($modsql) === TRUE) { + header("Location: dataupload.php?uploaded=1"); + } else { //echo "Error: " . $modsql . "
" . $conn->error; - header("Location: dataupload.php?uploaded=0"); + //header("Location: dataupload.php?uploaded=0&error=".$conn->error); + header("Location: dataupload.php?uploaded=0"); + } + die(); } - die(); - }elseif(isset($_POST["addfaculty"]) && $_POST['schooltype'] == "uni"){ - $modsql = "INSERT INTO `faculties` (`schoolid`, `facultyname`, `facultyspec`) VALUES ('".substr($_SESSION["selectedschool"], 1)."', '', '')"; + }elseif(isset($_POST["addfaculty"]) && $_POST['formtype'] == "uni"){ + $modsql = "INSERT INTO `faculties` (`schoolid`, `facultyname`, `facultyspec`, `facultyphonenumber`, `facultyemail`) VALUES ('".substr($_SESSION["selectedschool"], 1)."', '', '', '', '')"; $conn->query($modsql); - header("Location: dataupload.php"); + if ($conn->query($modsql) === TRUE) { + header("Location: dataupload.php?addedfaculty=1"); + } else { + //echo "Error: " . $modsql . "
" . $conn->error; + //header("Location: dataupload.php?uploaded=0&error=".$conn->error); + header("Location: dataupload.php?addedfaculty=0"); + } die(); } } @@ -119,7 +170,7 @@ if(!isset($liteload) && !$loggedin && $isadmin && ($type == 1 || $type == 2)){ $result = $conn->query($viewsql); if ($result == TRUE) { if (!empty($result) && $result->num_rows > 0) { - $selcomvals = $result->fetch_assoc(); + $selschvals = $result->fetch_assoc(); } //else{ //$modsql = "INSERT INTO `schools` (`id`, `name`, `type`, `spec`, `postalcode`, `location`, `locationspec`, `phonenumber`) VALUES ('".substr($_SESSION["selectedschool"], 1)."', '', '', '', '', '', '', '')"; @@ -427,7 +478,7 @@ if(!isset($liteload) && !$loggedin && $isadmin && ($type == 1 || $type == 2)){ - +