Advertisement
Guest User

Untitled

a guest
Jul 12th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 22.16 KB | None | 0 0
  1. <?php
  2. class dataBase{
  3.     private static $lesdbInstantie = null;
  4.     private $dbh;
  5.  
  6.     private function __construct($server, $username, $password, $database){
  7.         try{
  8.             $this->dbh =
  9.                 new PDO("mysql:host=$server; dbname=$database;charset=utf8; port=3306", $username, $password);
  10.             $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  11.         }
  12.         catch (PDOException $e){ die($e->getMessage());}
  13.     }
  14.  
  15.     public static function getDataBase($server, $username, $password, $database){
  16.         if(is_null(self::$lesdbInstantie)){
  17.             self::$lesdbInstantie =
  18.                 new dataBase($server, $username, $password, $database);
  19.         }
  20.         return self::$lesdbInstantie;
  21.     }
  22.  
  23.     public function getPictures() {
  24.         try{
  25.             $sql = "select * From meetjeslandPictures";
  26.             $stmt = $this->dbh->prepare($sql);
  27.             $stmt->execute();
  28.             $content = $stmt->fetchAll(PDO::FETCH_CLASS);
  29.         }
  30.         catch (PDOException $e){ die($e->getMessage());}
  31.         return $content;
  32.     }
  33.  
  34.     public function changePicture($naam,$filename,$filetype){
  35.         try{
  36.             $sql = "update meetjeslandPictures set imageRef =:filename , extension = :filetype where naam = :naam";
  37.             $stmt = $this->dbh->prepare($sql);
  38.             $stmt->bindParam(":filename", $filename);
  39.             $stmt->bindParam(":filetype", $filetype);
  40.             $stmt->bindParam(":naam", $naam);
  41.             $stmt->execute();
  42.         }
  43.         catch (PDOException $e){die($e->getMessage());}
  44.     }
  45.  
  46.  
  47.  
  48.     public function getContentFaciliteiten(){
  49.         try{
  50.             $sql = "select * From meetjeslandFaciliteitenPage";
  51.             $stmt = $this->dbh->prepare($sql);
  52.             $stmt->execute();
  53.             $content = $stmt->fetchAll(PDO::FETCH_CLASS);
  54.         }
  55.         catch (PDOException $e){ die($e->getMessage());}
  56.         return $content;
  57.     }
  58.  
  59.     public function updateAlgemeneInfo($nieuwsbrief,$aboutUs){
  60.         try{
  61.             $sql = "UPDATE meetjeslandAlgemeneInfo SET nieuwsbrief = :nieuwsbrief,aboutUs = :aboutUs";
  62.             $stmt = $this->dbh->prepare($sql);
  63.             $stmt->bindParam(":nieuwsbrief", $nieuwsbrief);
  64.             $stmt->bindParam(":aboutUs", $aboutUs);
  65.  
  66.             $stmt->execute();
  67.         }
  68.         catch (PDOException $e){die($e->getMessage());}
  69.     }
  70.  
  71.  
  72.     public function getAlgemeneInfo(){
  73.         try{
  74.             $sql = "select * From meetjeslandAlgemeneInfo";
  75.             $stmt = $this->dbh->prepare($sql);
  76.             $stmt->execute();
  77.             $content = $stmt->fetchAll(PDO::FETCH_CLASS);
  78.         }
  79.         catch (PDOException $e){ die($e->getMessage());}
  80.         return $content;
  81.     }
  82.  
  83.     public function updateDeelnameContent($content){
  84.         try{
  85.             $sql = "UPDATE meetjeslandDeelnamePage SET content = :content";
  86.             $stmt = $this->dbh->prepare($sql);
  87.             $stmt->bindParam(":content", $content);
  88.             $stmt->execute();
  89.         }
  90.         catch (PDOException $e){die($e->getMessage());}
  91.     }
  92.  
  93.     public function updateFaciliteitenContent($content){
  94.         try{
  95.             $sql = "UPDATE meetjeslandFaciliteitenPage SET content = :content";
  96.             $stmt = $this->dbh->prepare($sql);
  97.             $stmt->bindParam(":content", $content);
  98.             $stmt->execute();
  99.         }
  100.         catch (PDOException $e){die($e->getMessage());}
  101.     }
  102.  
  103.     public function getContentDeelname(){
  104.         try{
  105.             $sql = "select * From meetjeslandDeelnamePage";
  106.             $stmt = $this->dbh->prepare($sql);
  107.             $stmt->execute();
  108.             $content = $stmt->fetchAll(PDO::FETCH_CLASS);
  109.         }
  110.         catch (PDOException $e){ die($e->getMessage());}
  111.         return $content;
  112.     }
  113.  
  114.  
  115.  
  116.     public function sluitDB(){
  117.         $dbh = null;
  118.     }
  119.  
  120.     public function getRoutesFromStartPoint($id){
  121.         try{
  122.             $sql = "select * from routeInStartPunt
  123.             join meetjeslandRoutes on routeInStartPunt.routeId = meetjeslandRoutes.idroute
  124.             where StartpuntId = :id";
  125.             $stmt = $this->dbh->prepare($sql);
  126.             $stmt->bindParam(":id", $id);
  127.             $stmt->execute();
  128.             $routes = $stmt->fetchAll(PDO::FETCH_CLASS);
  129.         }
  130.         catch (PDOException $e){ die($e->getMessage());}
  131.         return $routes;
  132.     }
  133.  
  134.     public function getDownloads(){
  135.         try{
  136.             $sql = "select * From meetjeslandDownloads";
  137.             $stmt = $this->dbh->prepare($sql);
  138.             $stmt->execute();
  139.             $downloads = $stmt->fetchAll(PDO::FETCH_CLASS);
  140.         }
  141.         catch (PDOException $e){ die($e->getMessage());}
  142.         return $downloads;
  143.     }
  144.  
  145.     public function getLinksFromDownload($id){
  146.         try{
  147.             $sql = "select * from meetjeslandDownloadsItems where downloadId = :id";
  148.             $stmt = $this->dbh->prepare($sql);
  149.             $stmt->bindParam(":id", $id);
  150.             $stmt->execute();
  151.             $links = $stmt->fetchAll(PDO::FETCH_CLASS);
  152.         }
  153.         catch (PDOException $e){ die($e->getMessage());}
  154.         return $links;
  155.     }
  156.  
  157.     public function getRouteId($naam){
  158.         try{
  159.             $sql = "select * from meetjeslandRoutes where routeNaam = :naam";
  160.             $stmt = $this->dbh->prepare($sql);
  161.             $stmt->bindParam(":naam", $naam);
  162.             $stmt->execute();
  163.             $route = $stmt->fetchAll(PDO::FETCH_CLASS);
  164.         }
  165.         catch (PDOException $e){ die($e->getMessage());}
  166.         return $route;
  167.     }
  168.  
  169.  
  170.  
  171.     public function getLogos(){
  172.         try{
  173.             $sql = "SELECT * FROM meetjeslandImages";
  174.             $stmt = $this->dbh->prepare($sql);
  175.             $stmt->execute();
  176.             $logos = $stmt->fetchAll(PDO::FETCH_CLASS);
  177.         }
  178.         catch (PDOException $e){ die($e->getMessage());}
  179.         return $logos;
  180.     }
  181.  
  182.     public function getInfoPunten(){
  183.         try{
  184.             $sql = "SELECT * FROM meetjeslandInfoPunten";
  185.             $stmt = $this->dbh->prepare($sql);
  186.             $stmt->execute();
  187.             $startpunten = $stmt->fetchAll(PDO::FETCH_CLASS);
  188.         }
  189.         catch (PDOException $e){ die($e->getMessage());}
  190.         return $startpunten;
  191.     }
  192.  
  193.     public function getInfoPuntenFromRoute($id){
  194.             try{
  195.                 $sql = "select * from InfoPuntInRoute
  196.                 join meetjeslandInfoPunten
  197.                 on meetjeslandInfoPunten.id = InfoPuntInRoute.infoPuntId
  198.                 where routeId = :id";
  199.                 $stmt = $this->dbh->prepare($sql);
  200.                 $stmt->bindParam(":id", $id);
  201.                 $stmt->execute();
  202.                 $infoPunten = $stmt->fetchAll(PDO::FETCH_CLASS);
  203.             }
  204.             catch (PDOException $e){ die($e->getMessage());}
  205.             return $infoPunten;
  206.     }
  207.  
  208.     public function getInfoPuntenFromRouteWithId($id){
  209.         try{
  210.             $sql = "select * from InfoPuntInRoute
  211.             where routeId = :id";
  212.             $stmt = $this->dbh->prepare($sql);
  213.             $stmt->bindParam(":id", $id);
  214.             $stmt->execute();
  215.             $infoPunten = $stmt->fetchAll(PDO::FETCH_CLASS);
  216.         }
  217.         catch (PDOException $e){ die($e->getMessage());}
  218.         return $infoPunten;
  219.     }
  220.  
  221.     public function getRouteInStartPunt($id){
  222.         try{
  223.             $sql = "select * from routeInStartPunt
  224.             where routeId = :id";
  225.             $stmt = $this->dbh->prepare($sql);
  226.             $stmt->bindParam(":id", $id);
  227.             $stmt->execute();
  228.             $ids = $stmt->fetchAll(PDO::FETCH_CLASS);
  229.         }
  230.         catch (PDOException $e){ die($e->getMessage());}
  231.         return $ids;
  232.     }
  233.  
  234.     public function getStartPlaatsenFromRoute($id){
  235.             try{
  236.                 $sql = "select * from routeInStartPunt
  237.                 join meetjeslandStartPunten
  238.                 on routeInStartPunt.startpuntid = meetjeslandStartPunten.id
  239.                 where routeid = :id
  240.                 ";
  241.                 $stmt = $this->dbh->prepare($sql);
  242.                 $stmt->bindParam(":id", $id);
  243.                 $stmt->execute();
  244.                 $startplaatsen = $stmt->fetchAll(PDO::FETCH_CLASS);
  245.             }
  246.             catch (PDOException $e){ die($e->getMessage());}
  247.             return $startplaatsen;
  248.     }
  249.  
  250.  
  251.  
  252.     public function getStartPlaatsen(){
  253.         try{
  254.             $sql = "SELECT * FROM meetjeslandStartPunten";
  255.             $stmt = $this->dbh->prepare($sql);
  256.             $stmt->execute();
  257.             $startpunten = $stmt->fetchAll(PDO::FETCH_CLASS);
  258.         }
  259.         catch (PDOException $e){ die($e->getMessage());}
  260.         return $startpunten;
  261.     }
  262.  
  263.  
  264.  
  265.     public function saveImage($name , $img){
  266.         try{
  267.             $sql = "INSERT INTO meetjeslandImages(name,image) values (:name ,:image)";
  268.             $stmt = $this->dbh->prepare($sql);
  269.             $stmt->bindParam(":name", $name);
  270.             $stmt->bindParam(":image" , $img);
  271.             $stmt->execute();
  272.         }
  273.         catch (PDOException $e){
  274.             die($e->getMessage());
  275.         }
  276.     }
  277.  
  278.  
  279.  
  280.     public function getImages(){
  281.         try{
  282.             $sql = "SELECT * FROM meetjeslandImages";
  283.             $stmt = $this->dbh->prepare($sql);
  284.             $stmt->execute();
  285.             $images = $stmt->fetchAll(PDO::FETCH_CLASS);
  286.         }
  287.         catch (PDOException $e){ die($e->getMessage());}
  288.         return $images;
  289.     }
  290.  
  291.  
  292.  
  293.     public function getRoutes(){
  294.         try{
  295.             $sql = "SELECT * FROM meetjeslandRoutes";
  296.             $stmt = $this->dbh->prepare($sql);
  297.             $stmt->execute();
  298.             $routes = $stmt->fetchAll(PDO::FETCH_CLASS);
  299.         }
  300.         catch (PDOException $e){ die($e->getMessage());}
  301.         return $routes;
  302.     }
  303.  
  304.     public function getFooterInfo(){
  305.         try{
  306.             $sql = "SELECT * FROM meetjeslandFooter";
  307.             $stmt = $this->dbh->prepare($sql);
  308.             $stmt->execute();
  309.             $info = $stmt->fetchAll(PDO::FETCH_CLASS);
  310.         }
  311.         catch (PDOException $e){ die($e->getMessage());}
  312.         return $info;
  313.     }
  314.  
  315.     public function getFotos(){
  316.         try{
  317.             $sql = "SELECT * FROM meetjeslandFotos order by jaar desc";
  318.             $stmt = $this->dbh->prepare($sql);
  319.             $stmt->execute();
  320.             $fotos = $stmt->fetchAll(PDO::FETCH_CLASS);
  321.         }
  322.         catch (PDOException $e){ die($e->getMessage());}
  323.         return $fotos;
  324.     }
  325.  
  326.     public function getInfoFromPostCode($code){
  327.         try{
  328.             $sql = "SELECT * FROM gemeente WHERE postcode = :code";
  329.             $stmt = $this->dbh->prepare($sql);
  330.             $stmt->bindParam(":code", $code);
  331.             $stmt->execute();
  332.             $info = $stmt->fetchAll(PDO::FETCH_CLASS);
  333.         }
  334.         catch (PDOException $e){ die($e->getMessage());}
  335.         return $info;
  336.     }
  337.  
  338.     public function getInfoAboutLogo($name){
  339.         try{
  340.             $sql = "SELECT * FROM meetjeslandImages WHERE name = :name";
  341.             $stmt = $this->dbh->prepare($sql);
  342.             $stmt->bindParam(":name", $name);
  343.             $stmt->execute();
  344.             $user = $stmt->fetchAll(PDO::FETCH_CLASS);
  345.         }
  346.         catch (PDOException $e){ die($e->getMessage());}
  347.         return $user;
  348.     }
  349.  
  350.     public function addLogo($name, $type, $link,$imageRef,$extension){
  351.         try{
  352.             $sql = "INSERT INTO meetjeslandImages(name, type, link, extension, imageRef)
  353.                         VALUES(:name, :type, :link, :extension, :imageRef)";
  354.             $stmt = $this->dbh->prepare($sql);
  355.             $stmt->bindParam(":name", $name);
  356.             $stmt->bindParam(":type", $type);
  357.             $stmt->bindParam(":link", $link);
  358.             $stmt->bindParam(":extension", $extension);
  359.             $stmt->bindParam(":imageRef", $imageRef);
  360.             $stmt->execute();
  361.         }
  362.         catch (PDOException $e){die($e->getMessage());}
  363.     }
  364.  
  365.     public function makeUser($name , $password){
  366.         try{
  367.             $sql = "INSERT INTO meetjeslandUsers(name,password) values (:user,:password)";
  368.             $stmt = $this->dbh->prepare($sql);
  369.             $stmt->bindParam(":user", $name);
  370.             $stmt->bindParam(":password", $password);
  371.             $stmt->execute();
  372.         }
  373.         catch (PDOException $e){
  374.             die($e->getMessage());
  375.         }
  376.     }
  377.  
  378.     public function removeLogo($id){
  379.         try{
  380.             $sql = "DELETE FROM meetjeslandImages WHERE imageId = :id";
  381.             $stmt = $this->dbh->prepare($sql);
  382.             $stmt->bindParam(":id", $id);
  383.             $stmt->execute();
  384.         }
  385.         catch (PDOException $e){die($e->getMessage());}
  386.     }
  387.  
  388.  
  389.     public function changeImageLogo($logo,$fileName,$extension){
  390.         try{
  391.             $sql = "UPDATE meetjeslandImages SET imageRef = :fileName,extension = :extension
  392.                             WHERE name = :logo";
  393.             $stmt = $this->dbh->prepare($sql);
  394.             $stmt->bindParam(":fileName", $fileName);
  395.             $stmt->bindParam(":extension", $extension);
  396.             $stmt->bindParam(":logo", $logo);
  397.             $stmt->execute();
  398.         }
  399.         catch (PDOException $e){die($e->getMessage());}
  400.     }
  401.  
  402.     public function changeLogo($logoName, $newName, $type, $link){
  403.         try{
  404.             $sql = "UPDATE meetjeslandImages SET name = :newName,type = :type,link = :link
  405.                             WHERE name = :logoName";
  406.             $stmt = $this->dbh->prepare($sql);
  407.             $stmt->bindParam(":newName", $newName);
  408.             $stmt->bindParam(":type", $type);
  409.             $stmt->bindParam(":link", $link);
  410.             $stmt->bindParam(":logoName", $logoName);
  411.             $stmt->execute();
  412.         }
  413.         catch (PDOException $e){die($e->getMessage());}
  414.     }
  415.  
  416.  
  417.  
  418.  
  419.     public function checkOnUser($name,$password){
  420.         try{
  421.             $sql = "SELECT * FROM meetjeslandUsers WHERE name = :name and password = :password ";
  422.             $stmt = $this->dbh->prepare($sql);
  423.             $stmt->bindParam(":name", $name);
  424.             $stmt->bindParam(":password" , $password);
  425.             $stmt->execute();
  426.             $user = $stmt->fetchAll(PDO::FETCH_CLASS);
  427.         }
  428.         catch (PDOException $e){ die($e->getMessage());}
  429.         if(isset($user[0])) { return true; }
  430.         else{ return false; }
  431.     }
  432.  
  433.     public function addRoute($naam,$routeInformatie,$afstand,$type,$fileName,$imageFileType){
  434.         try{
  435.             $sql = "INSERT INTO meetjeslandRoutes (routeNaam,informatie,afstand,type,imageRef,extension)
  436.                         VALUES(:routeNaam, :informatie, :afstand, :type, :imageRef, :extension)";
  437.             $stmt = $this->dbh->prepare($sql);
  438.             $stmt->bindParam(":routeNaam", $naam);
  439.             $stmt->bindParam(":informatie", $routeInformatie);
  440.             $stmt->bindParam(":afstand", $afstand);
  441.             $stmt->bindParam(":type", $type);
  442.             $stmt->bindParam(":imageRef", $fileName);
  443.             $stmt->bindParam(":extension", $imageFileType);
  444.             $stmt->execute();
  445.         }
  446.         catch (PDOException $e){die($e->getMessage());}
  447.     }
  448.  
  449.     public function changeRoute($naam,$routeInformatie,$afstand,$type,$routeName){
  450.         try{
  451.             $sql = "UPDATE meetjeslandRoutes SET routeNaam = :naam, informatie = :routeinformatie, afstand = :afstand, type = :type
  452.                             WHERE routeNaam = :oriName";
  453.             $stmt = $this->dbh->prepare($sql);
  454.             $stmt->bindParam(":naam", $naam);
  455.             $stmt->bindParam(":routeinformatie", $routeInformatie);
  456.             $stmt->bindParam(":afstand", $afstand);
  457.             $stmt->bindParam(":type", $type);
  458.             $stmt->bindParam(":oriName", $routeName);
  459.             $stmt->execute();
  460.         }
  461.         catch (PDOException $e){die($e->getMessage());}
  462.     }
  463.  
  464.  
  465.  
  466.     public function changeRouteImage($naam,$fileName,$imageFileType){
  467.         try{
  468.             $sql = "UPDATE meetjeslandRoutes SET imageRef = :fileName, extension = :extension
  469.                             WHERE routeNaam = :naam";
  470.             $stmt = $this->dbh->prepare($sql);
  471.             $stmt->bindParam(":naam", $naam);
  472.             $stmt->bindParam(":fileName", $fileName);
  473.             $stmt->bindParam(":extension", $imageFileType);
  474.             $stmt->execute();
  475.         }
  476.         catch (PDOException $e){die($e->getMessage());}
  477.     }
  478.  
  479.     public function deleteRoute($id){
  480.         try{
  481.             $sql = "DELETE FROM meetjeslandRoutes WHERE idroute = :id";
  482.             $stmt = $this->dbh->prepare($sql);
  483.             $stmt->bindParam(":id", $id);
  484.             $stmt->execute();
  485.         }
  486.         catch (PDOException $e){die($e->getMessage());}
  487.     }
  488.  
  489.  
  490.     public function addDownloadEditie($naam,$jaar){
  491.         try{
  492.             $sql = "INSERT INTO meetjeslandDownloads (naam,jaar)
  493.                         VALUES(:naam,:jaar)";
  494.             $stmt = $this->dbh->prepare($sql);
  495.             $stmt->bindParam(":naam", $naam);
  496.             $stmt->bindParam(":jaar", $jaar);
  497.             $stmt->execute();
  498.         }
  499.         catch (PDOException $e){die($e->getMessage());}
  500.  
  501.     }
  502.  
  503.     public function updateDownloadEditie($id,$naam,$jaar){
  504.         try{
  505.             $sql = "UPDATE meetjeslandDownloads SET naam = :naam, jaar = :jaar
  506.                             WHERE id = :id";
  507.             $stmt = $this->dbh->prepare($sql);
  508.             $stmt->bindParam(":naam", $naam);
  509.             $stmt->bindParam(":id", $id);
  510.             $stmt->bindParam(":jaar", $jaar);
  511.             $stmt->execute();
  512.         }
  513.         catch (PDOException $e){die($e->getMessage());}
  514.  
  515.     }
  516.  
  517.     public function deleteDownloadEditie($id){
  518.         try{
  519.             $sql = "DELETE FROM meetjeslandDownloads WHERE id = :id";
  520.             $stmt = $this->dbh->prepare($sql);
  521.             $stmt->bindParam(":id", $id);
  522.             $stmt->execute();
  523.         }
  524.         catch (PDOException $e){die($e->getMessage());}
  525.     }
  526.  
  527.     public function addLink($downloadId,$naam,$link){
  528.         try{
  529.             $sql = "INSERT INTO meetjeslandDownloadsItems (downloadId,naam,link)
  530.                         VALUES(:downloadId,:naam,:link)";
  531.             $stmt = $this->dbh->prepare($sql);
  532.             $stmt->bindParam(":downloadId", $downloadId);
  533.             $stmt->bindParam(":naam", $naam);
  534.             $stmt->bindParam(":link", $link);
  535.             $stmt->execute();
  536.         }
  537.         catch (PDOException $e){die($e->getMessage());}
  538.     }
  539.  
  540.     public function changeLink($id,$naam,$link){
  541.         try{
  542.             $sql = "UPDATE meetjeslandDownloadsItems SET naam = :naam, link =:link
  543.                             WHERE id = :id";
  544.             $stmt = $this->dbh->prepare($sql);
  545.             $stmt->bindParam(":naam", $naam);
  546.             $stmt->bindParam(":link", $link);
  547.             $stmt->bindParam(":id", $id);
  548.             $stmt->execute();
  549.         }
  550.         catch (PDOException $e){die($e->getMessage());}
  551.     }
  552.  
  553.     public function deleteLink($id){
  554.         try{
  555.             $sql = "DELETE FROM meetjeslandDownloadsItems WHERE id = :id";
  556.             $stmt = $this->dbh->prepare($sql);
  557.             $stmt->bindParam(":id", $id);
  558.             $stmt->execute();
  559.         }
  560.         catch (PDOException $e){die($e->getMessage());}
  561.     }
  562.  
  563.     public function deleteLinks($id){
  564.         try{
  565.             $sql = "DELETE FROM meetjeslandDownloadsItems WHERE downloadId = :id";
  566.             $stmt = $this->dbh->prepare($sql);
  567.             $stmt->bindParam(":id", $id);
  568.             $stmt->execute();
  569.         }
  570.         catch (PDOException $e){die($e->getMessage());}
  571.     }
  572.  
  573.     public function addFotoAlbum($albumNaam,$fotoGrafen,$albumLink,$jaar){
  574.         try{
  575.             $sql = "INSERT INTO meetjeslandFotos (naam,fotografen,link,jaar)
  576.                         VALUES(:naam,:fotografen,:link,:jaar)";
  577.             $stmt = $this->dbh->prepare($sql);
  578.             $stmt->bindParam(":naam", $albumNaam);
  579.             $stmt->bindParam(":fotografen", $fotoGrafen);
  580.             $stmt->bindParam(":link", $albumLink);
  581.             $stmt->bindParam(":jaar", $jaar);
  582.             $stmt->execute();
  583.         }
  584.         catch (PDOException $e){die($e->getMessage());}
  585.     }
  586.  
  587.     public function changeFotoAlbum($albumNaam,$fotoGrafen,$albumLink,$id,$jaar){
  588.         try{
  589.             $sql = "UPDATE meetjeslandFotos SET naam = :naam,fotografen = :fotografen ,link =:link, jaar=:jaar
  590.                             WHERE id = :id";
  591.             $stmt = $this->dbh->prepare($sql);
  592.             $stmt->bindParam(":naam", $albumNaam);
  593.             $stmt->bindParam(":fotografen", $fotoGrafen);
  594.             $stmt->bindParam(":link", $albumLink);
  595.             $stmt->bindParam(":id", $id);
  596.             $stmt->bindParam(":jaar", $jaar);
  597.             $stmt->execute();
  598.         }
  599.         catch (PDOException $e){die($e->getMessage());}
  600.     }
  601.  
  602.     public function deleteFotoAlbum($id){
  603.         try{
  604.             $sql = "DELETE FROM meetjeslandFotos WHERE id = :id";
  605.             $stmt = $this->dbh->prepare($sql);
  606.             $stmt->bindParam(":id", $id);
  607.             $stmt->execute();
  608.         }
  609.         catch (PDOException $e){die($e->getMessage());}
  610.     }
  611.  
  612.     public function addStartpunt($startpuntName,$openingsuren,$sluittijd,$postcode,$gemeente,$straat,$nummer,$informatie){
  613.         try{
  614.             $sql = "INSERT INTO meetjeslandStartPunten (naam,gemeente,postcode,straat,huisnummer,information,start,sluit)
  615.                         VALUES(:naam,:gemeente,:postcode,:straat,:huisnummer,:information,:start,:sluit)";
  616.             $stmt = $this->dbh->prepare($sql);
  617.             $stmt->bindParam(":naam", $startpuntName);
  618.             $stmt->bindParam(":gemeente", $gemeente);
  619.             $stmt->bindParam(":postcode", $postcode);
  620.             $stmt->bindParam(":straat", $straat);
  621.             $stmt->bindParam(":huisnummer", $nummer);
  622.             $stmt->bindParam(":information", $informatie);
  623.             $stmt->bindParam(":start", $openingsuren);
  624.             $stmt->bindParam(":sluit", $sluittijd);
  625.             $stmt->execute();
  626.         }
  627.         catch (PDOException $e){die($e->getMessage());}
  628.  
  629.     }
  630.     public function changeStartpunt($startpuntName,$openingsuren,$sluittijd,$postcode,$gemeente,$straat,$nummer,$informatie,$id){
  631.         try{
  632.             $sql = "UPDATE meetjeslandStartPunten SET naam = :naam, gemeente = :gemeente, postcode =:postcode, straat =:straat, huisnummer =:huisnummer, information = :information, start = :start, sluit = :sluit
  633.                             WHERE id = :id";
  634.             $stmt = $this->dbh->prepare($sql);
  635.             $stmt->bindParam(":naam", $startpuntName);
  636.             $stmt->bindParam(":gemeente", $gemeente);
  637.             $stmt->bindParam(":postcode", $postcode);
  638.             $stmt->bindParam(":straat", $straat);
  639.             $stmt->bindParam(":huisnummer", $nummer);
  640.             $stmt->bindParam(":information", $informatie);
  641.             $stmt->bindParam(":start", $openingsuren);
  642.             $stmt->bindParam(":sluit", $sluittijd);
  643.             $stmt->bindParam(":id", $id);
  644.             $stmt->execute();
  645.         }
  646.         catch (PDOException $e){die($e->getMessage());}
  647.     }
  648.  
  649.     public function deleteStartpunt($id){
  650.         try{
  651.             $sql = "DELETE FROM meetjeslandStartPunten WHERE id = :id";
  652.             $stmt = $this->dbh->prepare($sql);
  653.             $stmt->bindParam(":id", $id);
  654.             $stmt->execute();
  655.         }
  656.         catch (PDOException $e){die($e->getMessage());}
  657.     }
  658.  
  659.     public function addInfoPunt($naam,$informatie,$fileName,$imageFileType){
  660.  
  661.         try{
  662.             $sql = "INSERT INTO meetjeslandInfoPunten (infoPuntName,infoPuntInformatie,imageRef,extension)
  663.                         VALUES(:naam,:informatie,:imageref,:extension)";
  664.             $stmt = $this->dbh->prepare($sql);
  665.             $stmt->bindParam(":naam", $naam);
  666.             $stmt->bindParam(":informatie", $informatie);
  667.             $stmt->bindParam(":imageref", $fileName);
  668.             $stmt->bindParam(":extension", $imageFileType);
  669.             $stmt->execute();
  670.         }
  671.         catch (PDOException $e){die($e->getMessage());}
  672.     }
  673.  
  674.     public function changeInfoPunt($naam,$informatie,$id){
  675.         try{
  676.             $sql = "UPDATE meetjeslandInfoPunten SET infoPuntName = :naam, infoPuntInformatie = :informatie
  677.                             WHERE id = :id";
  678.             $stmt = $this->dbh->prepare($sql);
  679.             $stmt->bindParam(":naam", $naam);
  680.             $stmt->bindParam(":informatie", $informatie);
  681.             $stmt->bindParam(":id", $id);
  682.             $stmt->execute();
  683.         }
  684.         catch (PDOException $e){die($e->getMessage());}
  685.     }
  686.  
  687.     public function changeImageInfoPunt($id,$fileName,$imageFileType){
  688.         try{
  689.             $sql = "UPDATE meetjeslandInfoPunten SET imageRef = :imageref,extension = :extension
  690.                             WHERE id = :id";
  691.             $stmt = $this->dbh->prepare($sql);
  692.             $stmt->bindParam(":imageref", $fileName);
  693.             $stmt->bindParam(":extension", $imageFileType);
  694.             $stmt->bindParam(":id", $id);
  695.             $stmt->execute();
  696.         }
  697.         catch (PDOException $e){die($e->getMessage());}
  698.     }
  699.  
  700.     public function deleteInfoPunt($id){
  701.         try{
  702.             $sql = "DELETE FROM meetjeslandInfoPunten WHERE id = :id";
  703.             $stmt = $this->dbh->prepare($sql);
  704.             $stmt->bindParam(":id", $id);
  705.             $stmt->execute();
  706.         }
  707.         catch (PDOException $e){die($e->getMessage());}
  708.  
  709.     }
  710.  
  711.     public function removeReferencesWithId($id){
  712.         try{
  713.             $sql = "DELETE FROM routeInStartPunt WHERE StartpuntId = :id";
  714.             $stmt = $this->dbh->prepare($sql);
  715.             $stmt->bindParam(":id", $id);
  716.             $stmt->execute();
  717.         }
  718.         catch (PDOException $e){die($e->getMessage());}
  719.     }
  720.  
  721.     public function removeReferencesInfoPuntRoute($id){
  722.         try{
  723.             $sql = "DELETE FROM InfoPuntInRoute WHERE routeId = :id";
  724.             $stmt = $this->dbh->prepare($sql);
  725.             $stmt->bindParam(":id", $id);
  726.             $stmt->execute();
  727.         }
  728.         catch (PDOException $e){die($e->getMessage());}
  729.     }
  730.  
  731.     public function addReferencesInfoPuntInRoute($routeName,$checkbox){
  732.         try{
  733.             $sql = "INSERT INTO InfoPuntInRoute (routeId,infoPuntId)
  734.                         VALUES(:routeid,:infoPuntId)";
  735.             $stmt = $this->dbh->prepare($sql);
  736.             $stmt->bindParam(":routeid", $routeName);
  737.             $stmt->bindParam(":infoPuntId", $checkbox);
  738.             $stmt->execute();
  739.         }
  740.         catch (PDOException $e){die($e->getMessage());}
  741.     }
  742.  
  743.     public function addReferenceStartPuntRoute($routeName,$checkbox){
  744.         try{
  745.             $sql = "INSERT INTO routeInStartPunt (routeId,StartpuntId)
  746.                         VALUES(:routeid,:starpuntid)";
  747.             $stmt = $this->dbh->prepare($sql);
  748.             $stmt->bindParam(":routeid", $checkbox);
  749.             $stmt->bindParam(":starpuntid", $routeName);
  750.             $stmt->execute();
  751.         }
  752.         catch (PDOException $e){die($e->getMessage());}
  753.     }
  754.  
  755.  
  756. }
  757. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement