PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/src/beheer/updateAanbieder.php

https://bitbucket.org/jwubs/gratisgolfpolis.nl
PHP | 82 lines | 71 code | 10 blank | 1 comment | 8 complexity | 97bad6aae73e59fa78128ba915bdfc8e MD5 | raw file
  1. <?php
  2. if($_POST["vvlogolinks"]=="ja"){
  3. $tok = explode('.',$_FILES["logolinks"]["name"]);
  4. $logolinks = 'logo'.$_GET["id"].'_links.'.$tok[count($tok)-1];
  5. move_uploaded_file($_FILES["logolinks"]["tmp_name"], "../img/aanbieders/".$logolinks);
  6. $logopath = getcwd().'/../img/aanbieders/'.$logolinks;
  7. chmod($logopath, 0777);
  8. }
  9. if($_POST["vvlogorechts"]=="ja"){
  10. $tok = explode('.',$_FILES["logorechts"]["name"]);
  11. $logorechts = 'logo'.$_GET["id"].'_rechts.'.$tok[count($tok)-1];
  12. move_uploaded_file($_FILES["logorechts"]["tmp_name"], "../img/aanbieders/".$logorechts);
  13. $logopath = getcwd().'/../img/aanbieders/'.$logorechts;
  14. chmod($logopath, 0777);
  15. }
  16. $conn = mysql_connect('91.184.10.91', 'mysqlgratisgolf', 'g0lfp0l1s');
  17. mysql_select_db('gratisgolfpolis', $conn);
  18. $result = mysql_query("SELECT * FROM user WHERE id='".$_COOKIE["bid"]."'");
  19. $aantal = mysql_num_rows($result);
  20. if($aantal==1){
  21. $row = mysql_fetch_array($result);
  22. $bid = $row["id"];
  23. $bname = $row['name'];
  24. } else {
  25. //header("Location:login.html");
  26. }
  27. $result = mysql_query("SELECT * FROM aanbieders WHERE id='".$_GET["id"]."'");
  28. $row = mysql_fetch_array($result);
  29. $entrycode=0;
  30. if($_POST["entrycode"]=="ja"){
  31. $entrycode=1;
  32. }
  33. $algemeenaktie=0;
  34. if($_POST["algemeenaktie"]=="ja"){
  35. $algemeenaktie=1;
  36. }
  37. $sponsorpagina=0;
  38. if($_POST["sponsorpagina"]=="ja"){
  39. $sponsorpagina=1;
  40. }
  41. if(isset($_POST["detailtext"])){
  42. $str = "UPDATE aanbieders SET hiobedrag='".$_POST["hiobedrag"]."', intro='".str_replace("'","\'",$_POST["intro"])."', aanvraag='".str_replace("'","\'",$_POST["aanvraagtext"])."', bedankpagina='".str_replace("'","\'",$_POST["bedanktext"])."',hioinfo='".str_replace("'","\'",$_POST["hioinfotext"])."', detail='".str_replace("'","\'",$_POST["detailtext"])."', exitlink='".$_POST["exitlink"]."', entrycode=".$entrycode.", algemeenaktie=".$algemeenaktie.", sponsorpagina=".$sponsorpagina;
  43. } else {
  44. $str = "UPDATE aanbieders SET hiobedrag='".$_POST["hiobedrag"]."', intro='".str_replace("'","\'",$_POST["intro"])."', aanvraag='".str_replace("'","\'",$_POST["aanvraagtext"])."', bedankpagina='".str_replace("'","\'",$_POST["bedanktext"])."',hioinfo='".str_replace("'","\'",$_POST["hioinfotext"])."', entrycode=".$entrycode.", algemeenaktie=".$algemeenaktie.", sponsorpagina=".$sponsorpagina;
  45. }
  46. if($_POST["vvlogolinks"]=="ja"){
  47. $str = $str.", logolinks='".$logolinks."'";
  48. }
  49. if($_POST["vvlogorechts"]=="ja"){
  50. $str = $str.", logorechts='".$logorechts."'";
  51. }
  52. $str = $str.", urlname='".$_POST["urlname"]."'";
  53. $str = $str.", kvk='". $_POST["kvk"]."'
  54. , bedrijfsnaam='". $_POST["bedrijfsnaam"]."'
  55. , adres='".$_POST["adres"]."'
  56. , huisnr='".$_POST["huisnr"]."'
  57. , postcode='".$_POST["postcode"]."'
  58. , plaats='".$_POST["plaats"]."'
  59. , telefoon='".$_POST["telefoon"]."'
  60. , fax='".$_POST["fax"]."'
  61. , email='".$_POST["email"]."'
  62. , homepage='".$_POST["homepage"]."'
  63. , kontaktpersoon='".$_POST["kontaktpersoon"]."'";
  64. $str = $str." WHERE id='".$_GET["id"]."'";
  65. mysql_query($str);
  66. header("Location:index.php?act=aanbieders");
  67. ?>