Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <?
  2. // include_once "../inc/conf.php";
  3.  
  4. function reverseDate($value){
  5. $changeDate = explode('-', $value);
  6. $d = $changeDate[0];
  7. $m = $changeDate[1];
  8. $y = $changeDate[2];
  9. $arr = array($y, $m, $d);
  10. $changeDate = implode('-', $arr);
  11. return mysql_real_escape_string($changeDate);
  12. }
  13. //година
  14. if(!empty($_GET['year'])){$year1 = $_GET['year'];}
  15. if(!empty($_GET['year2'])){$year2 = $_GET['year2'];}
  16. if(!empty($_GET['year3'])){$year3 = $_GET['year3'];}
  17. if(!empty($_GET['year4'])){$year4 = $_GET['year4'];}
  18. if(!empty($_GET['year5'])){$year5 = $_GET['year5'];}
  19. //почивен ден
  20. if(!empty($_GET['rest_day'])){$rest1 = reverseDate($_GET['rest_day']);}
  21. if(!empty($_GET['rest_day2'])){$rest2 = reverseDate($_GET['rest_day2']);}
  22. if(!empty($_GET['rest_day3'])){$rest3 = reverseDate($_GET['rest_day3']);}
  23. if(!empty($_GET['rest_day4'])){$rest4 = reverseDate($_GET['rest_day4']);}
  24. if(!empty($_GET['rest_day5'])){$rest5 = reverseDate($_GET['rest_day5']);}
  25. //работен ден
  26. if(!empty($_GET['work_day'])){$work1 = reverseDate($_GET['work_day']);}
  27. if(!empty($_GET['work_day2'])){$work2 = reverseDate($_GET['work_day2']);}
  28. if(!empty($_GET['work_day3'])){$work3 = reverseDate($_GET['work_day3']);}
  29. if(!empty($_GET['work_day4'])){$work4 = reverseDate($_GET['work_day4']);}
  30. if(!empty($_GET['work_day5'])){$work5 = reverseDate($_GET['work_day5']);}
  31. //основание
  32. if(!empty($_GET['reason'])){$reason1 = $_GET['reason'];}
  33. if(!empty($_GET['reason2'])){$reason2 = $_GET['reason2'];}
  34. if(!empty($_GET['reason3'])){$reason3 = $_GET['reason3'];}
  35. if(!empty($_GET['reason4'])){$reason4 = $_GET['reason4'];}
  36. if(!empty($_GET['reason5'])){$reason5 = $_GET['reason5'];}
  37.  
  38. $sql = "INSERT INTO calendar(year, extra_work_day, extra_not_work_day, reason)";
  39. if($_GET['check1'] == 1){$sql .= " VALUES('$year1','$work1','$rest1','$reason1')";}
  40. if($_GET['check2'] == 2){$sql .= ", ('$year2','$work2','$rest2','$reason2')";}
  41. if($_GET['check3'] == 3){$sql .= ", ('$year3','$work3','$rest3','$reason3')";}
  42. if($_GET['check4'] == 4){$sql .= ", ('$year4','$work4','$rest4','$reason4')";}
  43. if($_GET['check5'] == 5){$sql .= ", ('$year5','$work5','$rest5','$reason5')";}
  44.  
  45.  
  46. $res = mysql_query($sql) or die(mysql_error());
  47. if($res){
  48. echo "good";
  49. }else{
  50. echo "bad";
  51. }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement