1. Список говнокодов пользователя Alex_Bond

    Всего: 1

  2. PHP / Говнокод #9852

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    if (isset ( $_POST ['atest'] ) && isset ( $_POST ['date_atest'] $_POST ['student'] ) && isset ( $_POST ['point'] ) ) {
    		( int ) $stud_id = $_POST ['student'];
    		( int ) $point = $_POST ['point'];
    		if (strlen ( $_POST ['atest'] ) > 3 && strlen ( $_POST ['date_atest'] ) == 10) {
    			$sql = "insert into `subjects` (`name`,`date`,`courses`,`group`)";
    			$sql .= "values (" . $db->qstr ( $_POST ['atest'] ) . "," . $db->qstr ( $_POST ['date_atest'] ) . "," . $course_input . "," . $group_input . ")";
    			$calc_attestation = "SELECT `users`.`id`, avg (`points`.`point`) attestation FROM `users`, `points`"; 
    			$calc_attestation .= "WHERE `users`.`id` = " . $stud_id . " AND `users`.`id` = `points`.`student`";
    			$result_calc_attestation = mysql_fetch_assoc(mysql_query($calc_attestation));
    			if ($result_calc_attestation['attestation'] >= 0 && $result_calc_attestation['attestation'] <= 0,5) {
    			$result_calc_attestation = 0;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    			if ($result_calc_attestation['attestation'] >= 0,5 && $result_calc_attestation['attestation'] <= 1) {
    			$result_calc_attestation = 1;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    			if ($result_calc_attestation['attestation'] >= 1 && $result_calc_attestation['attestation'] <= 1,5) {
    			$result_calc_attestation = 1;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    			if ($result_calc_attestation['attestation'] >= 1,5 && $result_calc_attestation['attestation'] <= 2) {
    			$result_calc_attestation = 2;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    			if ($result_calc_attestation['attestation'] >= 2 && $result_calc_attestation['attestation'] <= 2,5) {
    			$result_calc_attestation = 2;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    [Код сокращен]
    
    			if ($result_calc_attestation['attestation'] >= 11,5 && $result_calc_attestation['attestation'] <= 12) {
    			$result_calc_attestation = 12;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    			if ($result_calc_attestation['attestation'] == 12) {
    			$result_calc_attestation = 12;
    			$add_attestation = "insert into `points` (`point`, `course`, `student`)";
    			$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
    			}
    			
    			if ($db->Execute ( $sql ) or $db->Execute ( $add_attestation ) === false) {
    				die ( 'Опаньки: ' . $db->ErrorMsg () );
    			}
    			$GLOBALS ['inform'] [] = "Атестація проведена";
    		} else {
    			$GLOBALS ['error'] [] = "Помилка додавання пари через те, що довжина назви менше 3-х символів або дата вказана не вірно.";
    		}
    	}

    Ну и как это использовать? Я уже представил что будет если будет болонская система)

    Alex_Bond, 04 Апреля 2012

    Комментарии (19)