1. JavaScript / Говнокод #17793

    +158

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    eps=0.001;
    
    s1=new Source(1000,0.17);
    mx=new Mixer(1000);
    mb=new Mem(0.15,0.95);
    sp=new Splitter(0.80);
    s2=new Sink();
    s3=new Sink();
    
    mx.in1=s1.out1;
    mx.in2=sp.out2;
    mb.in1=mx.out1;
    sp.in1=mb.out2;
    s3.in1=sp.out1;
    s2.in1=mb.out1;
    
    for (i=0;i<50;i++){
        mx.calc();
        mb.calc();
        sp.calc();
    }
    
    function Stream(v,c){
        this.v=v||null;
        this.c=c||null;
        this.selfCheck=false;
        this.Show=function(){//how to add default values?
            return "volume="+this.v+",conc="+this.c+",selfCheck:"+this.selfCheck+"; ";
        }
    }
    
    function Source(v,c){
        this.out1=new Stream(v,c);
        this.calc=function(){};
    }
    function Sink(){
        this.in1=null;
        this.calc=function(){};
    }
    
    function Mixer(fixedV){
        this.fv=fixedV;
        this.in1=null;
        this.in2=null;
        this.out1=new Stream();
        this.calc=function(){
            this.out1.v=this.fv;//||this.in1.v+this.in2.v;
            this.in2.v=this.in2.v||0;
            this.in2.c=this.in2.c||0;
            this.in1.v=this.out1.v-this.in2.v;
            this.out1.c =(this.in1.v*this.in1.c+this.in2.v*this.in2.c)/this.out1.v;
            this.out1.selfCheck=Math.abs
            ((this.in1.v*this.in1.c+this.in2.v*this.in2.c)-(this.out1.v*this.out1.c))<eps;
        }
    }
    
    function Splitter(kS){
        this.in1=null;
        this.ks=kS||0.05;
        this.out1=new Stream();
        this.out2=new Stream();
        this.calc=function(){
            this.out1.v=this.in1.v*(1-this.ks);
            this.out2.v=this.in1.v*(this.ks);
            this.out1.c=this.in1.c;
            this.out2.c=this.in1.c;
        }
    
    }
    
    function Mem(kV,kC) {
        this.kv = kV||0.15;
        this.kc = kC||0.95;
        this.in1 = null;
        this.out1 = new Stream();
        this.out2 = new Stream();
        this.calc = function () {
            this.out1.v = this.in1.v * this.kv;
            this.out1.c = this.in1.c * (1 - this.kc);
            this.out2.v = this.in1.v * (1 - this.kv);
            this.out2.c = (this.in1.v * this.in1.c - this.out1.v * this.out1.c) / this.out2.v;
            this.out1.selfCheck = this.out2.selfCheck = Math.abs
            (this.in1.v * this.in1.c - (this.out1.v * this.out1.c + this.out2.v * this.out2.c)) < eps;
    
        }
    }

    xtfkpi, 16 Марта 2015

    Комментарии (3)
  2. Python / Говнокод #17792

    −115

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    def _message_handler_thread(self):
            self._nick_change_failed = []
            while self.running:
                msg = self._message_queue.get(True)
                text = msg.get_data()
                conn = msg.get_connection()
                args = text.replace("\r", "").replace("\n", "").split(" ")
                command = args[0].upper()
                command_args = args[1:]
                if command == "NICK":
                    if len(command_args) < 1:
                        self._send_not_enough_parameters(conn, command)
                    else:
                        ident = self._clients[conn].identifier if self._clients[conn].identifier else None
                        if not self._set_nick(conn, command_args[0], ident):
                            self._nick_change_failed.append(conn)
                elif command == "USER":
                    if conn in self._clients:
                        if len(command_args) < 2:
                            self._send_not_enough_parameters(conn, command)
                        else:
                            ''''
                            self._send_lusers(conn)
                            self._clients[conn].real_name = command_args[:]
                            self._clients[conn].identifier = self._clients[conn].get_nick() + "!" + \
                                                                   command_args[0] + "@" + self.name
                            '''
                            self._set_nick(conn, command_args[0], command_args[1])
                            self._send_motd(conn)
                    else:  # Another way to identify is USER command.
                        if len(command_args) < 2:
                            self._send_not_enough_parameters(conn, command)
                        elif conn in self._nick_change_failed:
                            self._nick_change_failed.remove(conn)
                        else:
                            if self._set_nick(conn, command_args[0], command_args[1]):
                                self._clients[conn].identifier = self._clients[conn].get_nick() + "!" + \
                                    command_args[0] + "@" + self.name
                                self._send_motd(conn)
                elif command == "PRIVMSG" or command == "NOTICE":
                    if len(command_args) < 2:
                        self._send_not_enough_parameters(conn, command)
                    else:
                        message_text = command_args[1] if not command_args[1][0] == ":" else \
                            text.replace("\r\n", "")[text.index(":")+1:]
                        src = self._clients[conn].get_identifier()
                        dest = command_args[0]
                        if not dest.startswith("#"):
                            for clnt in self._clients.values():
                                if clnt.nick == dest:
                                    clnt.connection.send(
                                        ":%s %s %s :%s" % (src, command, dest, message_text)
                                    )
                                    break
                            else:
                                self._send_no_user(conn, dest)
                        else:
                            for chan in self._channels:
                                if chan.name == dest:
                                    self._channel_broadcast(conn, chan, ":%s %s %s :%s" %
                                                (src, command, dest, message_text))
                                    break
                            else:
                                self._send_no_user(conn, dest)
                elif command == "JOIN":
                    if len(command_args) < 1:
                        self._send_not_enough_parameters(conn, command)
                    elif not all(c in ALLOWED_CHANNEL for c in command_args[0]) and len(command_args[0]):
                        self._send_no_channel(conn, command_args[0])
                    else:
                        for chan in self._channels:
                            if chan.name == command_args[0]:
                                chan.users += 1
                                self._clients[conn].channels.append(chan)
                                self._send_to_related(conn, ":%s JOIN %s" % (self._clients[conn].get_identifier(),
                                                                             chan.name), True)
                                self._send_topic(conn, chan)
                                self._send_names(conn, chan)
                        else:
                            chan = Channel(command_args[0], 1)
                            chan.users = 1  # We have a user, because we have created it!
                            self._channels.append(chan)
                            self._clients[conn].channels.append(chan)
                            self._clients[conn].send(":%s JOIN %s" % (self._clients[conn].get_identifier(),
                                                       command_args[0]))
                elif command == "PART":
                    if len(command_args) < 1:
                        self._send_not_enough_parameters(conn, command)
                    else:
                        for chan in self._channels:
                            if chan.name == command_args[0]:
    
                                self._send_to_related(conn, ":%s PART %s" % (self._clients[conn].get_identifier(),
                                                                             command_args[0]))
                                self._clients[conn].channels.remove(chan)
                                chan.users -= 1
                                break
    ...

    Я писал сервер для IRC...
    Больше говнокода: https://github.com/SopaXorzTaker/irc-server/

    GoUseGitHub, 15 Марта 2015

    Комментарии (58)
  3. C++ / Говнокод #17791

    +57

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    #include <cstdio>
    #include <cstring>
    
    int main() {
        unsigned long long int a[100000];
        unsigned long long int N;
        unsigned long long int max,max1;
        unsigned long long int maxC,maxC1;
        unsigned long long int maxN[100000];
        unsigned long long int ans = 0;
        unsigned long long int ans1 = 0;
        max = max1 = maxC = maxC1 = 0;
        scanf("%llu",&N);
        for (unsigned long long int i = 0; i < N; ++i) {
            scanf("%llu",a + i);
            if (a[i] > a[max]) {
                max1 = max;
                maxC1 = maxC;
    //            memcpy(maxN,maxN1,maxC*sizeof(unsigned long long int));
                max = i;
                maxC = 1;
                maxN[0] = max;
            } else if (a[i] == a[max]) {
                maxN[maxC++] = i;
            } else if (a[i] > a[max1]) {
                max1 = i;
                maxC1 = 1;
            } else if (a[i] == a[max1]) {
                maxC1++;
            }
        }
        if (maxC == 1) {
            ans = a[max];
            if (a[max] == a[max1] + 1) {
                if (a[max] < (maxC1 + 1) * a[max1]) {
                    printf("%llu\n",a[max]);
                    return 0;
                }
            }
            if (max > 0) {
                if (a[max - 1] + 1 < ans - 1) {
                    if (a[max - 1] + 1 == a[max1]) {
                        if (a[max1] * (maxC1 + 1 + (a[max] - 1 == a[max1]?1:0)) < ans) {
                            ans1 = a[max1] * (maxC1 + 1 + (a[max] - 1 == a[max1]?1:0));
                            if (ans > ans1) ans = ans1;
    //                        prunsigned long long intf ("1 : %d\n",ans);
                        }
                    }
                    else { 
                        ans1 = a[max] - 1 + (a[max] - 1 == a[max1]?a[max1] * maxC1:0);
                        if (ans > ans1) ans = ans1;
    //                    prunsigned long long intf ("2 : %d\n",ans);
                    }
                }
            }
            if (max < N - 2) {
                if (a[max + 1] + 1 < ans - 1) {
                    if (a[max + 1] + 1 == a[max1]) {
                        if (a[max1] * (maxC1 + 1 + (a[max] - 1 == a[max1]?1:0)) < ans) {
                            ans1 = a[max1] * (maxC1 + 1 + (a[max] - 1 == a[max1]?1:0));
                            if (ans > ans1) ans = ans1;
    //                        prunsigned long long intf ("3 : %d\n",ans);
                        }
                    }
                    else { 
                        ans1 = a[max] - 1 + (a[max] - 1 == a[max1]?a[max1] * maxC1:0);
                        if (ans > ans1) ans = ans1;
    //                    prunsigned long long intf ("4 : %d\n",ans);
                    }
                }
            }
            printf("%llu\n",ans);
            return 0;
        } // one max line
        bool f = true;
        bool f1 = true;
        if (a[max] * maxC > a[max] + 1) {
    //        prunsigned long long intf("here %d\n",maxC);
            for (unsigned long long int i = 0; i < maxC; ++i) {
                if (f1 && ((maxN[i] && a[maxN[i] - 1]) || (maxN[i] < N - 1 && a[maxN[i] + 1]))) f1 = false; // get from near line
                if (f && ((maxN[i] && a[maxN[i] - 1] < a[max] - 1) || (maxN[i] < N - 1 && a[maxN[i] + 1] < a[max] - 1))) f = false;
            }
        }
        ans1 = ans = maxC * a[max];
        
        if (!f && a[max] > 1) ans = (maxC - 1) * a[max];
        if (!f1) ans1 = a[max] + 1;
        printf("%llu\n",ans>ans1?ans1:ans);
        return 0;
    }

    Серега говнокодит задачу с OpenCup'a от 15.03.2015 (задача L - Бассейн счастья)

    kosta3ov, 15 Марта 2015

    Комментарии (26)
  4. Куча / Говнокод #17790

    +137

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    http://download.hdd.tomsk.ru/preview/wxjuxudv.jpg
    
    Защита от ботов 100500ого левела
    
    И что не так с этими вебпрограммистами?
    
    С сайта
    http://friends-online.co/eng/1-season/1-seria-1-season.html

    kegdan, 15 Марта 2015

    Комментарии (417)
  5. ActionScript / Говнокод #17789

    −95

    1. 1
    2. 2
    if (avoidFlickeringTimer.running);
        avoidFlickeringTimer.reset();

    чинили-чинили...

    wvxvw, 15 Марта 2015

    Комментарии (5)
  6. PHP / Говнокод #17788

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    for ($i=1;$i<=10;$i++) { 
    		  if(isset(${"imagenum".$i})) {
                         ....
                     }
    }

    И такое бывало

    sikamikanico, 15 Марта 2015

    Комментарии (3)
  7. Си / Говнокод #17787

    +136

    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
    printf("Enter item code: ");                                        //Prompts user
    scanf ("%14s", codenew1);                                           //Read user input
    len = strlen(codenew1);                                             //Read each character into variable len
    
    while (len != strspn(codenew1, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))
    {
        printf ("Name contains non-alphabet characters. Try again!: "); //Prompts user to try again
        scanf ("%14s", codenew1);                                       //Reads user input
        len = strlen(codenew1);                                         //Read each character into variable len
    }                                                                   //Endwhile
    strncpy(codenew, codenew1,2);                                       //Copy the first two characters from the variable codenew1
    codenew[2] = 0;                                                     //Store first two characters into variavle codenew
    
    for ( j = 0; j < num_items; j++)                                    //Loop for num_items times
    {                                                                   //Beginning of for loop
        if (strcmp(array[j].code1, codenew) == 0)                       //If codenew is found in file
        {                                                               //Beginning of if statement
            price[i] = item_qty[i] * array[j].price1;                   //Calculating the price of an item
            printf("Price : %d", price[i]);                             //Prints price
            printf("\nEnter '%s' to confirm: ", array[j].itemname1);    //Confirming the item
            scanf("%19s", item_name1[i]);
            while (strcmp(item_name1[i], array[j].itemname1 )!=0)       //Looping until both item names are the same
            {                                                           //Begin while loop
                printf("Item name is not %s ,Try Again!: ", array[j].itemname1);    //Prompt user to try again
                scanf ("%19s", item_name1[i]);                              //Reads item name into an array
                len = strlen(item_name1[i]);                                //Reads each character into variable len
            }                                                               //End while loop
            len = strlen(item_name1[i]);                                    //Read each character into variable len
            while (len != strspn(item_name1[i], "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))    //While len contains non alphabetic characters
            {                                                                       //Beginning while
                printf ("Name contains non-alphabet characters. Try again!: ");     //Prompts user to try again
                scanf ("%19s", item_name1[i]);                                      //Read user input
                len = strlen(item_name1[i]);                                        //Read each character into variable len
            }                                                                       //End while
            strncpy(item_name[i], item_name1[i], 20);                               //Copy the first two characters from the variable codenew1
            item_name[i][20] = 0;                                                   //Store first 20 characters in variable item_name[i]
            total_price+= price[i];                                     //Calculate total price
            break;                                                      //Terminates loop
        }                                                               //End of if statement
        else 
            if (strcmp(array[j].code1, codenew) != 0)                       //If codenew is found in file
            {
                printf("Invalid input! Try again.");
                goto Here;
            }
    }                                                           //End of for loop

    Бесценные комментарии!
    http://stackoverflow.com/questions/29045067/error-check-files

    myaut, 14 Марта 2015

    Комментарии (34)
  8. C++ / Говнокод #17786

    +54

    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
    #include <iostream>
    using namespace std;
    
    struct Foo
    {
    	int i[0];
    };
    
    int main() {
    	// your code goes here
    	Foo f1;
    	Foo f2[5];
    	cout << sizeof(f1) << endl;
    	cout << sizeof(f2) << endl;
    	return 0;
    }

    http://rextester.com/NAA5246
    http://rextester.com/GKLFG82436
    http://rextester.com/SSZ22454
    http://rextester.com/ZEY11320

    DlangGovno, 14 Марта 2015

    Комментарии (12)
  9. PHP / Говнокод #17785

    +156

    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
    <?php
    function rus_date($time_stamp){
            $date_time = date( "Y-m-d H:i:s",time() - 3600);
            $time_s = strtotime($date_time);
            $date_segodna = date( "Ymd",time() - 3600);
            
            $date_kisa = date( "Ymd",time() - 86400);
            
            $data_one_year = date( "Ymd",time() - 31536000);
            
            $date = date("Y-n-d H:i:s", $time_stamp);
            
            $date_segodna_items = date("Ymd", $time_stamp);
            
            $raznost = strtotime($date_time) - strtotime($date);
            
            $explode_two = explode(' ',$date);
            
            $explode = explode('-',$explode_two[0]);
            
            $explode_good = explode(':',$explode_two[1]);
            
            $month = array('янв','фев','март','апр','май','июнь','июль','авг','сен','окт','нояб','дек');
            
            $num = (int)$explode[1];
            $num = $num - 1;
            $mes = $month[$num];
            
            
            if($date_segodna == $date_segodna_items){
                if($date_segodna == date( "Ymd",$time_stamp)){
                    return 'Сегодня в '.$explode_good[0].':'.$explode_good[1];
                }
                else{
                    return 'Вчера в '.$explode_good[0].':'.$explode_good[1];
                }
            }
            elseif($date_kisa == $date_segodna_items){
                return 'Вчера в '.$explode_good[0].':'.$explode_good[1];
            }
            elseif($raznost >= 31536000){
                return $explode[2].' '.$mes.' '.$explode[0].' в '.$explode_good[0].':'.$explode_good[1];
            }
            elseif($raznost <= 31536000){
                return $explode[2].' '.$mes.' в '.$explode_good[0].':'.$explode_good[1];
            }
            else{
                return $explode[2].' '.$mes.' '.$explode[0].' в '.$explode_good[0].':'.$explode_good[1];
            }
        }
    rus_date(Если временая метка ровна 0) // вернет    ( 01 янв 1970 в 04:00 )
    rus_date(Сегодняшняя метка) // вернет     ( Сегодня в 04:00 )
    rus_date(Если временая метка из прошлого и прошлому больше 24 часов но меньше 48ч) // вернет     ( Вчера в 04:00 )
    rus_date(Если больше 2 дней ) // вернет такую дату     ( 04 дек в 04:00 )

    Форматирование времени просто подставить временную метку в функцию
    Го посмеемся вместе?

    gam0ra, 13 Марта 2015

    Комментарии (17)
  10. PHP / Говнокод #17784

    +156

    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
    <?php
    
    error_reporting(E_ALL);
    require_once('project.php');
    $loader = new Twig_Loader_Filesystem('templates');
    $twig = new Twig_Environment($loader,
        array(
            'cache' => 'compilation_cache',
            'debug' => true
        )
    );
    $twig->addExtension(new Twig_Extension_Debug());
    $data='';
    $data .= summ('summa','zvit');
    $payments =getPayments();//tableM(getPayments());
    
    
    if (array_key_exists('go', $_REQUEST))
        {
        $go=$_REQUEST['go'];
        }
        else
        {
        $go='';
        }
    switch ($go) {
        case '':
            echo $twig->render('index.html',array('payments' => $payments)); ); //
            break;
        case 'addData':
            $form = showForm();
            echo "$form";
            break;
        case 'add':
            $data=$_POST['data'];
            $summa=$_POST['summa'];
            addDate($data,$summa);
            redirect('index.php');
            break;
        case 'delete':
            $id = $_GET['id'];
            delete($id);
            redirect('index.php');
            break;
    }

    vityapro, 13 Марта 2015

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