Conditions | 324 |
Total Lines | 1182 |
Code Lines | 718 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
631 | function create_log_entry($section, $section_id, $subsection, $subsection_id, $action, $user_id) { |
||
632 | global $mysqli; |
||
633 | |||
634 | // Everything we do for the GAMES SECTION |
||
635 | if ($section == 'Games') { |
||
636 | if ($subsection == 'Submission') { |
||
637 | // get game id |
||
638 | $query_game_id = "SELECT game_id FROM game_submitinfo WHERE game_submitinfo_id = '$section_id'"; |
||
639 | $result = $mysqli->query($query_game_id) or die("getting game name failed"); |
||
640 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
641 | $section_id = $query_data['game_id']; |
||
642 | $subsection_id = $query_data['game_id']; |
||
643 | } |
||
644 | |||
645 | // get the game name |
||
646 | $query_game = "SELECT game_name FROM game WHERE game_id = '$section_id'"; |
||
647 | $result = $mysqli->query($query_game) or die("getting game name failed"); |
||
648 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
649 | $section_name = $query_data['game_name']; |
||
650 | |||
651 | if ($subsection == 'Game' or $subsection == 'File' or $subsection == 'Screenshot' or $subsection == 'Mag score' |
||
652 | or $subsection == 'Box back' or $subsection == 'Box front' or $subsection == 'Review' |
||
653 | or $subsection == 'Review comment' or $subsection == 'Music' or $subsection == 'Submission' |
||
654 | or $subsection == 'Fact' or $subsection == 'Sound hardware') { |
||
655 | $subsection_name = $section_name; |
||
656 | } |
||
657 | |||
658 | if ($subsection == 'AKA') { |
||
659 | // get the AKA name |
||
660 | $query_aka = "SELECT aka_name FROM game_aka WHERE game_aka_id = '$subsection_id'"; |
||
661 | $result = $mysqli->query($query_aka) or die("getting aka name failed"); |
||
662 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
663 | $subsection_name = $query_data['aka_name']; |
||
664 | $subsection_id = $section_id; |
||
665 | } |
||
666 | |||
667 | if ($subsection == 'Creator') { |
||
668 | if ($action == 'Delete') { |
||
669 | // get the ind name & id |
||
670 | $query_ind = "SELECT individuals.ind_id, |
||
671 | individuals.ind_name FROM individuals |
||
672 | LEFT JOIN game_author ON ( individuals.ind_id = game_author.ind_id ) |
||
673 | WHERE game_author.game_author_id = '$subsection_id'"; |
||
674 | $result = $mysqli->query($query_ind) or die("getting ind name failed"); |
||
675 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
676 | $subsection_name = $query_data['ind_name']; |
||
677 | $subsection_id = $query_data['ind_id']; |
||
678 | } else { |
||
679 | // get the ind name |
||
680 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$subsection_id'"; |
||
681 | $result = $mysqli->query($query_ind) or die("getting ind name failed"); |
||
682 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
683 | $subsection_name = $query_data['ind_name']; |
||
684 | } |
||
685 | } |
||
686 | |||
687 | if ($subsection == 'Publisher' or $subsection == 'Developer') { |
||
688 | // get the pub/dev name |
||
689 | $query_pubdev = "SELECT pub_dev_name FROM pub_dev WHERE pub_dev_id = '$subsection_id'"; |
||
690 | $result = $mysqli->query($query_pubdev) or die("getting pub/dev name failed"); |
||
691 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
692 | $subsection_name = $query_data['pub_dev_name']; |
||
693 | } |
||
694 | |||
695 | if ($subsection == 'Year') { |
||
696 | die("The table game_year has been deprecated and should not be used anymore"); |
||
697 | } |
||
698 | |||
699 | if ($subsection == 'Similar') { |
||
700 | if ($action == 'Delete') { |
||
701 | // get the cross id |
||
702 | $query_cross = "SELECT game_similar_cross FROM game_similar WHERE game_similar_id = '$subsection_id'"; |
||
703 | $result = $mysqli->query($query_cross) or die("getting cross failed"); |
||
704 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
705 | $subsection_id = $query_data['game_similar_cross']; |
||
706 | } |
||
707 | // get the game name |
||
708 | $query_game = "SELECT game_name FROM game WHERE game_id = '$subsection_id'"; |
||
709 | $result = $mysqli->query($query_game) or die("getting game name failed"); |
||
710 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
711 | $subsection_name = $query_data['game_name']; |
||
712 | $subsection_id = $section_id; |
||
713 | } |
||
714 | |||
715 | if ($subsection == 'Comment') { |
||
716 | //get game_id and game_user_comments_id |
||
717 | $query_user_comment = "SELECT game_user_comments.game_id, |
||
718 | game_user_comments.game_user_comments_id, |
||
719 | game.game_name |
||
720 | FROM game_user_comments |
||
721 | LEFT JOIN game ON ( game.game_id = game_user_comments.game_id ) |
||
722 | WHERE game_user_comments.comment_id = '$subsection_id'"; |
||
723 | |||
724 | $result = $mysqli->query($query_user_comment) or die("getting user comments id failed"); |
||
725 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
726 | $subsection_id = $query_data['game_user_comments_id']; |
||
727 | $section_id = $query_data['game_id']; |
||
728 | $section_name = $query_data['game_name']; |
||
729 | $subsection_name = $query_data['game_name']; |
||
730 | } |
||
731 | } |
||
732 | |||
733 | // Everything we do for the GAMES SERIES SECTION |
||
734 | if ($section == 'Game series') { |
||
735 | if ($subsection == 'Game') { |
||
736 | if ($action == 'Delete') { |
||
737 | //get the game_id and game_series_id |
||
738 | $query_series = "SELECT game_id, game_series_id FROM game_series_cross |
||
739 | WHERE game_series_cross_id = '$subsection_id'"; |
||
740 | $result = $mysqli->query($query_series) or die("getting series info failed"); |
||
741 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
742 | $subsection_id = $query_data['game_id']; |
||
743 | $section_id = $query_data['game_series_id']; |
||
744 | } |
||
745 | |||
746 | // get the game name |
||
747 | $query_game = "SELECT game_name FROM game WHERE game_id = '$subsection_id'"; |
||
748 | $result = $mysqli->query($query_game) or die("getting game name failed"); |
||
749 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
750 | $subsection_name = $query_data['game_name']; |
||
751 | } |
||
752 | |||
753 | // get the name of the series |
||
754 | $query_series = "SELECT game_series_name FROM game_series WHERE game_series_id = '$section_id'"; |
||
755 | $result = $mysqli->query($query_series) or die("getting series name failed"); |
||
756 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
757 | $section_name = $query_data['game_series_name']; |
||
758 | |||
759 | if ($subsection == 'Series') { |
||
760 | $subsection_name = $section_name; |
||
761 | } |
||
762 | } |
||
763 | |||
764 | // Everything we do for the Trivia SECTION |
||
765 | if ($section == 'Trivia') { |
||
766 | if ($subsection == 'DYK' or $subsection == 'Quote' or $subsection == 'Spotlight') { |
||
767 | $subsection_name = ("Trivia ID " . $subsection_id); |
||
768 | $section_name = ("Trivia ID " . $subsection_id); |
||
769 | } |
||
770 | } |
||
771 | |||
772 | // Everything we do for the LINKS section |
||
773 | if ($section == 'Links') { |
||
774 | // Get the website name |
||
775 | $query_website = "SELECT website_name FROM website WHERE website_id = '$section_id'"; |
||
776 | $result = $mysqli->query($query_website) or die("getting website name failed"); |
||
777 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
778 | $section_name = $query_data['website_name']; |
||
779 | |||
780 | if ($subsection == 'Link') { |
||
781 | $subsection_name = $section_name; |
||
782 | } |
||
783 | |||
784 | if ($subsection == 'Category') { |
||
785 | // Get the category name |
||
786 | $query_cat = "SELECT website_category_name FROM website_category |
||
787 | WHERE website_category_id = '$subsection_id'"; |
||
788 | $result = $mysqli->query($query_cat) or die("getting category name failed"); |
||
789 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
790 | $subsection_name = $query_data['website_category_name']; |
||
791 | } |
||
792 | |||
793 | if ($subsection == 'Link submit') { |
||
794 | // Get the submitted link |
||
795 | $query_link = "SELECT website_name FROM website_validate WHERE website_id = $subsection_id"; |
||
796 | $result = $mysqli->query($query_link) or die("getting submitted link name failed: ".$mysqli->error); |
||
797 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
798 | $section_name = $query_data['website_name']; |
||
799 | $subsection_name = $query_data['website_name']; |
||
800 | } |
||
801 | } |
||
802 | |||
803 | // Everything we do for the LINKS CATEGORY section |
||
804 | if ($section == 'Links cat') { |
||
805 | // Get the category name |
||
806 | $query_cat = "SELECT website_category_name FROM website_category WHERE website_category_id = '$section_id'"; |
||
807 | $result = $mysqli->query($query_cat) or die("getting category name failed"); |
||
808 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
809 | $section_name = $query_data['website_category_name']; |
||
810 | |||
811 | if ($subsection == 'Category') { |
||
812 | $subsection_name = $section_name; |
||
813 | } |
||
814 | } |
||
815 | |||
816 | // Everything we do for the COMPANY section |
||
817 | if ($section == 'Company') { |
||
818 | // Get the company name |
||
819 | $query_comp = "SELECT pub_dev_name FROM pub_dev WHERE pub_dev_id = '$section_id'"; |
||
820 | $result = $mysqli->query($query_comp) or die("getting comp name failed"); |
||
821 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
822 | $section_name = $query_data['pub_dev_name']; |
||
823 | |||
824 | if ($subsection == 'Company' or $subsection == 'Logo') { |
||
825 | $subsection_name = $section_name; |
||
826 | } |
||
827 | } |
||
828 | |||
829 | // Everything we do for the Individual section |
||
830 | if ($section == 'Individuals') { |
||
831 | if ($subsection == 'Nickname') { |
||
832 | if ($action == 'Delete') { |
||
833 | // we need to get the ind id |
||
834 | $query_ind = "SELECT ind_id FROM individual_nicks WHERE nick_id = '$section_id'"; |
||
835 | $result = $mysqli->query($query_ind) or die("getting individual id failed"); |
||
836 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
837 | $section_id = $query_data['ind_id']; |
||
838 | $subsection_id = $query_data['ind_id']; |
||
839 | } |
||
840 | } |
||
841 | |||
842 | // Get the individual name |
||
843 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$section_id'"; |
||
844 | $result = $mysqli->query($query_ind) or die("getting individual name failed"); |
||
845 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
846 | $section_name = $query_data['ind_name']; |
||
847 | |||
848 | if ($subsection == 'Individual' or $subsection == 'Image' or $subsection == 'Nickname') { |
||
849 | $subsection_name = $section_name; |
||
850 | } |
||
851 | } |
||
852 | |||
853 | // Everything we do for the AUTHor TYPE section |
||
854 | if ($section == 'Author type') { |
||
855 | // get the author type name |
||
856 | $query_author = "SELECT author_type_info FROM author_type WHERE author_type_id = '$section_id'"; |
||
857 | $result = $mysqli->query($query_author) or die("getting author type name failed"); |
||
858 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
859 | $section_name = $query_data['author_type_info']; |
||
860 | |||
861 | if ($subsection == 'Author type') { |
||
862 | $subsection_name = $section_name; |
||
863 | } |
||
864 | } |
||
865 | |||
866 | // Everything we do for the INTERVIEW section |
||
867 | if ($section == 'Interviews') { |
||
868 | if ($subsection == 'Interview') { |
||
869 | if ($action == 'Update' or $action == 'Delete') { |
||
870 | //we need to get the individual id |
||
871 | $query_ind = "SELECT ind_id FROM interview_main WHERE interview_id = '$section_id'"; |
||
872 | $result = $mysqli->query($query_ind) or die("getting ind id failed"); |
||
873 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
874 | $section_id = $query_data['ind_id']; |
||
875 | } |
||
876 | } |
||
877 | |||
878 | if ($subsection == 'Screenshots') { |
||
879 | if ($action == 'Insert' or $action == 'Delete') { |
||
880 | //we need to get the individual id |
||
881 | $query_ind = "SELECT ind_id FROM interview_main WHERE interview_id = '$section_id'"; |
||
882 | $result = $mysqli->query($query_ind) or die("getting ind id failed"); |
||
883 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
884 | $section_id = $query_data['ind_id']; |
||
885 | } |
||
886 | } |
||
887 | |||
888 | // get the name of the person that is interviewed |
||
889 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$section_id'"; |
||
890 | $result = $mysqli->query($query_ind) or die("getting ind name failed"); |
||
891 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
892 | $section_name = $query_data['ind_name']; |
||
893 | |||
894 | if ($subsection == 'Interview' or $subsection == 'Screenshots') { |
||
895 | $subsection_name = $section_name; |
||
896 | } |
||
897 | |||
898 | if ($subsection == 'Comment') { |
||
899 | //get game_id and interview_user_comments_id |
||
900 | $query_user_comment = "SELECT interview_user_comments.interview_id, |
||
901 | interview_user_comments.interview_user_comments_id, |
||
902 | individuals.ind_name |
||
903 | FROM interview_user_comments |
||
904 | LEFT JOIN interview_main ON ( interview_user_comments.interview_id = interview_main.interview_id ) |
||
905 | LEFT JOIN individuals on (interview_main.ind_id = individuals.ind_id) |
||
906 | WHERE interview_user_comments.comment_id = '$subsection_id'"; |
||
907 | |||
908 | $result = $mysqli->query($query_user_comment) or die("getting user comments id failed"); |
||
909 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
910 | $subsection_id = $query_data['interview_user_comments_id']; |
||
911 | $section_id = $query_data['interview_id']; |
||
912 | $section_name = $query_data['ind_name']; |
||
913 | $subsection_name = $query_data['ind_name']; |
||
914 | } |
||
915 | } |
||
916 | |||
917 | // Everything we do for the Review section |
||
918 | if ($section == 'Reviews') { |
||
919 | if ($subsection == 'Comment') { |
||
920 | //get the game name |
||
921 | $query_user_comment = "SELECT * FROM review_user_comments |
||
922 | LEFT JOIN review_main ON (review_user_comments.review_id = review_main.review_id) |
||
923 | LEFT JOIN review_game ON (review_main.review_id = review_game.review_id) |
||
924 | LEFT JOIN game ON (game.game_id = review_game.game_id) |
||
925 | WHERE review_user_comments.comment_id = '$subsection_id'"; |
||
926 | |||
927 | $result = $mysqli->query($query_user_comment) or die("getting user comments id failed"); |
||
928 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
929 | $subsection_id = $query_data['review_user_comments_id']; |
||
930 | $section_id = $query_data['review_id']; |
||
931 | $section_name = $query_data['game_name']; |
||
932 | $subsection_name = $query_data['game_name']; |
||
933 | } |
||
934 | } |
||
935 | |||
936 | // Everything we do for the AUTHor TYPE section |
||
937 | if ($section == 'News') { |
||
938 | if ($subsection == 'News submit') { |
||
939 | // get the headline |
||
940 | $query_news = "SELECT news_headline FROM news_submission WHERE news_submission_id = '$section_id'"; |
||
941 | $result = $mysqli->query($query_news) or die("getting headline failed"); |
||
942 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
943 | $section_name = $query_data['news_headline']; |
||
944 | |||
945 | $subsection_name = $section_name; |
||
946 | } |
||
947 | |||
948 | if ($subsection == 'News item') { |
||
949 | // get the headline |
||
950 | $query_news = "SELECT news_headline FROM news WHERE news_id = '$section_id'"; |
||
951 | $result = $mysqli->query($query_news) or die("getting headline failed"); |
||
952 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
953 | $section_name = $query_data['news_headline']; |
||
954 | |||
955 | $subsection_name = $section_name; |
||
956 | } |
||
957 | |||
958 | if ($subsection == 'Image') { |
||
959 | // get the image name |
||
960 | $query_image = "SELECT news_image_name FROM news_image WHERE news_image_id = '$section_id'"; |
||
961 | $result = $mysqli->query($query_image) or die("getting image name failed"); |
||
962 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
963 | $section_name = $query_data['news_image_name']; |
||
964 | |||
965 | $subsection_name = $section_name; |
||
966 | } |
||
967 | } |
||
968 | |||
969 | // Everything we do for the Menu Set SECTION |
||
970 | if ($section == 'Menu set') { |
||
971 | // get the menu set name |
||
972 | $query_menu_Set = "SELECT menu_sets_name FROM menu_set WHERE menu_sets_id = '$section_id'"; |
||
973 | $result = $mysqli->query($query_menu_Set) or die("getting menu set name failed"); |
||
974 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
975 | $section_name = $query_data['menu_sets_name']; |
||
976 | |||
977 | if ($subsection == 'Menu set' or $subsection == 'Menu disk (multiple)') { |
||
978 | $subsection_name = $section_name; |
||
979 | } |
||
980 | |||
981 | if ($subsection == 'Crew') { |
||
982 | // get the name of the crew |
||
983 | $query_crew = "SELECT crew_name FROM crew WHERE crew_id = '$subsection_id'"; |
||
984 | $result = $mysqli->query($query_crew) or die("getting crew name failed"); |
||
985 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
986 | $subsection_name = $query_data['crew_name']; |
||
987 | } |
||
988 | |||
989 | if ($subsection == 'Individual') { |
||
990 | // get the name of the crew |
||
991 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$subsection_id'"; |
||
992 | $result = $mysqli->query($query_ind) or die("getting individual name failed"); |
||
993 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
994 | $subsection_name = $query_data['ind_name']; |
||
995 | } |
||
996 | |||
997 | if ($subsection == 'Menu type') { |
||
998 | // get the name of the menu type |
||
999 | $query_menu_type = "SELECT menu_types_text FROM menu_types_main |
||
1000 | WHERE menu_types_main_id = '$subsection_id'"; |
||
1001 | $result = $mysqli->query($query_menu_type) or die("getting menu type name failed"); |
||
1002 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1003 | $subsection_name = $query_data['menu_types_text']; |
||
1004 | } |
||
1005 | |||
1006 | if ($subsection == 'Menu disk') { |
||
1007 | // get the name of the menu disk |
||
1008 | $sql_menus = "SELECT menu_disk.menu_sets_id, |
||
1009 | menu_set.menu_sets_name, |
||
1010 | menu_disk.menu_disk_number, |
||
1011 | menu_disk.menu_disk_letter, |
||
1012 | menu_disk.menu_disk_version, |
||
1013 | menu_disk.menu_disk_part |
||
1014 | FROM menu_disk |
||
1015 | LEFT JOIN menu_set ON (menu_disk.menu_sets_id = menu_set.menu_sets_id) |
||
1016 | WHERE menu_disk.menu_disk_id = '$subsection_id'"; |
||
1017 | |||
1018 | $result_menus = $mysqli->query($sql_menus) or die("error in query disk name"); |
||
1019 | |||
1020 | while ($row = $result_menus->fetch_array(MYSQLI_BOTH)) { |
||
1021 | // Create Menu disk name |
||
1022 | $menu_disk_name = "$row[menu_sets_name] "; |
||
1023 | if (isset($row['menu_disk_number'])) { |
||
1024 | $menu_disk_name .= "$row[menu_disk_number]"; |
||
1025 | } |
||
1026 | if (isset($row['menu_disk_letter'])) { |
||
1027 | $menu_disk_name .= "$row[menu_disk_letter]"; |
||
1028 | } |
||
1029 | if (isset($row['menu_disk_part'])) { |
||
1030 | if (is_numeric($row['menu_disk_part'])) { |
||
1031 | $menu_disk_name .= " part $row[menu_disk_part]"; |
||
1032 | } else { |
||
1033 | $menu_disk_name .= "$row[menu_disk_part]"; |
||
1034 | } |
||
1035 | } |
||
1036 | } |
||
1037 | $subsection_name = $menu_disk_name; |
||
1038 | } |
||
1039 | } |
||
1040 | |||
1041 | // Everything we do for the CREW SECTION |
||
1042 | if ($section == 'Crew') { |
||
1043 | // get the name of the crew |
||
1044 | $query_crew = "SELECT crew_name FROM crew WHERE crew_id = '$section_id'"; |
||
1045 | $result = $mysqli->query($query_crew) or die("getting crew name failed"); |
||
1046 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1047 | $section_name = $query_data['crew_name']; |
||
1048 | |||
1049 | if ($subsection == 'Crew' or $subsection == 'Logo') { |
||
1050 | $subsection_name = $section_name; |
||
1051 | } |
||
1052 | |||
1053 | if ($subsection == 'Subcrew') { |
||
1054 | if ($action == 'Delete') { |
||
1055 | // get the id's |
||
1056 | $query_crew = "SELECT * FROM sub_crew WHERE sub_crew_id = '$subsection_id'"; |
||
1057 | $result = $mysqli->query($query_crew) or die("getting crew ids failed"); |
||
1058 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1059 | $subsection_id = $query_data['crew_id']; |
||
1060 | $section_id = $query_data['parent_id']; |
||
1061 | |||
1062 | // get the name of the crew |
||
1063 | $query_crew = "SELECT crew_name FROM crew WHERE crew_id = '$section_id'"; |
||
1064 | $result = $mysqli->query($query_crew) or die("getting crew name failed"); |
||
1065 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1066 | $section_name = $query_data['crew_name']; |
||
1067 | } |
||
1068 | |||
1069 | // get the name of the subcrew |
||
1070 | $query_crew = "SELECT crew_name FROM crew WHERE crew_id = '$subsection_id'"; |
||
1071 | $result = $mysqli->query($query_crew) or die("getting crew name failed"); |
||
1072 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1073 | $subsection_name = $query_data['crew_name']; |
||
1074 | } |
||
1075 | |||
1076 | if ($subsection == 'Member') { |
||
1077 | if ($action == 'Delete') { |
||
1078 | // get the id's |
||
1079 | $query_crew = "SELECT * FROM crew_individual WHERE crew_individual_id = '$subsection_id'"; |
||
1080 | $result = $mysqli->query($query_crew) or die("getting crew ids failed"); |
||
1081 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1082 | $subsection_id = $query_data['ind_id']; |
||
1083 | $section_id = $query_data['crew_id']; |
||
1084 | |||
1085 | // get the name of the crew |
||
1086 | $query_crew = "SELECT crew_name FROM crew WHERE crew_id = '$section_id'"; |
||
1087 | $result = $mysqli->query($query_crew) or die("getting crew name failed"); |
||
1088 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1089 | $section_name = $query_data['crew_name']; |
||
1090 | } |
||
1091 | |||
1092 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$subsection_id'"; |
||
1093 | $result = $mysqli->query($query_ind) or die("getting ind name failed"); |
||
1094 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1095 | $subsection_name = $query_data['ind_name']; |
||
1096 | } |
||
1097 | |||
1098 | if ($subsection == 'Nickname') { |
||
1099 | // get the id's |
||
1100 | $query_crew = "SELECT * FROM crew_individual WHERE crew_individual_id = '$subsection_id'"; |
||
1101 | $result = $mysqli->query($query_crew) or die("getting crew ids failed"); |
||
1102 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1103 | $subsection_id = $query_data['ind_id']; |
||
1104 | $section_id = $query_data['crew_id']; |
||
1105 | |||
1106 | // get the name of the crew |
||
1107 | $query_crew = "SELECT crew_name FROM crew WHERE crew_id = '$section_id'"; |
||
1108 | $result = $mysqli->query($query_crew) or die("getting crew name failed"); |
||
1109 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1110 | $section_name = $query_data['crew_name']; |
||
1111 | |||
1112 | // get the name of the member |
||
1113 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$subsection_id'"; |
||
1114 | $result = $mysqli->query($query_ind) or die("getting ind name failed"); |
||
1115 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1116 | $subsection_name = $query_data['ind_name']; |
||
1117 | } |
||
1118 | } |
||
1119 | |||
1120 | // Everything we do for the MENU TYPE SECTION |
||
1121 | if ($section == 'Menu type') { |
||
1122 | // get the name of the menu type |
||
1123 | $query_menu_type = "SELECT menu_types_text FROM menu_types_main WHERE menu_types_main_id = '$section_id'"; |
||
1124 | $result = $mysqli->query($query_menu_type) or die("getting menu type name failed"); |
||
1125 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1126 | $section_name = $query_data['menu_types_text']; |
||
1127 | |||
1128 | if ($subsection == 'Menu type') { |
||
1129 | $subsection_name = $section_name; |
||
1130 | } |
||
1131 | } |
||
1132 | |||
1133 | // Everything we do for the MENU DISK |
||
1134 | if ($section == 'Menu disk') { |
||
1135 | // get the name of the menu disk |
||
1136 | $sql_menus = "SELECT menu_disk.menu_sets_id, |
||
1137 | menu_set.menu_sets_name, |
||
1138 | menu_disk.menu_disk_number, |
||
1139 | menu_disk.menu_disk_letter, |
||
1140 | menu_disk.menu_disk_version, |
||
1141 | menu_disk.menu_disk_part |
||
1142 | FROM menu_disk |
||
1143 | LEFT JOIN menu_set ON (menu_disk.menu_sets_id = menu_set.menu_sets_id) |
||
1144 | WHERE menu_disk.menu_disk_id = '$section_id'"; |
||
1145 | |||
1146 | $result_menus = $mysqli->query($sql_menus) or die("error in query disk name"); |
||
1147 | |||
1148 | while ($row = $result_menus->fetch_array(MYSQLI_BOTH)) { |
||
1149 | $section_id = $row['menu_sets_id']; |
||
1150 | |||
1151 | // Create Menu disk name |
||
1152 | $menu_disk_name = "$row[menu_sets_name] "; |
||
1153 | if (isset($row['menu_disk_number'])) { |
||
1154 | $menu_disk_name .= "$row[menu_disk_number]"; |
||
1155 | } |
||
1156 | if (isset($row['menu_disk_letter'])) { |
||
1157 | $menu_disk_name .= "$row[menu_disk_letter]"; |
||
1158 | } |
||
1159 | if (isset($row['menu_disk_part'])) { |
||
1160 | if (is_numeric($row['menu_disk_part'])) { |
||
1161 | $menu_disk_name .= " part $row[menu_disk_part]"; |
||
1162 | } else { |
||
1163 | $menu_disk_name .= "$row[menu_disk_part]"; |
||
1164 | } |
||
1165 | } |
||
1166 | } |
||
1167 | |||
1168 | $section_name = $menu_disk_name; |
||
1169 | |||
1170 | if ($subsection == 'State') { |
||
1171 | // get the name of the menu type |
||
1172 | $query_menu_state = "SELECT menu_state FROM menu_disk_state WHERE state_id = '$subsection_id'"; |
||
1173 | $result = $mysqli->query($query_menu_state) or die("getting menu state name failed"); |
||
1174 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1175 | $subsection_name = $query_data['menu_state']; |
||
1176 | } |
||
1177 | |||
1178 | if ($subsection == 'Parent') { |
||
1179 | // get the name of the parent |
||
1180 | $sql_menus = "SELECT menu_disk.menu_sets_id, |
||
1181 | menu_set.menu_sets_name, |
||
1182 | menu_disk.menu_disk_number, |
||
1183 | menu_disk.menu_disk_letter, |
||
1184 | menu_disk.menu_disk_version, |
||
1185 | menu_disk.menu_disk_part |
||
1186 | FROM menu_disk |
||
1187 | LEFT JOIN menu_set ON (menu_disk.menu_sets_id = menu_set.menu_sets_id) |
||
1188 | WHERE menu_disk.menu_disk_id = '$subsection_id'"; |
||
1189 | |||
1190 | $result_menus = $mysqli->query($sql_menus) or die("error in query disk name"); |
||
1191 | |||
1192 | while ($row = $result_menus->fetch_array(MYSQLI_BOTH)) { |
||
1193 | // Create Menu disk name |
||
1194 | $menu_disk_name = "$row[menu_sets_name] "; |
||
1195 | if (isset($row['menu_disk_number'])) { |
||
1196 | $menu_disk_name .= "$row[menu_disk_number]"; |
||
1197 | } |
||
1198 | if (isset($row['menu_disk_letter'])) { |
||
1199 | $menu_disk_name .= "$row[menu_disk_letter]"; |
||
1200 | } |
||
1201 | if (isset($row['menu_disk_part'])) { |
||
1202 | if (is_numeric($row['menu_disk_part'])) { |
||
1203 | $menu_disk_name .= " part $row[menu_disk_part]"; |
||
1204 | } else { |
||
1205 | $menu_disk_name .= "$row[menu_disk_part]"; |
||
1206 | } |
||
1207 | } |
||
1208 | } |
||
1209 | $subsection_name = $menu_disk_name; |
||
1210 | } |
||
1211 | |||
1212 | if ($subsection == 'Year') { |
||
1213 | $subsection_name = $subsection_id; |
||
1214 | } |
||
1215 | |||
1216 | if ($subsection == 'Menu disk' or $subsection == 'Screenshots' or $subsection == 'File') { |
||
1217 | $subsection_name = $section_name; |
||
1218 | } |
||
1219 | |||
1220 | if ($subsection == 'Credits') { |
||
1221 | if ($action == 'Delete') { |
||
1222 | //get the ind id |
||
1223 | $query_ind = "SELECT ind_id FROM menu_disk_credits WHERE menu_disk_credits_id = '$subsection_id'"; |
||
1224 | $result = $mysqli->query($query_ind) or die("getting individual name failed"); |
||
1225 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1226 | $subsection_id = $query_data['ind_id']; |
||
1227 | } |
||
1228 | |||
1229 | // get the name of the individual |
||
1230 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$subsection_id'"; |
||
1231 | $result = $mysqli->query($query_ind) or die("getting individual name failed"); |
||
1232 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1233 | $subsection_name = $query_data['ind_name']; |
||
1234 | } |
||
1235 | |||
1236 | if ($subsection == 'Nickname') { |
||
1237 | // get the individual id |
||
1238 | $query_ind = "SELECT ind_id FROM menu_disk_credits WHERE individual_nicks_id = '$subsection_id'"; |
||
1239 | $result = $mysqli->query($query_ind) or die("getting individual name failed"); |
||
1240 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1241 | $ind_id = $query_data['ind_id']; |
||
1242 | |||
1243 | //now get the individual name |
||
1244 | $query_ind = "SELECT ind_name FROM individuals WHERE ind_id = '$ind_id'"; |
||
1245 | $result = $mysqli->query($query_ind) or die("getting individual name failed"); |
||
1246 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1247 | $subsection_name = $query_data['ind_name']; |
||
1248 | } |
||
1249 | |||
1250 | if ($subsection == 'Game' or $subsection == 'Game doc') { |
||
1251 | // get the game name |
||
1252 | $query_game = "SELECT game_name FROM game WHERE game_id = '$subsection_id'"; |
||
1253 | $result = $mysqli->query($query_game) or die("getting game name failed"); |
||
1254 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1255 | $subsection_name = $query_data['game_name']; |
||
1256 | } |
||
1257 | |||
1258 | if ($subsection == 'Demo') { |
||
1259 | // get the demo name |
||
1260 | $query_demo = "SELECT demo_name FROM demo WHERE demo_id = '$subsection_id'"; |
||
1261 | $result = $mysqli->query($query_demo) or die("getting demo name failed"); |
||
1262 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1263 | $subsection_name = $query_data['demo_name']; |
||
1264 | } |
||
1265 | |||
1266 | if ($subsection == 'Tool' or $subsection == 'Tool doc') { |
||
1267 | // get the tool name |
||
1268 | $query_tool = "SELECT tools_name FROM tools WHERE tools_id = '$subsection_id'"; |
||
1269 | $result = $mysqli->query($query_tool) or die("getting tool name failed"); |
||
1270 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1271 | $subsection_name = $query_data['tools_name']; |
||
1272 | } |
||
1273 | |||
1274 | if ($subsection == 'Doc type') { |
||
1275 | // get the name of the doc type |
||
1276 | $query_doc_type = "SELECT doc_type_name FROM doc_type WHERE doc_type_id = '$subsection_id'"; |
||
1277 | $result = $mysqli->query($query_doc_type) or die("getting doc type name failed"); |
||
1278 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1279 | $subsection_name = $query_data['doc_type_name']; |
||
1280 | } |
||
1281 | |||
1282 | if ($subsection == 'Software' or $subsection == 'Chain' or $subsection == 'Doc' or $subsection == 'Authors') { |
||
1283 | //get the type of software |
||
1284 | $query_soft = "SELECT menu_types_main_id FROM menu_disk_title WHERE menu_disk_title_id = '$subsection_id'"; |
||
1285 | $result = $mysqli->query($query_soft) or die("getting menu_type failed"); |
||
1286 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1287 | $type = $query_data['menu_types_main_id']; |
||
1288 | |||
1289 | //get the name of the software |
||
1290 | if ($type == '1') { |
||
1291 | //get the id of the game |
||
1292 | $query_game = "SELECT game_id FROM menu_disk_title_game WHERE menu_disk_title_id = '$subsection_id'"; |
||
1293 | $result = $mysqli->query($query_game) or die("getting game id failed"); |
||
1294 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1295 | $subsection_id = $query_data['game_id']; |
||
1296 | |||
1297 | // get the game name |
||
1298 | $query_game = "SELECT game_name FROM game WHERE game_id = '$subsection_id'"; |
||
1299 | $result = $mysqli->query($query_game) or die("getting game name failed"); |
||
1300 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1301 | $subsection_name = $query_data['game_name']; |
||
1302 | |||
1303 | if ($subsection != 'Chain' and $subsection != 'Authors') { |
||
1304 | $subsection = 'Game'; |
||
1305 | } |
||
1306 | } |
||
1307 | |||
1308 | if ($type == '2') { |
||
1309 | //get the id of the demo |
||
1310 | $query_demo = "SELECT demo_id FROM menu_disk_title_demo WHERE menu_disk_title_id = '$subsection_id'"; |
||
1311 | $result = $mysqli->query($query_demo) or die("getting demo id failed"); |
||
1312 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1313 | $subsection_id = $query_data['demo_id']; |
||
1314 | |||
1315 | // get the demo name |
||
1316 | $query_demo = "SELECT demo_name FROM demo WHERE demo_id = '$subsection_id'"; |
||
1317 | $result = $mysqli->query($query_demo) or die("getting demo name failed"); |
||
1318 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1319 | $subsection_name = $query_data['demo_name']; |
||
1320 | if ($subsection != 'Chain' and $subsection != 'Authors') { |
||
1321 | $subsection = 'Demo'; |
||
1322 | } |
||
1323 | } |
||
1324 | |||
1325 | if ($type == '3') { |
||
1326 | //get the id of the tool |
||
1327 | $query_tool = "SELECT tools_id FROM menu_disk_title_tools WHERE menu_disk_title_id = '$subsection_id'"; |
||
1328 | $result = $mysqli->query($query_tool) or die("getting toold id failed"); |
||
1329 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1330 | $subsection_id = $query_data['tools_id']; |
||
1331 | |||
1332 | // get the tool name |
||
1333 | $query_tool = "SELECT tools_name FROM tools WHERE tools_id = '$subsection_id'"; |
||
1334 | $result = $mysqli->query($query_tool) or die("getting tool name failed"); |
||
1335 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1336 | $subsection_name = $query_data['tools_name']; |
||
1337 | if ($subsection != 'Chain' and $subsection != 'Authors') { |
||
1338 | $subsection = 'Tool'; |
||
1339 | } |
||
1340 | } |
||
1341 | |||
1342 | if ($type == '6') { |
||
1343 | //get the doc cross id |
||
1344 | $query_game_doc = "SELECT doc_games_id FROM menu_disk_title_doc_games |
||
1345 | WHERE menu_disk_title_id = '$subsection_id'"; |
||
1346 | $result = $mysqli->query($query_game_doc) or die("getting doc_game_id failed"); |
||
1347 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1348 | $subsection_id = $query_data['doc_games_id']; |
||
1349 | |||
1350 | // get the game id |
||
1351 | $query_game_id = "SELECT game_id FROM doc_disk_game WHERE doc_disk_game_id = '$subsection_id'"; |
||
1352 | $result = $mysqli->query($query_game_id) or die("getting game id failed"); |
||
1353 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1354 | $subsection_id = $query_data['game_id']; |
||
1355 | |||
1356 | // get the game name |
||
1357 | $query_game = "SELECT game_name FROM game WHERE game_id = '$subsection_id'"; |
||
1358 | $result = $mysqli->query($query_game) or die("getting game name failed"); |
||
1359 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1360 | $subsection_name = $query_data['game_name']; |
||
1361 | |||
1362 | if ($subsection == 'Authors') { |
||
1363 | } else { |
||
1364 | $subsection = 'Game doc'; |
||
1365 | } |
||
1366 | |||
1367 | if ($subsection_name == '') { |
||
1368 | //get the doc cross id |
||
1369 | $query_tool_doc = "SELECT doc_tools_id FROM menu_disk_title_doc_tools |
||
1370 | WHERE menu_disk_title_id = '$subsection_id'"; |
||
1371 | $result = $mysqli->query($query_tool_doc) or die("getting doc_tools_id failed"); |
||
1372 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1373 | $subsection_id = $query_data['doc_tools_id']; |
||
1374 | |||
1375 | //get the id of the tool |
||
1376 | $query_tool = "SELECT tools_id FROM menu_disk_title_tools |
||
1377 | WHERE menu_disk_title_id = '$subsection_id'"; |
||
1378 | $result = $mysqli->query($query_tool) or die("getting toold id failed"); |
||
1379 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1380 | $subsection_id = $query_data['tools_id']; |
||
1381 | |||
1382 | // get the tool name |
||
1383 | $query_tool = "SELECT tools_name FROM tools WHERE tools_id = '$subsection_id'"; |
||
1384 | $result = $mysqli->query($query_tool) or die("getting tool name failed"); |
||
1385 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1386 | $subsection_name = $query_data['tools_name']; |
||
1387 | |||
1388 | if ($subsection == 'Authors') { |
||
1389 | } else { |
||
1390 | $subsection = 'Tool doc'; |
||
1391 | } |
||
1392 | } |
||
1393 | } |
||
1394 | } |
||
1395 | } |
||
1396 | |||
1397 | // Everything we do for the Articles section |
||
1398 | if ($section == 'Articles') { |
||
1399 | if ($subsection == 'Article') { |
||
1400 | if ($action == 'Update' or $action == 'Delete' or $action == 'Insert') { |
||
1401 | //we need to get the title |
||
1402 | $query_title = "SELECT article_title FROM article_text WHERE article_id = '$section_id'"; |
||
1403 | $result = $mysqli->query($query_title) or die("getting title failed"); |
||
1404 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1405 | $section_name = $query_data['article_title']; |
||
1406 | } |
||
1407 | } |
||
1408 | |||
1409 | if ($subsection == 'Screenshots') { |
||
1410 | if ($action == 'Insert' or $action == 'Delete') { |
||
1411 | //we need to get the title |
||
1412 | $query_title = "SELECT article_title FROM article_text WHERE article_id = '$section_id'"; |
||
1413 | $result = $mysqli->query($query_title) or die("getting title failed"); |
||
1414 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1415 | $section_name = $query_data['article_title']; |
||
1416 | } |
||
1417 | } |
||
1418 | |||
1419 | if ($subsection == 'Article' or $subsection == 'Screenshots') { |
||
1420 | $subsection_name = $section_name; |
||
1421 | } |
||
1422 | |||
1423 | if ($subsection == 'Comment') { |
||
1424 | //we need to get the title |
||
1425 | $query_user_comment = "SELECT article_user_comments.article_id, |
||
1426 | article_user_comments.article_user_comments_id, |
||
1427 | article_text.article_title |
||
1428 | FROM article_user_comments |
||
1429 | LEFT JOIN article_main ON ( article_user_comments.article_id = article_main.article_id ) |
||
1430 | LEFT JOIN article_text on ( article_main.article_id = article_text.article_id ) |
||
1431 | WHERE article_user_comments.comments_id = '$subsection_id'"; |
||
1432 | |||
1433 | $result = $mysqli->query($query_user_comment) or die("getting user comments id failed"); |
||
1434 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1435 | $section_id = $query_data['article_id']; |
||
1436 | $section_name = $query_data['article_title']; |
||
1437 | $subsection_name = $section_name; |
||
1438 | } |
||
1439 | } |
||
1440 | |||
1441 | // Everything we do for the ARTICLE TYPE SECTION |
||
1442 | if ($section == 'Article type') { |
||
1443 | // get the name of the article type |
||
1444 | $query_article_type = "SELECT article_type FROM article_type WHERE article_type_id = '$section_id'"; |
||
1445 | $result = $mysqli->query($query_article_type) or die("getting article type name failed"); |
||
1446 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1447 | $section_name = $query_data['article_type']; |
||
1448 | |||
1449 | if ($subsection == 'Article type') { |
||
1450 | $subsection_name = $section_name; |
||
1451 | } |
||
1452 | } |
||
1453 | |||
1454 | // Everything we do for the DOC TYPE SECTION |
||
1455 | if ($section == 'Doc type') { |
||
1456 | // get the name of the doc type |
||
1457 | $query_doc_type = "SELECT doc_type_name FROM doc_type WHERE doc_type_id = '$section_id'"; |
||
1458 | $result = $mysqli->query($query_doc_type) or die("getting doc type name failed"); |
||
1459 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1460 | $section_name = $query_data['doc_type_name']; |
||
1461 | |||
1462 | if ($subsection == 'Doc type') { |
||
1463 | $subsection_name = $section_name; |
||
1464 | } |
||
1465 | } |
||
1466 | |||
1467 | // Everything we do for the DOC CATEGORY SECTION |
||
1468 | if ($section == 'Doc category') { |
||
1469 | // get the name of the doc type |
||
1470 | $query_category_type = "SELECT doc_category_name FROM doc_category WHERE doc_category_id = '$section_id'"; |
||
1471 | $result = $mysqli->query($query_category_type) or die("getting doc category name failed"); |
||
1472 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1473 | $section_name = $query_data['doc_category_name']; |
||
1474 | |||
1475 | if ($subsection == 'Doc category') { |
||
1476 | $subsection_name = $section_name; |
||
1477 | } |
||
1478 | } |
||
1479 | |||
1480 | // Everything we do for the DOWNLOAD FORMAT SECTION |
||
1481 | if ($section == 'Format') { |
||
1482 | // get the name of the format |
||
1483 | $query_format = "SELECT format FROM format WHERE format_id = '$section_id'"; |
||
1484 | $result = $mysqli->query($query_format) or die("getting format name failed"); |
||
1485 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1486 | $section_name = $query_data['format']; |
||
1487 | |||
1488 | if ($subsection == 'Format') { |
||
1489 | $subsection_name = $section_name; |
||
1490 | } |
||
1491 | } |
||
1492 | |||
1493 | // Everything we do for the DOWNLOAD LINGO SECTION |
||
1494 | if ($section == 'Lingo') { |
||
1495 | // get the name of the lingo |
||
1496 | $query_lingo = "SELECT lingo_name FROM lingo WHERE lingo_id = '$section_id'"; |
||
1497 | $result = $mysqli->query($query_lingo) or die("getting lingo name failed"); |
||
1498 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1499 | $section_name = $query_data['lingo_name']; |
||
1500 | |||
1501 | if ($subsection == 'Lingo') { |
||
1502 | $subsection_name = $section_name; |
||
1503 | } |
||
1504 | } |
||
1505 | |||
1506 | // Everything we do for the DOWNLOAD OPTION SECTION |
||
1507 | if ($section == 'Option') { |
||
1508 | // get the name of the lingo |
||
1509 | $query_option = "SELECT download_option FROM download_options WHERE download_options_id = '$section_id'"; |
||
1510 | $result = $mysqli->query($query_option) or die("getting option name failed"); |
||
1511 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1512 | $section_name = $query_data['download_option']; |
||
1513 | |||
1514 | if ($subsection == 'Option') { |
||
1515 | $subsection_name = $section_name; |
||
1516 | } |
||
1517 | } |
||
1518 | |||
1519 | // Everything we do for the TOS VERSION SECTION |
||
1520 | if ($section == 'TOS') { |
||
1521 | // get the name of the lingo |
||
1522 | $query_tos = "SELECT tos_version FROM tos_version WHERE tos_version_id = '$section_id'"; |
||
1523 | $result = $mysqli->query($query_tos) or die("getting tos name failed"); |
||
1524 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1525 | $section_name = $query_data['tos_version']; |
||
1526 | |||
1527 | if ($subsection == 'TOS') { |
||
1528 | $subsection_name = $section_name; |
||
1529 | } |
||
1530 | } |
||
1531 | |||
1532 | // Everything we do for the TRAINER SECTION |
||
1533 | if ($section == 'Trainer') { |
||
1534 | // get the name of the trainer option |
||
1535 | $query_trainer = "SELECT trainer_options FROM trainer_options WHERE trainer_options_id = '$section_id'"; |
||
1536 | $result = $mysqli->query($query_trainer) or die("getting trainer optione failed"); |
||
1537 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1538 | $section_name = $query_data['trainer_options']; |
||
1539 | |||
1540 | if ($subsection == 'Trainer') { |
||
1541 | $subsection_name = $section_name; |
||
1542 | } |
||
1543 | } |
||
1544 | |||
1545 | // Everything we do for the DOWNLOADS EDIT SECTION |
||
1546 | if ($section == 'Downloads') { |
||
1547 | // get the name of the game |
||
1548 | $query_game = "SELECT * FROM game WHERE game_id = '$section_id'"; |
||
1549 | $result = $mysqli->query($query_game) or die("getting game_name failed yooohoo"); |
||
1550 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1551 | $section_name = $query_data['game_name']; |
||
1552 | |||
1553 | if ($subsection == 'Options') { |
||
1554 | // get the name of the option |
||
1555 | $query_option = "SELECT * FROM download_options WHERE download_options_id = '$subsection_id'"; |
||
1556 | $result = $mysqli->query($query_option) or die("getting option failed"); |
||
1557 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1558 | $subsection_name = $query_data['download_option']; |
||
1559 | $subsection_id = $query_data['download_options_id']; |
||
1560 | } |
||
1561 | |||
1562 | if ($subsection == 'TOS') { |
||
1563 | // get the name of the option |
||
1564 | $query_tos = "SELECT * FROM tos_version |
||
1565 | WHERE tos_version_id = '$subsection_id'"; |
||
1566 | $result = $mysqli->query($query_tos) or die("getting tos failed"); |
||
1567 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1568 | $subsection_name = $query_data['tos_version']; |
||
1569 | $subsection_id = $query_data['tos_version_id']; |
||
1570 | } |
||
1571 | |||
1572 | if ($subsection == 'Details') { |
||
1573 | $subsection_name = $section_name; |
||
1574 | } |
||
1575 | |||
1576 | if ($subsection == 'Menudisk') { |
||
1577 | $subsection_name = $section_name; |
||
1578 | } |
||
1579 | |||
1580 | if ($subsection == 'Chain') { |
||
1581 | $subsection_name = $section_name; |
||
1582 | } |
||
1583 | |||
1584 | if ($subsection == 'Trainer') { |
||
1585 | // get the name of the trainer option |
||
1586 | $query_trainer = "SELECT * FROM trainer_options |
||
1587 | WHERE trainer_options_id = '$subsection_id'"; |
||
1588 | $result = $mysqli->query($query_trainer) or die("getting trainer failed"); |
||
1589 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1590 | $subsection_name = $query_data['trainer_options']; |
||
1591 | $subsection_id = $query_data['trainer_options_id']; |
||
1592 | } |
||
1593 | |||
1594 | if ($subsection == 'Crew') { |
||
1595 | // get the name of the trainer option |
||
1596 | $query_crew = "SELECT * FROM crew WHERE |
||
1597 | crew_id = '$subsection_id'"; |
||
1598 | $result = $mysqli->query($query_crew) or die("getting crew failed"); |
||
1599 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1600 | $subsection_name = $query_data['crew_name']; |
||
1601 | } |
||
1602 | |||
1603 | if ($subsection == 'Authors') { |
||
1604 | // get the name of the author option |
||
1605 | $query_ind = "SELECT ind_name FROM individuals WHERE |
||
1606 | ind_id = '$subsection_id'"; |
||
1607 | $result = $mysqli->query($query_ind) or die("getting ind failed"); |
||
1608 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1609 | $subsection_name = $query_data['ind_name']; |
||
1610 | } |
||
1611 | } |
||
1612 | |||
1613 | // Everything we do for the BUG REPORT TYPE SECTION |
||
1614 | if ($section == 'Bug type') { |
||
1615 | // get the name of the type |
||
1616 | $query_type = "SELECT bug_report_type FROM bug_report_type WHERE bug_report_type_id = '$section_id'"; |
||
1617 | $result = $mysqli->query($query_type) or die("getting type name failed"); |
||
1618 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1619 | $section_name = $query_data['bug_report_type']; |
||
1620 | |||
1621 | if ($subsection == 'Bug type') { |
||
1622 | $subsection_name = $section_name; |
||
1623 | } |
||
1624 | } |
||
1625 | |||
1626 | // Everything we do for the BUG REPORT SECTION |
||
1627 | if ($section == 'Bug') { |
||
1628 | $subsection_name = ("Bug report ID " . $subsection_id); |
||
1629 | $section_name = ("Bug report ID " . $subsection_id); |
||
1630 | } |
||
1631 | |||
1632 | // Everything we do for the GAMES CONFIG section |
||
1633 | if ($section == 'Games Config') { |
||
1634 | if ($subsection == 'Games Engine') { |
||
1635 | // Get the engine name |
||
1636 | $query = "SELECT name FROM engine WHERE id = '$section_id'"; |
||
1637 | $result = $mysqli->query($query) or die("getting engine name failed"); |
||
1638 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1639 | $section_name = $query_data['name']; |
||
1640 | } elseif ($subsection == 'Programming Language') { |
||
1641 | // Get the programming language name |
||
1642 | $query = "SELECT name FROM programming_language WHERE id = '$section_id'"; |
||
1643 | $result = $mysqli->query($query) or die("getting language name failed"); |
||
1644 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1645 | $section_name = $query_data['name']; |
||
1646 | } elseif ($subsection == 'Genre') { |
||
1647 | // Get the genre name |
||
1648 | $query = "SELECT name FROM game_genre WHERE id = '$section_id'"; |
||
1649 | $result = $mysqli->query($query) or die("getting genre name failed"); |
||
1650 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1651 | $section_name = $query_data['name']; |
||
1652 | } elseif ($subsection == 'Port') { |
||
1653 | // Get the port name |
||
1654 | $query = "SELECT name FROM port WHERE id = '$section_id'"; |
||
1655 | $result = $mysqli->query($query) or die("getting port name failed"); |
||
1656 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1657 | $section_name = $query_data['name']; |
||
1658 | } elseif ($subsection == 'Individual Role') { |
||
1659 | // Get the role name |
||
1660 | $query = "SELECT name FROM individual_role WHERE id = '$section_id'"; |
||
1661 | $result = $mysqli->query($query) or die("getting role name failed"); |
||
1662 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1663 | $section_name = $query_data['name']; |
||
1664 | } elseif ($subsection == 'Developer Role') { |
||
1665 | // Get the role name |
||
1666 | $query = "SELECT role FROM developer_role WHERE id = '$section_id'"; |
||
1667 | $result = $mysqli->query($query) or die("getting role name failed"); |
||
1668 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1669 | $section_name = $query_data['name']; |
||
1670 | } elseif ($subsection == 'Language') { |
||
1671 | // Get the language name |
||
1672 | $query = "SELECT name FROM language WHERE id = '$section_id'"; |
||
1673 | $result = $mysqli->query($query) or die("getting language name failed"); |
||
1674 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1675 | $section_name = $query_data['name']; |
||
1676 | } elseif ($subsection == 'Control') { |
||
1677 | // Get the language name |
||
1678 | $query = "SELECT name FROM control WHERE id = '$section_id'"; |
||
1679 | $result = $mysqli->query($query) or die("getting control type failed"); |
||
1680 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1681 | $section_name = $query_data['name']; |
||
1682 | } elseif ($subsection == 'Resolution') { |
||
1683 | // Get the resolution name |
||
1684 | $query = "SELECT name FROM resolution WHERE id = '$section_id'"; |
||
1685 | $result = $mysqli->query($query) or die("getting resolution failed"); |
||
1686 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1687 | $section_name = $query_data['name']; |
||
1688 | } elseif ($subsection == 'System') { |
||
1689 | // Get the system name |
||
1690 | $query = "SELECT name FROM system WHERE id = '$section_id'"; |
||
1691 | $result = $mysqli->query($query) or die("getting system failed"); |
||
1692 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1693 | $section_name = $query_data['name']; |
||
1694 | } elseif ($subsection == 'Emulator') { |
||
1695 | // Get the emulator name |
||
1696 | $query = "SELECT name FROM emulator WHERE id = '$section_id'"; |
||
1697 | $result = $mysqli->query($query) or die("getting emulator failed"); |
||
1698 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1699 | $section_name = $query_data['name']; |
||
1700 | } elseif ($subsection == 'Trainer') { |
||
1701 | // Get the trainer option name |
||
1702 | $query = "SELECT name FROM trainer_option WHERE id = '$section_id'"; |
||
1703 | $result = $mysqli->query($query) or die("getting trainer option failed"); |
||
1704 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1705 | $section_name = $query_data['name']; |
||
1706 | } elseif ($subsection == 'Memory') { |
||
1707 | // Get the memory amount |
||
1708 | $query = "SELECT name FROM memory WHERE id = '$section_id'"; |
||
1709 | $result = $mysqli->query($query) or die("getting memory amount failed"); |
||
1710 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1711 | $section_name = $query_data['memory']; |
||
1712 | } elseif ($subsection == 'Tos') { |
||
1713 | // Get the tos amount |
||
1714 | $query = "SELECT name FROM tos WHERE id = '$section_id'"; |
||
1715 | $result = $mysqli->query($query) or die("getting tos version failed"); |
||
1716 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1717 | $section_name = $query_data['name']; |
||
1718 | } elseif ($subsection == 'Protection') { |
||
1719 | // Get the protection type |
||
1720 | $query = "SELECT name FROM copy_protection WHERE id = '$section_id'"; |
||
1721 | $result = $mysqli->query($query) or die("getting copy protection failed"); |
||
1722 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1723 | $section_name = $query_data['name']; |
||
1724 | } elseif ($subsection == 'Disk Protection') { |
||
1725 | // Get the protection type |
||
1726 | $query = "SELECT name FROM disk_protection WHERE id = '$section_id'"; |
||
1727 | $result = $mysqli->query($query) or die("getting disk protection failed"); |
||
1728 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1729 | $section_name = $query_data['name']; |
||
1730 | } elseif ($subsection == 'Enhancement') { |
||
1731 | // Get the Enhancement |
||
1732 | $query = "SELECT name FROM enhancement WHERE id = '$section_id'"; |
||
1733 | $result = $mysqli->query($query) or die("getting enhancement failed"); |
||
1734 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1735 | $section_name = $query_data['name']; |
||
1736 | } elseif ($subsection == 'Media Type') { |
||
1737 | // Get the Enhancement |
||
1738 | $query = "SELECT name FROM media_type WHERE id = '$section_id'"; |
||
1739 | $result = $mysqli->query($query) or die("getting media type failed"); |
||
1740 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1741 | $section_name = $query_data['name']; |
||
1742 | } elseif ($subsection == 'Media Scan Type') { |
||
1743 | // Get the Enhancement |
||
1744 | $query = "SELECT name FROM media_scan_type WHERE id = '$section_id'"; |
||
1745 | $result = $mysqli->query($query) or die("getting media type failed"); |
||
1746 | } elseif ($subsection == 'Sound hardware') { |
||
1747 | // Get the the hardware |
||
1748 | $query = "SELECT name FROM sound_hardware WHERE id = '$section_id'"; |
||
1749 | $result = $mysqli->query($query) or die("getting sound hardware failed"); |
||
1750 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1751 | $section_name = $query_data['name']; |
||
1752 | } elseif ($subsection == 'Progress System') { |
||
1753 | // Get the the system |
||
1754 | $query = "SELECT name FROM game_progress_system WHERE id = '$section_id'"; |
||
1755 | $result = $mysqli->query($query) or die("getting progress system failed"); |
||
1756 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1757 | $section_name = $query_data['name']; |
||
1758 | } |
||
1759 | $subsection_name = $section_name; |
||
1760 | } |
||
1761 | |||
1762 | //Everything we do for GAME RELEASES |
||
1763 | if ($section == 'Game Release') { |
||
1764 | // get the release name |
||
1765 | $query_game = "SELECT game_name FROM game WHERE game_id = '$section_id'"; |
||
1766 | $result = $mysqli->query($query_game) or die("getting name failed"); |
||
1767 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1768 | $section_name = $query_data['game_name']; |
||
1769 | |||
1770 | if ($subsection == 'Game Release' or $subsection == 'Release Info' or $subsection == 'Release AKA' |
||
1771 | or $subsection == 'Compatibility' or $subsection == 'Distributor' |
||
1772 | or $subsection == 'Scene' or $subsection == 'Memory Enhancement' or $subsection == 'Minimum Memory' |
||
1773 | or $subsection == 'Incompatible Memory' or $subsection == 'Incompatible TOS' |
||
1774 | or $subsection == 'Protection' or $subsection == 'Language' or $subsection == 'System Enhancement' |
||
1775 | or $subsection == 'Copy Protection' or $subsection == 'Disk Protection' or $subsection == 'Media' |
||
1776 | or $subsection == 'Dump' or $subsection == 'Media Scan' or $subsection == "Scan") { |
||
1777 | $subsection_name = $section_name; |
||
1778 | } |
||
1779 | |||
1780 | if ($subsection == 'Distributor') { |
||
1781 | // get the distributor name |
||
1782 | $query_distributor = "SELECT * FROM pub_dev |
||
1783 | LEFT JOIN game_release_distributor |
||
1784 | ON (pub_dev.pub_dev_id = game_release_distributor.pub_dev_id) |
||
1785 | WHERE pub_dev.pub_dev_id = '$subsection_id'"; |
||
1786 | $result = $mysqli->query($query_distributor) or die("getting name failed"); |
||
1787 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1788 | $subsection_name = $query_data['pub_dev_name']; |
||
1789 | $subsection_id = $query_data['game_release_id']; |
||
1790 | } |
||
1791 | |||
1792 | if ($subsection == 'Crew') { |
||
1793 | // get the distributor name |
||
1794 | $query_crew = "SELECT * FROM crew |
||
1795 | LEFT JOIN game_release_crew |
||
1796 | ON (crew.crew_id = game_release_crew.crew_id) |
||
1797 | WHERE crew.crew_id = '$subsection_id'"; |
||
1798 | $result = $mysqli->query($query_crew) or die("getting name failed"); |
||
1799 | $query_data = $result->fetch_array(MYSQLI_BOTH); |
||
1800 | $subsection_name = $query_data['crew_name']; |
||
1801 | $subsection_id = $query_data['game_release_id']; |
||
1802 | } |
||
1803 | } |
||
1804 | |||
1805 | $section_name = $mysqli->real_escape_string($section_name); |
||
1806 | $subsection_name = $mysqli->real_escape_string($subsection_name); |
||
1807 | |||
1808 | $log_time = time(); |
||
1809 | $sql_log = $mysqli->query("INSERT INTO change_log |
||
1810 | (section, section_id, section_name, sub_section, sub_section_id, sub_section_name, user_id, action, timestamp) |
||
1811 | VALUES ('$section', '$section_id', '$section_name', '$subsection', '$subsection_id', '$subsection_name', |
||
1812 | '$user_id', '$action', '$log_time')") or die("Couldn't insert change log into database"); |
||
1813 | } |
||
1814 |