PageRenderTime 120ms CodeModel.GetById 17ms RepoModel.GetById 2ms app.codeStats 0ms

/src/beheer/insertAanbieder.php

https://bitbucket.org/jwubs/gratisgolfpolis.nl
PHP | 71 lines | 59 code | 12 blank | 0 comment | 6 complexity | 25f2ac67e30c1f732eed9055d66805eb MD5 | raw file
  1. <?php
  2. $conn = mysql_connect('91.184.10.91', 'mysqlgratisgolf', 'g0lfp0l1s');
  3. mysql_select_db('gratisgolfpolis', $conn);
  4. $tok = explode('.',$_FILES["logorechts"]["name"]);
  5. $logorechts = 'logo'.$_POST["name"].'_rechts.'.$tok[count($tok)-1];
  6. move_uploaded_file($_FILES["logorechts"]["tmp_name"], "../img/aanbieders/".$logorechts);
  7. $logopath = getcwd().'/../img/aanbieders/'.$logorechts;
  8. chmod($logopath, 0777);
  9. $tok = explode('.',$_FILES["logolinks"]["name"]);
  10. $logolinks = 'logo'.$_POST["name"].'_links.'.$tok[count($tok)-1];
  11. move_uploaded_file($_FILES["logolinks"]["tmp_name"], "../img/aanbieders/".$logolinks);
  12. $logopath = getcwd().'/../img/aanbieders/'.$logolinks;
  13. chmod($logopath, 0777);
  14. $result = mysql_query("SELECT * FROM user WHERE id='".$_COOKIE["bid"]."'");
  15. $aantal = mysql_num_rows($result);
  16. if($aantal==1){
  17. $row = mysql_fetch_array($result);
  18. $bid = $row["id"];
  19. $bname = $row['name'];
  20. } else {
  21. header("Location:login.html");
  22. }
  23. $entrycode=0;
  24. if($_POST["entrycode"]=="ja"){
  25. $entrycode=1;
  26. }
  27. $algemeenaktie=0;
  28. if($_POST["algemeenaktie"]=="ja"){
  29. $algemeenaktie=1;
  30. }
  31. $sponsorpagina=0;
  32. if($_POST["sponsorpagina"]=="ja"){
  33. $sponsorpagina=1;
  34. }
  35. if(isset($_POST["urlname"])){
  36. mkdir(getcwd()."/../".$_POST["urlname"],0777);
  37. $myFile = getcwd()."/../".$_POST["urlname"]."/index.html";
  38. $fh = fopen($myFile, 'w') or die("can't open file");
  39. $stringData = "<html><head></head><body onload='document.forms[0].submit();'>\n";
  40. fwrite($fh, $stringData);
  41. $stringData = "<form action='/go2sponsor.php' method='post'>\n";
  42. fwrite($fh, $stringData);
  43. $stringData = "<input type='hidden' name='sponsor' value='".$_POST["urlname"]."' />\n";
  44. fwrite($fh, $stringData);
  45. $stringData = "</form></body></html>\n";
  46. fwrite($fh, $stringData);
  47. fclose($fh);
  48. }
  49. $str = "INSERT INTO aanbieders (name, urlname, logorechts, logolinks, intro, detail, exitlink, entrycode, algemeenaktie, sponsorpagina, kvk, bedrijfsnaam, adres, huisnr, postcode, plaats, telefoon, fax, email, homepage, kontaktpersoon) VALUES ('".$_POST["name"]."','".$_POST["urlname"]."','".$logorechts."','".$logolinks."','".str_replace("'","\'",$_POST["intro"])."','".str_replace("'","\'",$_POST["detailtext"])."','".$_POST["exitlink"]."',".$entrycode.",".$algemeenaktie.",".$sponsorpagina.",'". $_POST["kvk"]."','". $_POST["bedrijfsnaam"]."','".$_POST["adres"]."','".$_POST["huisnr"]."','".$_POST["postcode"]."','".$_POST["plaats"]."','".$_POST["telefoon"]."','".$_POST["fax"]."','".$_POST["email"]."','".$_POST["homepage"]."','".$_POST["kontaktpersoon"]."')";
  50. mysql_query($str);
  51. header("Location:index.php?act=aanbieders");
  52. ?>