├── LICENSE ├── README.md ├── corona.sql ├── output.sql └── src ├── _api.php ├── _cookies.txt ├── _core.php ├── _netphp.php ├── _phpedb.php ├── _test.php ├── _update.php ├── index.php └── page.html /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # api-webservice-COVID-19 2 | 3 | API: Web Service Coronavirus Disease 2019 (COVID-19), Access to live data of outbreak of novel coronavirus disease 2019. 4 | 5 | Based on [CoronaVirusOutbreakAPI](https://github.com/BaseMax/CoronaVirusOutbreakAPI). 6 | 7 | ## Features 8 | 9 | - Free, Open Source, Easy and short code 10 | - Ability to create token for suers 11 | - Ability to search in country 12 | - Ability to sort (ASC or DESC) in country list 13 | - Ability to get total number (in world) 14 | - Ability to limit auth and token 15 | 16 | ## COVID19 API 17 | 18 | All request need `token` value in header, You can create `token` in **token** table. 19 | 20 | ### Country List 21 | 22 | **GET:** http://localhost/api-webservice-COVID-19/?method=list 23 | 24 | **POST:** http://localhost/api-webservice-COVID-19/ with `method=list` data 25 | 26 | ```json 27 | { 28 | status: "success", 29 | message: "", 30 | lastUpdate: "2020-02-27 18:05:06", 31 | result: [ 32 | { 33 | id: 1, 34 | name: "china", 35 | totalCase: 78514, 36 | newCase: 450, 37 | totalDeath: 2747, 38 | newDeath: 32, 39 | totalRecovered: 32954, 40 | seriousUser: 8346, 41 | datetime: "2020-02-27 18:05:03" 42 | }, 43 | ... 44 | ] 45 | } 46 | ``` 47 | 48 | ### Country List with Sort 49 | 50 | ##### DESC sort: 51 | 52 | **GET:** http://localhost/api-webservice-COVID-19/?method=list&sort=totalCase&type=desc 53 | 54 | **POST:** http://localhost/api-webservice-COVID-19/ with `method=list&sort=totalCase&type=desc` data 55 | 56 | ##### or ASC sort: 57 | 58 | **GET:** http://localhost/api-webservice-COVID-19/?method=list&sort=totalCase&type=asc 59 | 60 | **POST:** http://localhost/api-webservice-COVID-19/ with `method=list&sort=totalCase&type=asc` data 61 | 62 | ### Search in country 63 | 64 | **GET:** http://localhost/api-webservice-COVID-19/?method=search&query=ir 65 | 66 | **POST:** http://localhost/api-webservice-COVID-19/ with `method=search&query=ir` 67 | 68 | ```json 69 | { 70 | status: "success", 71 | message: "", 72 | result: [ 73 | { 74 | id: 5, 75 | name: "iran", 76 | totalCase: 245, 77 | newCase: 106, 78 | totalDeath: 26, 79 | newDeath: 7, 80 | totalRecovered: 25, 81 | seriousUser: 0, 82 | datetime: "2020-02-27 16:05:56" 83 | }, 84 | { 85 | id: 24, 86 | name: "iraq", 87 | totalCase: 6, 88 | newCase: 1, 89 | totalDeath: 0, 90 | newDeath: 0, 91 | totalRecovered: 0, 92 | seriousUser: 0, 93 | datetime: "2020-02-27 16:05:59" 94 | } 95 | ] 96 | } 97 | ``` 98 | 99 | ### Search in country with sort 100 | 101 | **GET:** http://localhost/api-webservice-COVID-19/?method=search&query=ir&sort=totalCase&type=asc 102 | 103 | **POST:** http://localhost/api-webservice-COVID-19/ with `method=search&query=ir&sort=totalCase&type=asc` data 104 | 105 | 106 | ### Total numbers in all country and in the world 107 | 108 | **GET:** http://localhost/api-webservice-COVID-19/?method=total 109 | 110 | **POST:** http://localhost/api-webservice-COVID-19/ with `method=total` 111 | 112 | ```json 113 | { 114 | status: "success", 115 | message: "", 116 | result: { 117 | all: "163492", 118 | died: "5588" 119 | } 120 | } 121 | ``` 122 | 123 | ## Installing / Using from COVID19 API 124 | 125 | - Download source files 126 | - Upload sources files in a webserver (e.g: `/var/www/html` or `/usr/share/nginx/html` or ...) 127 | - Create a database for this project 128 | - Put username, password and database name in `_core.php` file and config this project by modify `_core.php` file 129 | - Import `corona.sql` file into your database (using phpmyadmin or mariadb, mysql cli or other tools) 130 | 131 | > Note: corona.sql is database structure with empty table, you will use it to setup this project. But output.sql is a database output with current corona data. 132 | 133 | ## How keep data live and up to date? 134 | 135 | Run `$ php _update.php update` every time you want to update your database rows. 136 | It will automaticly update and change data, if they are new or changed! 137 | 138 | ## Using crontab to automaticly update results 139 | 140 | Crontab command: `* */2 * * * php _update.php >/dev/null 2>&1` 141 | 142 | Current time is: 2020-02-26 7:29:00 PM UTC 143 | 144 | This cron job will be run at: (5 times displayed and more...) 145 | 146 | - 2020-02-26 20:00:00 UTC 147 | - 2020-02-26 20:01:00 UTC 148 | - 2020-02-26 20:02:00 UTC 149 | - 2020-02-26 20:03:00 UTC 150 | - 2020-02-26 20:04:00 UTC 151 | - ... 152 | 153 | ## Test Script 154 | 155 | ### `php src/_test.php ` 156 | 157 | ``` 158 | Array 159 | ( 160 | [0] => Array 161 | ( 162 | [name] => usa 163 | [totalCase] => 123,781 164 | [newCase] => +203 165 | [totalDeath] => 2,229 166 | [newDeath] => +8 167 | [totalRecovered] => 3,238 168 | [seriousUser] => 118,314 169 | ) 170 | 171 | [1] => Array 172 | ( 173 | [name] => spain 174 | [totalCase] => 78,797 175 | [newCase] => +5,562 176 | [totalDeath] => 6,528 177 | [newDeath] => +546 178 | [totalRecovered] => 14,709 179 | [seriousUser] => 57,560 180 | ) 181 | 182 | [2] => Array 183 | ( 184 | [name] => germany 185 | [totalCase] => 58,247 186 | [newCase] => +552 187 | [totalDeath] => 455 188 | [newDeath] => +22 189 | [totalRecovered] => 8,481 190 | [seriousUser] => 49,311 191 | ) 192 | 193 | [3] => Array 194 | ( 195 | [name] => iran 196 | [totalCase] => 38,309 197 | [newCase] => +2,901 198 | [totalDeath] => 2,640 199 | [newDeath] => +123 200 | [totalRecovered] => 12,391 201 | [seriousUser] => 23,278 202 | ) 203 | 204 | [4] => Array 205 | ( 206 | [name] => switzerland 207 | [totalCase] => 14,352 208 | [newCase] => +276 209 | [totalDeath] => 282 210 | [newDeath] => +18 211 | [totalRecovered] => 1,595 212 | [seriousUser] => 12,475 213 | ) 214 | 215 | [5] => Array 216 | ( 217 | [name] => netherlands 218 | [totalCase] => 10,866 219 | [newCase] => +1,104 220 | [totalDeath] => 771 221 | [newDeath] => +132 222 | [totalRecovered] => 3 223 | [seriousUser] => 10,092 224 | ) 225 | 226 | [6] => Array 227 | ( 228 | [name] => belgium 229 | [totalCase] => 10,836 230 | [newCase] => +1,702 231 | [totalDeath] => 431 232 | [newDeath] => +78 233 | [totalRecovered] => 1,359 234 | [seriousUser] => 9,046 235 | ) 236 | 237 | [7] => Array 238 | ( 239 | [name] => s. korea 240 | [totalCase] => 9,583 241 | [newCase] => +105 242 | [totalDeath] => 152 243 | [newDeath] => +8 244 | [totalRecovered] => 5,033 245 | [seriousUser] => 4,398 246 | ) 247 | 248 | [8] => Array 249 | ( 250 | [name] => austria 251 | [totalCase] => 8,486 252 | [newCase] => +215 253 | [totalDeath] => 86 254 | [newDeath] => +18 255 | [totalRecovered] => 479 256 | [seriousUser] => 7,921 257 | ) 258 | 259 | [9] => Array 260 | ( 261 | [name] => portugal 262 | [totalCase] => 5,962 263 | [newCase] => +792 264 | [totalDeath] => 119 265 | [newDeath] => +19 266 | [totalRecovered] => 43 267 | [seriousUser] => 5,800 268 | ) 269 | 270 | [10] => Array 271 | ( 272 | [name] => norway 273 | [totalCase] => 4,232 274 | [newCase] => +217 275 | [totalDeath] => 25 276 | [newDeath] => +2 277 | [totalRecovered] => 7 278 | [seriousUser] => 4,200 279 | ) 280 | 281 | [11] => Array 282 | ( 283 | [name] => australia 284 | [totalCase] => 3,969 285 | [newCase] => +334 286 | [totalDeath] => 16 287 | [newDeath] => +2 288 | [totalRecovered] => 226 289 | [seriousUser] => 3,727 290 | ) 291 | 292 | [12] => Array 293 | ( 294 | [name] => israel 295 | [totalCase] => 3,865 296 | [newCase] => +246 297 | [totalDeath] => 14 298 | [newDeath] => +2 299 | [totalRecovered] => 89 300 | [seriousUser] => 3,762 301 | ) 302 | 303 | [13] => Array 304 | ( 305 | [name] => sweden 306 | [totalCase] => 3,700 307 | [newCase] => +253 308 | [totalDeath] => 110 309 | [newDeath] => +5 310 | [totalRecovered] => 16 311 | [seriousUser] => 3,574 312 | ) 313 | 314 | [14] => Array 315 | ( 316 | [name] => czechia 317 | [totalCase] => 2,697 318 | [newCase] => +66 319 | [totalDeath] => 13 320 | [newDeath] => +2 321 | [totalRecovered] => 11 322 | [seriousUser] => 2,673 323 | ) 324 | 325 | [15] => Array 326 | ( 327 | [name] => malaysia 328 | [totalCase] => 2,470 329 | [newCase] => +150 330 | [totalDeath] => 34 331 | [newDeath] => +7 332 | [totalRecovered] => 388 333 | [seriousUser] => 2,048 334 | ) 335 | 336 | [16] => Array 337 | ( 338 | [name] => denmark 339 | [totalCase] => 2,395 340 | [newCase] => +194 341 | [totalDeath] => 72 342 | [newDeath] => +7 343 | [totalRecovered] => 1 344 | [seriousUser] => 2,322 345 | ) 346 | 347 | [17] => Array 348 | ( 349 | [name] => poland 350 | [totalCase] => 1,771 351 | [newCase] => +133 352 | [totalDeath] => 20 353 | [newDeath] => +2 354 | [totalRecovered] => 7 355 | [seriousUser] => 1,744 356 | ) 357 | 358 | [18] => Array 359 | ( 360 | [name] => romania 361 | [totalCase] => 1,760 362 | [newCase] => +308 363 | [totalDeath] => 40 364 | [newDeath] => +3 365 | [totalRecovered] => 169 366 | [seriousUser] => 1,551 367 | ) 368 | 369 | [19] => Array 370 | ( 371 | [name] => russia 372 | [totalCase] => 1,534 373 | [newCase] => +270 374 | [totalDeath] => 8 375 | [newDeath] => +4 376 | [totalRecovered] => 64 377 | [seriousUser] => 1,462 378 | ) 379 | 380 | [20] => Array 381 | ( 382 | [name] => pakistan 383 | [totalCase] => 1,526 384 | [newCase] => +31 385 | [totalDeath] => 13 386 | [newDeath] => +1 387 | [totalRecovered] => 29 388 | [seriousUser] => 1,484 389 | ) 390 | 391 | [21] => Array 392 | ( 393 | [name] => philippines 394 | [totalCase] => 1,418 395 | [newCase] => +343 396 | [totalDeath] => 71 397 | [newDeath] => +3 398 | [totalRecovered] => 42 399 | [seriousUser] => 1,305 400 | ) 401 | 402 | [22] => Array 403 | ( 404 | [name] => thailand 405 | [totalCase] => 1,388 406 | [newCase] => +143 407 | [totalDeath] => 7 408 | [newDeath] => +1 409 | [totalRecovered] => 97 410 | [seriousUser] => 1,284 411 | ) 412 | 413 | [23] => Array 414 | ( 415 | [name] => saudi arabia 416 | [totalCase] => 1,299 417 | [newCase] => +96 418 | [totalDeath] => 8 419 | [newDeath] => +4 420 | [totalRecovered] => 66 421 | [seriousUser] => 1,225 422 | ) 423 | 424 | [24] => Array 425 | ( 426 | [name] => indonesia 427 | [totalCase] => 1,285 428 | [newCase] => +130 429 | [totalDeath] => 114 430 | [newDeath] => +12 431 | [totalRecovered] => 64 432 | [seriousUser] => 1,107 433 | ) 434 | 435 | [25] => Array 436 | ( 437 | [name] => finland 438 | [totalCase] => 1,221 439 | [newCase] => +54 440 | [totalDeath] => 11 441 | [newDeath] => +2 442 | [totalRecovered] => 10 443 | [seriousUser] => 1,200 444 | ) 445 | 446 | [26] => Array 447 | ( 448 | [name] => mexico 449 | [totalCase] => 848 450 | [newCase] => +131 451 | [totalDeath] => 16 452 | [newDeath] => +4 453 | [totalRecovered] => 4 454 | [seriousUser] => 828 455 | ) 456 | 457 | [27] => Array 458 | ( 459 | [name] => singapore 460 | [totalCase] => 844 461 | [newCase] => +42 462 | [totalDeath] => 3 463 | [newDeath] => +1 464 | [totalRecovered] => 212 465 | [seriousUser] => 629 466 | ) 467 | 468 | [28] => Array 469 | ( 470 | [name] => slovenia 471 | [totalCase] => 730 472 | [newCase] => +46 473 | [totalDeath] => 11 474 | [newDeath] => +2 475 | [totalRecovered] => 10 476 | [seriousUser] => 709 477 | ) 478 | 479 | [29] => Array 480 | ( 481 | [name] => croatia 482 | [totalCase] => 713 483 | [newCase] => +56 484 | [totalDeath] => 6 485 | [newDeath] => +1 486 | [totalRecovered] => 52 487 | [seriousUser] => 655 488 | ) 489 | 490 | [30] => Array 491 | ( 492 | [name] => estonia 493 | [totalCase] => 679 494 | [newCase] => +34 495 | [totalDeath] => 3 496 | [newDeath] => +2 497 | [totalRecovered] => 20 498 | [seriousUser] => 656 499 | ) 500 | 501 | [31] => Array 502 | ( 503 | [name] => morocco 504 | [totalCase] => 450 505 | [newCase] => +48 506 | [totalDeath] => 26 507 | [newDeath] => +1 508 | [totalRecovered] => 13 509 | [seriousUser] => 411 510 | ) 511 | 512 | [32] => Array 513 | ( 514 | [name] => lebanon 515 | [totalCase] => 438 516 | [newCase] => +26 517 | [totalDeath] => 10 518 | [newDeath] => +2 519 | [totalRecovered] => 30 520 | [seriousUser] => 398 521 | ) 522 | 523 | [33] => Array 524 | ( 525 | [name] => armenia 526 | [totalCase] => 424 527 | [newCase] => +17 528 | [totalDeath] => 3 529 | [newDeath] => +2 530 | [totalRecovered] => 30 531 | [seriousUser] => 391 532 | ) 533 | 534 | [34] => Array 535 | ( 536 | [name] => hungary 537 | [totalCase] => 408 538 | [newCase] => +65 539 | [totalDeath] => 13 540 | [newDeath] => +2 541 | [totalRecovered] => 34 542 | [seriousUser] => 361 543 | ) 544 | 545 | [35] => Array 546 | ( 547 | [name] => bulgaria 548 | [totalCase] => 338 549 | [newCase] => +7 550 | [totalDeath] => 8 551 | [newDeath] => +1 552 | [totalRecovered] => 11 553 | [seriousUser] => 319 554 | ) 555 | 556 | [36] => Array 557 | ( 558 | [name] => north macedonia 559 | [totalCase] => 257 560 | [newCase] => +16 561 | [totalDeath] => 6 562 | [newDeath] => +2 563 | [totalRecovered] => 3 564 | [seriousUser] => 248 565 | ) 566 | 567 | [37] => Array 568 | ( 569 | [name] => china 570 | [totalCase] => 81,439 571 | [newCase] => +45 572 | [totalDeath] => 3,300 573 | [newDeath] => +5 574 | [totalRecovered] => 75,448 575 | [seriousUser] => 2,691 576 | ) 577 | 578 | [38] => Array 579 | ( 580 | [name] => china 581 | [totalCase] => 81,394 582 | [newCase] => +54 583 | [totalDeath] => 3,295 584 | [newDeath] => +3 585 | [totalRecovered] => 74,971 586 | [seriousUser] => 3,128 587 | ) 588 | 589 | [39] => Array 590 | ( 591 | [name] => usa 592 | [totalCase] => 123,578 593 | [newCase] => +19,452 594 | [totalDeath] => 2,221 595 | [newDeath] => +525 596 | [totalRecovered] => 3,231 597 | [seriousUser] => 118,126 598 | ) 599 | 600 | [40] => Array 601 | ( 602 | [name] => italy 603 | [totalCase] => 92,472 604 | [newCase] => +5,974 605 | [totalDeath] => 10,023 606 | [newDeath] => +889 607 | [totalRecovered] => 12,384 608 | [seriousUser] => 70,065 609 | ) 610 | 611 | [41] => Array 612 | ( 613 | [name] => spain 614 | [totalCase] => 73,235 615 | [newCase] => +7,516 616 | [totalDeath] => 5,982 617 | [newDeath] => +844 618 | [totalRecovered] => 12,285 619 | [seriousUser] => 54,968 620 | ) 621 | 622 | [42] => Array 623 | ( 624 | [name] => germany 625 | [totalCase] => 57,695 626 | [newCase] => +6,824 627 | [totalDeath] => 433 628 | [newDeath] => +82 629 | [totalRecovered] => 8,481 630 | [seriousUser] => 48,781 631 | ) 632 | 633 | [43] => Array 634 | ( 635 | [name] => france 636 | [totalCase] => 37,575 637 | [newCase] => +4,611 638 | [totalDeath] => 2,314 639 | [newDeath] => +319 640 | [totalRecovered] => 5,700 641 | [seriousUser] => 29,561 642 | ) 643 | 644 | [44] => Array 645 | ( 646 | [name] => iran 647 | [totalCase] => 35,408 648 | [newCase] => +3,076 649 | [totalDeath] => 2,517 650 | [newDeath] => +139 651 | [totalRecovered] => 11,679 652 | [seriousUser] => 21,212 653 | ) 654 | 655 | [45] => Array 656 | ( 657 | [name] => uk 658 | [totalCase] => 17,089 659 | [newCase] => +2,546 660 | [totalDeath] => 1,019 661 | [newDeath] => +260 662 | [totalRecovered] => 135 663 | [seriousUser] => 15,935 664 | ) 665 | 666 | [46] => Array 667 | ( 668 | [name] => switzerland 669 | [totalCase] => 14,076 670 | [newCase] => +1,148 671 | [totalDeath] => 264 672 | [newDeath] => +33 673 | [totalRecovered] => 1,530 674 | [seriousUser] => 12,282 675 | ) 676 | 677 | [47] => Array 678 | ( 679 | [name] => netherlands 680 | [totalCase] => 9,762 681 | [newCase] => +1,159 682 | [totalDeath] => 639 683 | [newDeath] => +93 684 | [totalRecovered] => 3 685 | [seriousUser] => 9,120 686 | ) 687 | 688 | [48] => Array 689 | ( 690 | [name] => s. korea 691 | [totalCase] => 9,478 692 | [newCase] => +146 693 | [totalDeath] => 144 694 | [newDeath] => +5 695 | [totalRecovered] => 4,811 696 | [seriousUser] => 4,523 697 | ) 698 | 699 | [49] => Array 700 | ( 701 | [name] => belgium 702 | [totalCase] => 9,134 703 | [newCase] => +1,850 704 | [totalDeath] => 353 705 | [newDeath] => +64 706 | [totalRecovered] => 1,063 707 | [seriousUser] => 7,718 708 | ) 709 | 710 | [50] => Array 711 | ( 712 | [name] => austria 713 | [totalCase] => 8,271 714 | [newCase] => +574 715 | [totalDeath] => 68 716 | [newDeath] => +10 717 | [totalRecovered] => 225 718 | [seriousUser] => 7,978 719 | ) 720 | 721 | [51] => Array 722 | ( 723 | [name] => turkey 724 | [totalCase] => 7,402 725 | [newCase] => +1,704 726 | [totalDeath] => 108 727 | [newDeath] => +16 728 | [totalRecovered] => 70 729 | [seriousUser] => 7,224 730 | ) 731 | 732 | [52] => Array 733 | ( 734 | [name] => canada 735 | [totalCase] => 5,655 736 | [newCase] => +898 737 | [totalDeath] => 60 738 | [newDeath] => +5 739 | [totalRecovered] => 396 740 | [seriousUser] => 5,199 741 | ) 742 | 743 | [53] => Array 744 | ( 745 | [name] => portugal 746 | [totalCase] => 5,170 747 | [newCase] => +902 748 | [totalDeath] => 100 749 | [newDeath] => +24 750 | [totalRecovered] => 43 751 | [seriousUser] => 5,027 752 | ) 753 | 754 | [54] => Array 755 | ( 756 | [name] => norway 757 | [totalCase] => 4,015 758 | [newCase] => +244 759 | [totalDeath] => 23 760 | [newDeath] => +4 761 | [totalRecovered] => 7 762 | [seriousUser] => 3,985 763 | ) 764 | 765 | [55] => Array 766 | ( 767 | [name] => brazil 768 | [totalCase] => 3,904 769 | [newCase] => +487 770 | [totalDeath] => 114 771 | [newDeath] => +22 772 | [totalRecovered] => 6 773 | [seriousUser] => 3,784 774 | ) 775 | 776 | [56] => Array 777 | ( 778 | [name] => australia 779 | [totalCase] => 3,635 780 | [newCase] => +257 781 | [totalDeath] => 14 782 | [newDeath] => +1 783 | [totalRecovered] => 170 784 | [seriousUser] => 3,451 785 | ) 786 | 787 | [57] => Array 788 | ( 789 | [name] => czechia 790 | [totalCase] => 2,631 791 | [newCase] => +352 792 | [totalDeath] => 11 793 | [newDeath] => +2 794 | [totalRecovered] => 11 795 | [seriousUser] => 2,609 796 | ) 797 | 798 | [58] => Array 799 | ( 800 | [name] => ireland 801 | [totalCase] => 2,415 802 | [newCase] => +294 803 | [totalDeath] => 36 804 | [newDeath] => +14 805 | [totalRecovered] => 5 806 | [seriousUser] => 2,374 807 | ) 808 | 809 | [59] => Array 810 | ( 811 | [name] => malaysia 812 | [totalCase] => 2,320 813 | [newCase] => +159 814 | [totalDeath] => 27 815 | [newDeath] => +1 816 | [totalRecovered] => 320 817 | [seriousUser] => 1,973 818 | ) 819 | 820 | [60] => Array 821 | ( 822 | [name] => denmark 823 | [totalCase] => 2,201 824 | [newCase] => +155 825 | [totalDeath] => 65 826 | [newDeath] => +13 827 | [totalRecovered] => 1 828 | [seriousUser] => 2,135 829 | ) 830 | 831 | [61] => Array 832 | ( 833 | [name] => chile 834 | [totalCase] => 1,909 835 | [newCase] => +299 836 | [totalDeath] => 6 837 | [newDeath] => +1 838 | [totalRecovered] => 61 839 | [seriousUser] => 1,842 840 | ) 841 | 842 | [62] => Array 843 | ( 844 | [name] => luxembourg 845 | [totalCase] => 1,831 846 | [newCase] => +226 847 | [totalDeath] => 18 848 | [newDeath] => +3 849 | [totalRecovered] => 40 850 | [seriousUser] => 1,773 851 | ) 852 | 853 | [63] => Array 854 | ( 855 | [name] => ecuador 856 | [totalCase] => 1,823 857 | [newCase] => +196 858 | [totalDeath] => 48 859 | [newDeath] => +7 860 | [totalRecovered] => 3 861 | [seriousUser] => 1,772 862 | ) 863 | 864 | [64] => Array 865 | ( 866 | [name] => japan 867 | [totalCase] => 1,693 868 | [newCase] => +194 869 | [totalDeath] => 52 870 | [newDeath] => +3 871 | [totalRecovered] => 404 872 | [seriousUser] => 1,237 873 | ) 874 | 875 | [65] => Array 876 | ( 877 | [name] => poland 878 | [totalCase] => 1,638 879 | [newCase] => +249 880 | [totalDeath] => 18 881 | [newDeath] => +2 882 | [totalRecovered] => 7 883 | [seriousUser] => 1,613 884 | ) 885 | 886 | [66] => Array 887 | ( 888 | [name] => pakistan 889 | [totalCase] => 1,495 890 | [newCase] => +122 891 | [totalDeath] => 12 892 | [newDeath] => +1 893 | [totalRecovered] => 29 894 | [seriousUser] => 1,454 895 | ) 896 | 897 | [67] => Array 898 | ( 899 | [name] => romania 900 | [totalCase] => 1,452 901 | [newCase] => +160 902 | [totalDeath] => 37 903 | [newDeath] => +11 904 | [totalRecovered] => 139 905 | [seriousUser] => 1,276 906 | ) 907 | 908 | [68] => Array 909 | ( 910 | [name] => thailand 911 | [totalCase] => 1,245 912 | [newCase] => +109 913 | [totalDeath] => 6 914 | [newDeath] => +1 915 | [totalRecovered] => 97 916 | [seriousUser] => 1,142 917 | ) 918 | 919 | [69] => Array 920 | ( 921 | [name] => saudi arabia 922 | [totalCase] => 1,203 923 | [newCase] => +99 924 | [totalDeath] => 4 925 | [newDeath] => +1 926 | [totalRecovered] => 37 927 | [seriousUser] => 1,162 928 | ) 929 | 930 | [70] => Array 931 | ( 932 | [name] => finland 933 | [totalCase] => 1,167 934 | [newCase] => +126 935 | [totalDeath] => 9 936 | [newDeath] => +2 937 | [totalRecovered] => 10 938 | [seriousUser] => 1,148 939 | ) 940 | 941 | [71] => Array 942 | ( 943 | [name] => indonesia 944 | [totalCase] => 1,155 945 | [newCase] => +109 946 | [totalDeath] => 102 947 | [newDeath] => +15 948 | [totalRecovered] => 59 949 | [seriousUser] => 994 950 | ) 951 | 952 | [72] => Array 953 | ( 954 | [name] => philippines 955 | [totalCase] => 1,075 956 | [newCase] => +272 957 | [totalDeath] => 68 958 | [newDeath] => +14 959 | [totalRecovered] => 35 960 | [seriousUser] => 972 961 | ) 962 | 963 | [73] => Array 964 | ( 965 | [name] => greece 966 | [totalCase] => 1,061 967 | [newCase] => +95 968 | [totalDeath] => 32 969 | [newDeath] => +4 970 | [totalRecovered] => 52 971 | [seriousUser] => 977 972 | ) 973 | 974 | [74] => Array 975 | ( 976 | [name] => india 977 | [totalCase] => 987 978 | [newCase] => +100 979 | [totalDeath] => 24 980 | [newDeath] => +4 981 | [totalRecovered] => 84 982 | [seriousUser] => 879 983 | ) 984 | 985 | [75] => Array 986 | ( 987 | [name] => panama 988 | [totalCase] => 901 989 | [newCase] => +115 990 | [totalDeath] => 17 991 | [newDeath] => +3 992 | [totalRecovered] => 4 993 | [seriousUser] => 880 994 | ) 995 | 996 | [76] => Array 997 | ( 998 | [name] => argentina 999 | [totalCase] => 745 1000 | [newCase] => +156 1001 | [totalDeath] => 19 1002 | [newDeath] => +6 1003 | [totalRecovered] => 72 1004 | [seriousUser] => 654 1005 | ) 1006 | 1007 | [77] => Array 1008 | ( 1009 | [name] => dominican republic 1010 | [totalCase] => 719 1011 | [newCase] => +138 1012 | [totalDeath] => 28 1013 | [newDeath] => +8 1014 | [totalRecovered] => 3 1015 | [seriousUser] => 688 1016 | ) 1017 | 1018 | [78] => Array 1019 | ( 1020 | [name] => mexico 1021 | [totalCase] => 717 1022 | [newCase] => +132 1023 | [totalDeath] => 12 1024 | [newDeath] => +4 1025 | [totalRecovered] => 4 1026 | [seriousUser] => 701 1027 | ) 1028 | 1029 | [79] => Array 1030 | ( 1031 | [name] => peru 1032 | [totalCase] => 671 1033 | [newCase] => +36 1034 | [totalDeath] => 16 1035 | [newDeath] => +5 1036 | [totalRecovered] => 16 1037 | [seriousUser] => 639 1038 | ) 1039 | 1040 | [80] => Array 1041 | ( 1042 | [name] => serbia 1043 | [totalCase] => 659 1044 | [newCase] => +131 1045 | [totalDeath] => 10 1046 | [newDeath] => +2 1047 | [totalRecovered] => 42 1048 | [seriousUser] => 607 1049 | ) 1050 | 1051 | [81] => Array 1052 | ( 1053 | [name] => croatia 1054 | [totalCase] => 657 1055 | [newCase] => +71 1056 | [totalDeath] => 5 1057 | [newDeath] => +2 1058 | [totalRecovered] => 45 1059 | [seriousUser] => 607 1060 | ) 1061 | 1062 | [82] => Array 1063 | ( 1064 | [name] => qatar 1065 | [totalCase] => 590 1066 | [newCase] => +28 1067 | [totalDeath] => 1 1068 | [newDeath] => +1 1069 | [totalRecovered] => 45 1070 | [seriousUser] => 544 1071 | ) 1072 | 1073 | [83] => Array 1074 | ( 1075 | [name] => egypt 1076 | [totalCase] => 576 1077 | [newCase] => +40 1078 | [totalDeath] => 36 1079 | [newDeath] => +6 1080 | [totalRecovered] => 121 1081 | [seriousUser] => 419 1082 | ) 1083 | 1084 | [84] => Array 1085 | ( 1086 | [name] => new zealand 1087 | [totalCase] => 514 1088 | [newCase] => +146 1089 | [totalDeath] => 1 1090 | [newDeath] => +1 1091 | [totalRecovered] => 56 1092 | [seriousUser] => 457 1093 | ) 1094 | 1095 | [85] => Array 1096 | ( 1097 | [name] => iraq 1098 | [totalCase] => 506 1099 | [newCase] => +48 1100 | [totalDeath] => 42 1101 | [newDeath] => +2 1102 | [totalRecovered] => 131 1103 | [seriousUser] => 333 1104 | ) 1105 | 1106 | [86] => Array 1107 | ( 1108 | [name] => algeria 1109 | [totalCase] => 454 1110 | [newCase] => +45 1111 | [totalDeath] => 29 1112 | [newDeath] => +3 1113 | [totalRecovered] => 31 1114 | [seriousUser] => 394 1115 | ) 1116 | 1117 | [87] => Array 1118 | ( 1119 | [name] => morocco 1120 | [totalCase] => 402 1121 | [newCase] => +57 1122 | [totalDeath] => 25 1123 | [newDeath] => +2 1124 | [totalRecovered] => 12 1125 | [seriousUser] => 365 1126 | ) 1127 | 1128 | [88] => Array 1129 | ( 1130 | [name] => lithuania 1131 | [totalCase] => 394 1132 | [newCase] => +36 1133 | [totalDeath] => 7 1134 | [newDeath] => +2 1135 | [totalRecovered] => 1 1136 | [seriousUser] => 386 1137 | ) 1138 | 1139 | [89] => Array 1140 | ( 1141 | [name] => ukraine 1142 | [totalCase] => 356 1143 | [newCase] => +46 1144 | [totalDeath] => 9 1145 | [newDeath] => +4 1146 | [totalRecovered] => 5 1147 | [seriousUser] => 342 1148 | ) 1149 | 1150 | [90] => Array 1151 | ( 1152 | [name] => hungary 1153 | [totalCase] => 343 1154 | [newCase] => +43 1155 | [totalDeath] => 11 1156 | [newDeath] => +1 1157 | [totalRecovered] => 34 1158 | [seriousUser] => 298 1159 | ) 1160 | 1161 | [91] => Array 1162 | ( 1163 | [name] => bulgaria 1164 | [totalCase] => 331 1165 | [newCase] => +38 1166 | [totalDeath] => 7 1167 | [newDeath] => +4 1168 | [totalRecovered] => 11 1169 | [seriousUser] => 313 1170 | ) 1171 | 1172 | [92] => Array 1173 | ( 1174 | [name] => tunisia 1175 | [totalCase] => 278 1176 | [newCase] => +51 1177 | [totalDeath] => 8 1178 | [newDeath] => +1 1179 | [totalRecovered] => 2 1180 | [seriousUser] => 268 1181 | ) 1182 | 1183 | [93] => Array 1184 | ( 1185 | [name] => bosnia and herzegovina 1186 | [totalCase] => 278 1187 | [newCase] => +41 1188 | [totalDeath] => 6 1189 | [newDeath] => +2 1190 | [totalRecovered] => 8 1191 | [seriousUser] => 264 1192 | ) 1193 | 1194 | [94] => Array 1195 | ( 1196 | [name] => north macedonia 1197 | [totalCase] => 241 1198 | [newCase] => +22 1199 | [totalDeath] => 4 1200 | [newDeath] => +1 1201 | [totalRecovered] => 3 1202 | [seriousUser] => 234 1203 | ) 1204 | 1205 | [95] => Array 1206 | ( 1207 | [name] => san marino 1208 | [totalCase] => 224 1209 | [newCase] => +1 1210 | [totalDeath] => 22 1211 | [newDeath] => +1 1212 | [totalRecovered] => 6 1213 | [seriousUser] => 196 1214 | ) 1215 | 1216 | [96] => Array 1217 | ( 1218 | [name] => burkina faso 1219 | [totalCase] => 207 1220 | [newCase] => +27 1221 | [totalDeath] => 11 1222 | [newDeath] => +2 1223 | [totalRecovered] => 21 1224 | [seriousUser] => 175 1225 | ) 1226 | 1227 | [97] => Array 1228 | ( 1229 | [name] => albania 1230 | [totalCase] => 197 1231 | [newCase] => +11 1232 | [totalDeath] => 10 1233 | [newDeath] => +2 1234 | [totalRecovered] => 31 1235 | [seriousUser] => 156 1236 | ) 1237 | 1238 | [98] => Array 1239 | ( 1240 | [name] => azerbaijan 1241 | [totalCase] => 182 1242 | [newCase] => +17 1243 | [totalDeath] => 4 1244 | [newDeath] => +1 1245 | [totalRecovered] => 15 1246 | [seriousUser] => 163 1247 | ) 1248 | 1249 | [99] => Array 1250 | ( 1251 | [name] => ghana 1252 | [totalCase] => 141 1253 | [newCase] => +4 1254 | [totalDeath] => 5 1255 | [newDeath] => +1 1256 | [totalRecovered] => 2 1257 | [seriousUser] => 134 1258 | ) 1259 | 1260 | [100] => Array 1261 | ( 1262 | [name] => brunei 1263 | [totalCase] => 120 1264 | [newCase] => +5 1265 | [totalDeath] => 1 1266 | [newDeath] => +1 1267 | [totalRecovered] => 25 1268 | [seriousUser] => 94 1269 | ) 1270 | 1271 | [101] => Array 1272 | ( 1273 | [name] => cuba 1274 | [totalCase] => 119 1275 | [newCase] => +39 1276 | [totalDeath] => 3 1277 | [newDeath] => +1 1278 | [totalRecovered] => 4 1279 | [seriousUser] => 112 1280 | ) 1281 | 1282 | [102] => Array 1283 | ( 1284 | [name] => sri lanka 1285 | [totalCase] => 113 1286 | [newCase] => +7 1287 | [totalDeath] => 1 1288 | [newDeath] => +1 1289 | [totalRecovered] => 9 1290 | [seriousUser] => 103 1291 | ) 1292 | 1293 | [103] => Array 1294 | ( 1295 | [name] => uzbekistan 1296 | [totalCase] => 104 1297 | [newCase] => +16 1298 | [totalDeath] => 2 1299 | [newDeath] => +1 1300 | [totalRecovered] => 5 1301 | [seriousUser] => 97 1302 | ) 1303 | 1304 | [104] => Array 1305 | ( 1306 | [name] => guadeloupe 1307 | [totalCase] => 102 1308 | [newCase] => +29 1309 | [totalDeath] => 2 1310 | [newDeath] => +1 1311 | [totalRecovered] => 17 1312 | [seriousUser] => 83 1313 | ) 1314 | 1315 | [105] => Array 1316 | ( 1317 | [name] => trinidad and tobago 1318 | [totalCase] => 76 1319 | [newCase] => +10 1320 | [totalDeath] => 3 1321 | [newDeath] => +1 1322 | [totalRecovered] => 1 1323 | [seriousUser] => 72 1324 | ) 1325 | 1326 | [106] => Array 1327 | ( 1328 | [name] => drc 1329 | [totalCase] => 65 1330 | [newCase] => +14 1331 | [totalDeath] => 6 1332 | [newDeath] => +3 1333 | [totalRecovered] => 2 1334 | [seriousUser] => 57 1335 | ) 1336 | 1337 | [107] => Array 1338 | ( 1339 | [name] => monaco 1340 | [totalCase] => 43 1341 | [newCase] => +1 1342 | [totalDeath] => 1 1343 | [newDeath] => +1 1344 | [totalRecovered] => 1 1345 | [seriousUser] => 41 1346 | ) 1347 | 1348 | ) 1349 | ``` 1350 | 1351 | ---------- 1352 | 1353 | # COVID-19 CORONAVIRUS OUTBREAK 1354 | 1355 | # Corona Virus Outbreak API 1356 | 1357 | A tiny and small program to crawler and analyze outbreak of COVID-19 in world and every country using PHP. 1358 | 1359 | ## Confirmed Cases and Deaths by Country, Territory, or Conveyance 1360 | 1361 | The novel coronavirus COVID-19 is affecting 45 countries and territories around the world and 1 international conveyance (the "Diamond Princess" cruise ship harbored in Yokohama, Japan). 1362 | 1363 | The bulk of China's new cases and deaths are reported after 22:00 GMT (5:00 PM ET) for Hubei (lately with delays of up to 2 hours), and after 00:00 GMT (7:00 PM ET) for the rest of China (lately with delays of up to 9 hours). 1364 | 1365 | --------- 1366 | 1367 | # Max Base 1368 | 1369 | My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. ([Max Base](https://maxbase.org/)) 1370 | 1371 | ## Asrez Team 1372 | 1373 | A team includes some programmer, developer, designer, researcher(s) especially Max Base. 1374 | 1375 | [Asrez Team](https://www.asrez.com/) 1376 | -------------------------------------------------------------------------------- /corona.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.0.1 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Feb 27, 2020 at 03:27 PM 7 | -- Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 8 | -- PHP Version: 7.4.3 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET AUTOCOMMIT = 0; 12 | START TRANSACTION; 13 | SET time_zone = "+00:00"; 14 | 15 | 16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 | /*!40101 SET NAMES utf8mb4 */; 20 | 21 | -- 22 | -- Database: `corona` 23 | -- 24 | 25 | -- -------------------------------------------------------- 26 | 27 | -- 28 | -- Table structure for table `country` 29 | -- 30 | 31 | CREATE TABLE `country` ( 32 | `id` bigint(50) NOT NULL, 33 | `name` varchar(50) NOT NULL, 34 | `totalCase` int(11) NOT NULL, 35 | `newCase` int(11) NOT NULL, 36 | `totalDeath` int(11) NOT NULL, 37 | `newDeath` int(11) NOT NULL, 38 | `totalRecovered` int(11) NOT NULL, 39 | `seriousUser` int(11) NOT NULL, 40 | `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 41 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 42 | 43 | -- 44 | -- Dumping data for table `country` 45 | -- 46 | 47 | 48 | -- -------------------------------------------------------- 49 | 50 | -- 51 | -- Table structure for table `token` 52 | -- 53 | 54 | CREATE TABLE `token` ( 55 | `id` bigint(50) NOT NULL, 56 | `token` varchar(100) NOT NULL, 57 | `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 58 | `canView` bit(1) NOT NULL DEFAULT b'1', 59 | `canFilter` bit(1) NOT NULL DEFAULT b'1', 60 | `canSearch` bit(1) NOT NULL DEFAULT b'1', 61 | `getAccess` bit(1) NOT NULL DEFAULT b'0', 62 | `postAccess` bit(1) NOT NULL DEFAULT b'1', 63 | `tokenInHeader` bit(1) NOT NULL DEFAULT b'1', 64 | `canTotal` bit(1) NOT NULL DEFAULT b'1' 65 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 66 | 67 | -- 68 | -- Dumping data for table `token` 69 | -- 70 | 71 | -- 72 | -- Indexes for dumped tables 73 | -- 74 | 75 | -- 76 | -- Indexes for table `country` 77 | -- 78 | ALTER TABLE `country` 79 | ADD PRIMARY KEY (`id`); 80 | 81 | -- 82 | -- Indexes for table `token` 83 | -- 84 | ALTER TABLE `token` 85 | ADD PRIMARY KEY (`id`); 86 | 87 | -- 88 | -- AUTO_INCREMENT for dumped tables 89 | -- 90 | 91 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 92 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 93 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 94 | -------------------------------------------------------------------------------- /output.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.0.1 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Feb 27, 2020 at 03:27 PM 7 | -- Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 8 | -- PHP Version: 7.4.3 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET AUTOCOMMIT = 0; 12 | START TRANSACTION; 13 | SET time_zone = "+00:00"; 14 | 15 | 16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 | /*!40101 SET NAMES utf8mb4 */; 20 | 21 | -- 22 | -- Database: `corona` 23 | -- 24 | 25 | -- -------------------------------------------------------- 26 | 27 | -- 28 | -- Table structure for table `country` 29 | -- 30 | 31 | CREATE TABLE `country` ( 32 | `id` bigint(50) NOT NULL, 33 | `name` varchar(50) NOT NULL, 34 | `totalCase` int(11) NOT NULL, 35 | `newCase` int(11) NOT NULL, 36 | `totalDeath` int(11) NOT NULL, 37 | `newDeath` int(11) NOT NULL, 38 | `totalRecovered` int(11) NOT NULL, 39 | `seriousUser` int(11) NOT NULL, 40 | `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 41 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 42 | 43 | -- 44 | -- Dumping data for table `country` 45 | -- 46 | 47 | INSERT INTO `country` (`id`, `name`, `totalCase`, `newCase`, `totalDeath`, `newDeath`, `totalRecovered`, `seriousUser`, `datetime`) VALUES 48 | (1, 'china', 78514, 450, 2747, 32, 32954, 8346, '2020-02-27 14:35:03'), 49 | (2, 's. korea', 1766, 505, 13, 1, 24, 18, '2020-02-27 14:35:05'), 50 | (3, 'diamond princess', 705, 0, 4, 0, 10, 36, '2020-02-27 12:35:56'), 51 | (4, 'italy', 528, 58, 14, 2, 42, 35, '2020-02-27 14:35:05'), 52 | (5, 'iran', 245, 106, 26, 7, 25, 0, '2020-02-27 12:35:56'), 53 | (6, 'japan', 207, 35, 4, 1, 32, 13, '2020-02-27 12:35:56'), 54 | (7, 'singapore', 96, 3, 0, 0, 66, 7, '2020-02-27 14:35:06'), 55 | (8, 'hong kong', 92, 3, 2, 0, 18, 6, '2020-02-27 12:35:56'), 56 | (9, 'usa', 60, 0, 0, 0, 6, 0, '2020-02-27 12:35:57'), 57 | (10, 'kuwait', 43, 17, 0, 0, 0, 0, '2020-02-27 12:35:57'), 58 | (11, 'thailand', 40, 0, 0, 0, 22, 2, '2020-02-27 12:35:57'), 59 | (12, 'bahrain', 33, 0, 0, 0, 0, 0, '2020-02-27 12:35:57'), 60 | (13, 'taiwan', 32, 0, 1, 0, 5, 1, '2020-02-27 12:35:57'), 61 | (14, 'germany', 27, 0, 0, 0, 15, 2, '2020-02-27 12:35:57'), 62 | (15, 'australia', 23, 0, 0, 0, 15, 0, '2020-02-27 12:35:57'), 63 | (16, 'malaysia', 22, 0, 0, 0, 20, 0, '2020-02-27 12:35:57'), 64 | (17, 'france', 18, 0, 2, 0, 11, 1, '2020-02-27 12:35:57'), 65 | (18, 'vietnam', 16, 0, 0, 0, 16, 0, '2020-02-27 12:35:58'), 66 | (19, 'spain', 15, 2, 0, 0, 2, 2, '2020-02-27 12:35:58'), 67 | (20, 'u.k.', 15, 2, 0, 0, 8, 0, '2020-02-27 12:35:58'), 68 | (21, 'u.a.e.', 13, 0, 0, 0, 3, 2, '2020-02-27 12:35:58'), 69 | (22, 'canada', 12, 0, 0, 0, 3, 0, '2020-02-27 12:35:58'), 70 | (23, 'macao', 10, 0, 0, 0, 6, 0, '2020-02-27 12:35:59'), 71 | (24, 'iraq', 6, 1, 0, 0, 0, 0, '2020-02-27 12:35:59'), 72 | (25, 'oman', 4, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 73 | (26, 'switzerland', 4, 3, 0, 0, 0, 0, '2020-02-27 12:35:59'), 74 | (27, 'philippines', 3, 0, 1, 0, 2, 0, '2020-02-27 12:35:59'), 75 | (28, 'austria', 3, 1, 0, 0, 0, 0, '2020-02-27 12:35:59'), 76 | (29, 'croatia', 3, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 77 | (30, 'greece', 3, 2, 0, 0, 0, 0, '2020-02-27 12:35:59'), 78 | (31, 'india', 3, 0, 0, 0, 3, 0, '2020-02-27 12:35:59'), 79 | (32, 'israel', 3, 1, 0, 0, 0, 0, '2020-02-27 12:35:59'), 80 | (33, 'finland', 2, 0, 0, 0, 1, 0, '2020-02-27 12:35:59'), 81 | (34, 'lebanon', 2, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 82 | (35, 'pakistan', 2, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 83 | (36, 'russia', 2, 0, 0, 0, 2, 0, '2020-02-27 12:35:59'), 84 | (37, 'sweden', 2, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 85 | (38, 'afghanistan', 1, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 86 | (39, 'algeria', 1, 0, 0, 0, 0, 0, '2020-02-27 12:35:59'), 87 | (40, 'belgium', 1, 0, 0, 0, 1, 0, '2020-02-27 12:35:59'), 88 | (41, 'brazil', 1, 0, 0, 0, 0, 0, '2020-02-27 12:36:00'), 89 | (42, 'cambodia', 1, 0, 0, 0, 1, 0, '2020-02-27 12:36:00'), 90 | (43, 'denmark', 1, 1, 0, 0, 0, 0, '2020-02-27 12:36:00'), 91 | (44, 'egypt', 1, 0, 0, 0, 1, 0, '2020-02-27 12:36:00'), 92 | (45, 'estonia', 1, 1, 0, 0, 0, 0, '2020-02-27 12:36:00'), 93 | (46, 'georgia', 1, 0, 0, 0, 0, 0, '2020-02-27 12:36:00'), 94 | (47, 'north macedonia', 1, 0, 0, 0, 0, 0, '2020-02-27 12:36:00'), 95 | (48, 'nepal', 1, 0, 0, 0, 1, 0, '2020-02-27 12:36:00'), 96 | (49, 'norway', 1, 0, 0, 0, 0, 0, '2020-02-27 12:36:00'), 97 | (50, 'romania', 1, 0, 0, 0, 0, 0, '2020-02-27 12:36:00'), 98 | (51, 'sri lanka', 1, 0, 0, 0, 1, 0, '2020-02-27 12:36:00'), 99 | (52, 'china', 78514, 450, 2747, 32, 32954, 8346, '2020-02-27 14:22:39'), 100 | (53, 's. korea', 1766, 505, 13, 1, 24, 18, '2020-02-27 14:22:39'), 101 | (54, 'italy', 528, 58, 14, 2, 42, 35, '2020-02-27 14:22:39'), 102 | (55, 'singapore', 96, 3, 0, 0, 66, 7, '2020-02-27 14:22:39'); 103 | 104 | -- -------------------------------------------------------- 105 | 106 | -- 107 | -- Table structure for table `token` 108 | -- 109 | 110 | CREATE TABLE `token` ( 111 | `id` bigint(50) NOT NULL, 112 | `token` varchar(100) NOT NULL, 113 | `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 114 | `canView` bit(1) NOT NULL DEFAULT b'1', 115 | `canFilter` bit(1) NOT NULL DEFAULT b'1', 116 | `canSearch` bit(1) NOT NULL DEFAULT b'1', 117 | `getAccess` bit(1) NOT NULL DEFAULT b'0', 118 | `postAccess` bit(1) NOT NULL DEFAULT b'1', 119 | `tokenInHeader` bit(1) NOT NULL DEFAULT b'1', 120 | `canTotal` bit(1) NOT NULL DEFAULT b'1' 121 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 122 | 123 | -- 124 | -- Dumping data for table `token` 125 | -- 126 | 127 | INSERT INTO `token` (`id`, `token`, `datetime`, `canView`, `canFilter`, `canSearch`, `getAccess`, `postAccess`, `tokenInHeader`, `canTotal`) VALUES 128 | (1, 'd4f5g6df4gd5f6ge4r89rf48', '2020-02-27 12:55:05', b'1', b'1', b'1', b'1', b'1', b'1', b'1'); 129 | 130 | -- 131 | -- Indexes for dumped tables 132 | -- 133 | 134 | -- 135 | -- Indexes for table `country` 136 | -- 137 | ALTER TABLE `country` 138 | ADD PRIMARY KEY (`id`); 139 | 140 | -- 141 | -- Indexes for table `token` 142 | -- 143 | ALTER TABLE `token` 144 | ADD PRIMARY KEY (`id`); 145 | 146 | -- 147 | -- AUTO_INCREMENT for dumped tables 148 | -- 149 | 150 | -- 151 | -- AUTO_INCREMENT for table `country` 152 | -- 153 | ALTER TABLE `country` 154 | MODIFY `id` bigint(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=56; 155 | 156 | -- 157 | -- AUTO_INCREMENT for table `token` 158 | -- 159 | ALTER TABLE `token` 160 | MODIFY `id` bigint(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; 161 | COMMIT; 162 | 163 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 164 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 165 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 166 | -------------------------------------------------------------------------------- /src/_api.php: -------------------------------------------------------------------------------- 1 | $array) { 24 | if(!is_string($key)) { 25 | unset($matches[$key]);// To remove extra list, arrays! 26 | } 27 | else { 28 | // Why we do it? 29 | // we can remove below code if use this example in the regex query 30 | // e.g: (\s*|)(?[^\<]+)(\s*|) 31 | // But we did it as below 32 | // e.g: (?[^\<]+) 33 | foreach($matches[$key] as $i=>$value) { 34 | $matches[$key][$i]=trim($value); 35 | } 36 | } 37 | } 38 | return $matches; 39 | } 40 | return []; 41 | } 42 | 43 | function prepareData($matches) { 44 | if(!is_array($matches) || $matches == null) { 45 | return []; 46 | } 47 | $result=[]; 48 | foreach($matches["name"] as $i=>$name) { 49 | $totalCase=$matches["totalCase"][$i]; 50 | $newCase=$matches["newCase"][$i]; 51 | $totalDeath=$matches["totalDeath"][$i]; 52 | $newDeath=$matches["newDeath"][$i]; 53 | $totalRecovered=$matches["totalRecovered"][$i]; 54 | $seriousUser=$matches["seriousUser"][$i]; 55 | $result[]=[ 56 | "name"=>strtolower($name), 57 | "totalCase"=>$totalCase, 58 | "newCase"=>$newCase, 59 | "totalDeath"=>$totalDeath, 60 | "newDeath"=>$newDeath, 61 | "totalRecovered"=>$totalRecovered, 62 | "seriousUser"=>$seriousUser, 63 | ]; 64 | } 65 | return $result; 66 | } 67 | 68 | /* 69 | // $file=get("https://www.worldometers.info/coronavirus/"); 70 | // file_put_contents("page.html", $file); 71 | $file=get("page.html"); 72 | 73 | $matchs=parseData($file); 74 | $items=prepareData($matchs); 75 | ////////////////////////////////////////////////////////// 76 | // print_r($items); 77 | ////////////////////////////////////////////////////////// 78 | $CREATE_MD_TABLE=false; 79 | $CREATE_JSON=false; 80 | $CREATE_HTML=false; 81 | ////////////////////////////////////////////////////////// 82 | if($CREATE_MD_TABLE) { 83 | $table=""; 84 | $table.="| Name | Total Case | New Case | Total Death | New Death | Total Recovered | seriousUser\n"; 85 | $table.="| ---- | --------- | ------- | ---------- | -------- | -------------- | ---------- |\n"; 86 | foreach($items as $item) { 87 | // name, totalCase, newCase, totalDeath, newDeath, totalRecovered, seriousUser 88 | $table.="| ".$item["name"]." | ".$item["totalCase"]." | ".$item["newCase"]." | ".$item["totalDeath"]." | ".$item["newDeath"]." | ".$item["totalRecovered"]." | ".$item["seriousUser"]." |\n"; 89 | } 90 | $table.="\n"; 91 | file_put_contents("output.md", $table); 92 | } 93 | ////////////////////////////////////////////////////////// 94 | if($CREATE_JSON) { 95 | file_put_contents("output.json", json_encode($items)); 96 | } 97 | ////////////////////////////////////////////////////////// 98 | if($CREATE_HTML) { 99 | $html="\n\n\t\n\t\t\n\t\tCorona Virus Outbreak\n\t\n\t\n\t\t

Corona Virus Outbreak

\n\t\t\n"; 100 | // name, totalCase, newCase, totalDeath, newDeath, totalRecovered, seriousUser 101 | $html.="\t\t\t\n"; 102 | foreach($items as $item) { 103 | $html.="\t\t\t\n"; 104 | } 105 | $html.="\t\t
NameTotal CaseNew CaseTotal DeathNew DeathTotal RecoveredSerious User
".$item["name"]."".$item["totalCase"]."".$item["newCase"]."".$item["totalDeath"]."".$item["newDeath"]."".$item["totalRecovered"]."".$item["seriousUser"]."
\n\t\n\n"; 106 | file_put_contents("output.html", $html); 107 | } 108 | */ 109 | -------------------------------------------------------------------------------- /src/_cookies.txt: -------------------------------------------------------------------------------- 1 | # Netscape HTTP Cookie File 2 | # https://curl.haxx.se/docs/http-cookies.html 3 | # This file was generated by libcurl! Edit at your own risk. 4 | 5 | #HttpOnly_.worldometers.info TRUE / TRUE 1588078436 __cfduid da691fbd3848423db5fc8a5e8c661c6f61585486436 6 | www.worldometers.info FALSE / TRUE 1588078433 mobile_detect desktop 7 | -------------------------------------------------------------------------------- /src/_core.php: -------------------------------------------------------------------------------- 1 | connect("localhost", "root", "01"); 8 | $db->db="corona"; 9 | $db->create_database($db->db, false); 10 | function display($array) { 11 | header("Content-Type: application/json"); 12 | exit(json_encode($array)); 13 | } 14 | -------------------------------------------------------------------------------- /src/_netphp.php: -------------------------------------------------------------------------------- 1 | $line) { 25 | if($i === 0) 26 | $headers[$index]['http_code'] = $line; 27 | else { 28 | list($key,$value) = explode(': ',$line); 29 | $headers[$index][$key] = $value; 30 | } 31 | } 32 | } 33 | return $headers; 34 | } 35 | function post($url,$values,$headers=[],$reffer="",$auto_redirect=true) { 36 | global $debug,$debug_details; 37 | if($debug) { 38 | print "@Request[POST]----------------------------------------------\n"; 39 | print "----------@link ".$url."\n"; 40 | if($debug_details) { 41 | if($reffer!="") { 42 | print "----------@Reffer\n"; 43 | print $reffer; 44 | print "\n"; 45 | } 46 | if(count($values)!=0) { 47 | print "----------@Values\n"; 48 | print_r($values); 49 | } 50 | if(count($headers)!=0) { 51 | print "----------@Headers\n"; 52 | print_r($headers); 53 | } 54 | } 55 | } 56 | $curl = curl_init($url); 57 | if(is_array($headers)) { 58 | curl_setopt($curl,CURLOPT_HTTPHEADER,$headers); 59 | } 60 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,true); 61 | curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,true); 62 | curl_setopt($curl,CURLOPT_FOLLOWLOCATION,$auto_redirect); 63 | curl_setopt($curl,CURLOPT_HEADER,true); 64 | curl_setopt($curl,CURLOPT_VERBOSE,false); 65 | curl_setopt($curl,CURLOPT_POST,true); 66 | curl_setopt($curl,CURLOPT_POSTFIELDS,$values); 67 | curl_setopt($curl,CURLOPT_USERAGENT,useragent()); 68 | curl_setopt($curl,CURLOPT_COOKIEJAR,"_cookies.txt"); 69 | curl_setopt($curl,CURLOPT_COOKIEFILE,"_cookies.txt"); 70 | if($reffer != "") 71 | curl_setopt($curl,CURLOPT_REFERER,$curl); 72 | $response = curl_exec($curl); 73 | $header_size = curl_getinfo($curl,CURLINFO_HEADER_SIZE); 74 | $header = substr($response,0,$header_size); 75 | $body = substr($response,$header_size); 76 | $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); 77 | curl_close($curl); 78 | if($debug && $debug_details) { 79 | print "----------@Response Headers\n"; 80 | print_r($header); 81 | print "----------@Response Body\n"; 82 | print_r($body); 83 | print "\n"; 84 | } 85 | if($httpCode == 404) { 86 | return false; 87 | } 88 | return [$body,$header]; 89 | } 90 | function get($url,$headers=[],$reffer="",$auto_redirect=true) 91 | { 92 | global $debug,$debug_details; 93 | if($debug) { 94 | print "@Request[GET]----------------------------------------------\n"; 95 | print "----------@link ".$url."\n"; 96 | if($debug_details) { 97 | if($reffer!="") { 98 | print "----------@Reffer\n"; 99 | print $reffer; 100 | print "\n"; 101 | } 102 | if(count($headers)!=0) { 103 | print "----------@Headers\n"; 104 | print_r($headers); 105 | } 106 | } 107 | } 108 | $curl = curl_init($url); 109 | if(is_array($headers)) { 110 | curl_setopt($curl,CURLOPT_HTTPHEADER,$headers); 111 | } 112 | curl_setopt($curl,CURLOPT_RETURNTRANSFER,true); 113 | curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,true); 114 | curl_setopt($curl,CURLOPT_FOLLOWLOCATION,$auto_redirect); 115 | curl_setopt($curl,CURLOPT_HEADER,true); 116 | curl_setopt($curl,CURLOPT_VERBOSE,false); 117 | curl_setopt($curl,CURLOPT_POST,false); 118 | curl_setopt($curl,CURLOPT_USERAGENT,useragent()); 119 | curl_setopt($curl,CURLOPT_COOKIEJAR,"_cookies.txt"); 120 | curl_setopt($curl,CURLOPT_COOKIEFILE,"_cookies.txt"); 121 | if($reffer != "") 122 | curl_setopt($curl,CURLOPT_REFERER,$curl); 123 | $response = curl_exec($curl); 124 | $header_size = curl_getinfo($curl,CURLINFO_HEADER_SIZE); 125 | $header = substr($response,0,$header_size); 126 | $body = substr($response,$header_size); 127 | $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); 128 | curl_close($curl); 129 | if($debug && $debug_details) { 130 | print "----------@Response Headers\n"; 131 | print_r($header); 132 | print "----------@Response Body\n"; 133 | print_r($body); 134 | print "\n"; 135 | } 136 | if($httpCode == 404) { 137 | return false; 138 | } 139 | return [$body,$header]; 140 | } 141 | -------------------------------------------------------------------------------- /src/_phpedb.php: -------------------------------------------------------------------------------- 1 |

Error : ".$error."

"); 19 | } 20 | public function connect($host="localhost",$user="root",$pass="") 21 | { 22 | try 23 | { 24 | $this->database=new PDO("mysql:host=$host;",$user,$pass); 25 | $this->database->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); 26 | $this->database->query('SET NAMES '.'utf8mb4'); 27 | } 28 | catch(PDOException $e) 29 | { 30 | $this->database=null; 31 | $this->error_page($e->getMessage()); 32 | } 33 | } 34 | public function check() 35 | { 36 | if($this->database == null) 37 | { 38 | return false; 39 | } 40 | return true; 41 | } 42 | public function disconnect() 43 | { 44 | $this->database=null; 45 | } 46 | public function selectRaw($query) 47 | { 48 | try 49 | { 50 | $stmt = $this->database->prepare($query); 51 | $stmt->execute(); 52 | return $stmt->fetch(PDO::FETCH_ASSOC); 53 | } 54 | catch(PDOException $e) 55 | { 56 | $this->error_page($e->getMessage()); 57 | } 58 | } 59 | public function selectsRaw($query) 60 | { 61 | try 62 | { 63 | $stmt = $this->database->prepare($query); 64 | $stmt->execute(); 65 | return $stmt->fetchAll(PDO::FETCH_ASSOC); 66 | } 67 | catch(PDOException $e) 68 | { 69 | $this->error_page($e->getMessage()); 70 | } 71 | } 72 | public function query($query,$error=true) 73 | { 74 | try 75 | { 76 | $this->database->exec($query); 77 | } 78 | catch(PDOException $e) 79 | { 80 | if($error == true) 81 | { 82 | $this->error_page($e->getMessage()); 83 | } 84 | } 85 | } 86 | public function create_database($name,$error=true) 87 | { 88 | try 89 | { 90 | $this->query("CREATE DATABASE ".$name." CHARACTER Set utf8 COLLATE utf8_general_ci;",$error); 91 | } 92 | catch(PDOException $e) 93 | { 94 | if($error == true) 95 | { 96 | $this->error_page($e->getMessage()); 97 | } 98 | } 99 | } 100 | public function selects($table,$clause=[],$after="",$__sql="") 101 | { 102 | try 103 | { 104 | $sql = "SELECT * FROM `".$this->db."`.`".$table."` "; 105 | $current=0; 106 | $count=count($clause); 107 | if(count($clause) > 0) 108 | { 109 | $sql.=" WHERE "; 110 | foreach($clause as $name=>$value) 111 | { 112 | $operator="="; 113 | $do="and"; 114 | if(is_array($value)) 115 | { 116 | $operator=$value[0]; 117 | $do=$value[1]; 118 | $value=$value[2]; 119 | } 120 | $sql.=$name . " ". $operator ." ? "; 121 | if($current != $count-1) 122 | { 123 | $sql.=" ".$do." "; 124 | } 125 | $current++; 126 | } 127 | } 128 | $sql.=" ". $after." "; 129 | $sql.=";"; 130 | if(trim($__sql) !="") 131 | { 132 | $sql=$__sql; 133 | } 134 | // print $sql."\n"; 135 | $stmt = $this->database->prepare($sql); 136 | $current_all=1; 137 | if(count($clause) > 0) 138 | { 139 | foreach($clause as $name=>$value) 140 | { 141 | if(is_array($value)) 142 | { 143 | $value=$value[2]; 144 | } 145 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 146 | $current_all++; 147 | } 148 | } 149 | $stmt->execute(); 150 | //return $stmt->fetchAll(); 151 | return $stmt->fetchAll(PDO::FETCH_ASSOC); 152 | } 153 | catch(PDOException $e) 154 | { 155 | $this->error_page($e->getMessage()); 156 | } 157 | } 158 | public function select($table,$clause=[],$after="") 159 | { 160 | try 161 | { 162 | $sql = "SELECT * FROM `".$this->db."`.`".$table."` "; 163 | $current=0; 164 | $count=count($clause); 165 | if(count($clause) > 0) 166 | { 167 | $sql.=" WHERE "; 168 | foreach($clause as $name=>$value) 169 | { 170 | $operator="="; 171 | $do="and"; 172 | if(is_array($value)) 173 | { 174 | $operator=$value[0]; 175 | $do=$value[1]; 176 | $value=$value[2]; 177 | } 178 | $sql.=$name . " ". $operator ." ? "; 179 | if($current != $count-1) 180 | { 181 | $sql.=" ".$do." "; 182 | } 183 | $current++; 184 | } 185 | } 186 | $sql.=" ". $after." "; 187 | $sql.=";"; 188 | $stmt = $this->database->prepare($sql); 189 | $current_all=1; 190 | if(count($clause) > 0) 191 | { 192 | foreach($clause as $name=>$value) 193 | { 194 | if(is_array($value)) 195 | { 196 | $value=$value[2]; 197 | } 198 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 199 | $current_all++; 200 | } 201 | } 202 | $stmt->execute(); 203 | return $stmt->fetch(PDO::FETCH_ASSOC); 204 | } 205 | catch(PDOException $e) 206 | { 207 | $this->error_page($e->getMessage()); 208 | } 209 | } 210 | public function sum($table, $column, $clause=[]) { 211 | try 212 | { 213 | $sql = "select SUM(".$column.") FROM `".$this->db."`.`".$table."` "; 214 | $current=0; 215 | $count=count($clause); 216 | if(count($clause) > 0) 217 | { 218 | $sql.=" WHERE "; 219 | foreach($clause as $name=>$value) 220 | { 221 | $operator="="; 222 | $do="and"; 223 | if(is_array($value)) 224 | { 225 | $operator=$value[0]; 226 | $do=$value[1]; 227 | $value=$value[2]; 228 | } 229 | $sql.=$name . " ". $operator ." ? "; 230 | if($current != $count-1) 231 | { 232 | $sql.=" ".$do." "; 233 | } 234 | $current++; 235 | } 236 | } 237 | $sql.=";"; 238 | $stmt = $this->database->prepare($sql); 239 | $current_all=1; 240 | if(count($clause) > 0) 241 | { 242 | foreach($clause as $name=>$value) 243 | { 244 | if(is_array($value)) 245 | { 246 | $value=$value[2]; 247 | } 248 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 249 | $current_all++; 250 | } 251 | } 252 | $stmt->execute(); 253 | return $stmt->fetchColumn(0); 254 | } 255 | catch(PDOException $e) 256 | { 257 | $this->error_page($e->getMessage()); 258 | } 259 | } 260 | public function count($table,$clause=[]) 261 | { 262 | try 263 | { 264 | $sql = "select count(*) FROM `".$this->db."`.`".$table."` "; 265 | $current=0; 266 | $count=count($clause); 267 | if(count($clause) > 0) 268 | { 269 | $sql.=" WHERE "; 270 | foreach($clause as $name=>$value) 271 | { 272 | $operator="="; 273 | $do="and"; 274 | if(is_array($value)) 275 | { 276 | $operator=$value[0]; 277 | $do=$value[1]; 278 | $value=$value[2]; 279 | } 280 | $sql.=$name . " ". $operator ." ? "; 281 | if($current != $count-1) 282 | { 283 | $sql.=" ".$do." "; 284 | } 285 | $current++; 286 | } 287 | } 288 | $sql.=";"; 289 | $stmt = $this->database->prepare($sql); 290 | $current_all=1; 291 | if(count($clause) > 0) 292 | { 293 | foreach($clause as $name=>$value) 294 | { 295 | if(is_array($value)) 296 | { 297 | $value=$value[2]; 298 | } 299 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 300 | $current_all++; 301 | } 302 | } 303 | $stmt->execute(); 304 | return $stmt->fetchColumn(0); 305 | } 306 | catch(PDOException $e) 307 | { 308 | $this->error_page($e->getMessage()); 309 | } 310 | } 311 | public function delete($table,$clause=[]) 312 | { 313 | try 314 | { 315 | $sql = "DELETE FROM `".$this->db."`.`".$table."` "; 316 | $current=0; 317 | $count=count($clause); 318 | if(count($clause) > 0) 319 | { 320 | $sql.=" WHERE "; 321 | foreach($clause as $name=>$value) 322 | { 323 | $operator="="; 324 | $do="and"; 325 | if(is_array($value)) 326 | { 327 | $operator=$value[0]; 328 | $do=$value[1]; 329 | $value=$value[2]; 330 | } 331 | $sql.=$name . " ". $operator ." ? "; 332 | if($current != $count-1) 333 | { 334 | $sql.=" ".$do." "; 335 | } 336 | $current++; 337 | } 338 | } 339 | $sql.=";"; 340 | $stmt = $this->database->prepare($sql); 341 | $current_all=1; 342 | if(count($clause) > 0) 343 | { 344 | foreach($clause as $name=>$value) 345 | { 346 | if(is_array($value)) 347 | { 348 | $value=$value[2]; 349 | } 350 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 351 | $current_all++; 352 | } 353 | } 354 | $stmt->execute(); 355 | } 356 | catch(PDOException $e) 357 | { 358 | $this->error_page($e->getMessage()); 359 | } 360 | } 361 | public function insert($table,$values) 362 | { 363 | try 364 | { 365 | $sql = "INSERT INTO `".$this->db."`.`".$table."`("; 366 | $sql_values=""; 367 | $current=0; 368 | $count=count($values); 369 | if(count($values) > 0) 370 | { 371 | foreach($values as $name=>$value) 372 | { 373 | $sql.=$name; 374 | $sql_values.=" ? "; 375 | if($current != $count-1){$sql.=",";$sql_values.=",";} 376 | $current++; 377 | } 378 | } 379 | $sql.=") VALUES ("; 380 | $sql.=$sql_values; 381 | $sql.=");"; 382 | $stmt = $this->database->prepare($sql); 383 | $current_all=1; 384 | if(count($values) > 0) 385 | { 386 | foreach($values as $name=>$value) 387 | { 388 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 389 | $current_all++; 390 | } 391 | } 392 | $stmt->execute(); 393 | return $this->database->lastInsertId(); 394 | } 395 | catch(PDOException $e) 396 | { 397 | $this->error_page($e->getMessage()); 398 | } 399 | } 400 | public function update($table,$clause,$values) 401 | { 402 | try 403 | { 404 | $sql = "UPDATE `".$this->db."`.`".$table."` SET "; 405 | $current=0; 406 | $count=count($values); 407 | if(count($values) > 0) 408 | { 409 | foreach($values as $name=>$value) 410 | { 411 | $sql.=$name . " = " . " ? "; 412 | if($current != $count-1){$sql.=",";} 413 | $current++; 414 | } 415 | } 416 | $sql.=" "; 417 | $current=0; 418 | $count=count($clause); 419 | if(count($clause) > 0) 420 | { 421 | $sql.=" WHERE "; 422 | foreach($clause as $name=>$value) 423 | { 424 | $operator="="; 425 | $do="and"; 426 | if(is_array($value)) 427 | { 428 | $operator=$value[0]; 429 | $do=$value[1]; 430 | $value=$value[2]; 431 | } 432 | $sql.=$name . " ". $operator ." ? "; 433 | if($current != $count-1) 434 | { 435 | $sql.=" ".$do." "; 436 | } 437 | $current++; 438 | } 439 | } 440 | $sql.=";"; 441 | $stmt = $this->database->prepare($sql); 442 | $current_all=1; 443 | if(count($values) > 0) 444 | { 445 | foreach($values as $name=>$value) 446 | { 447 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 448 | $current_all++; 449 | } 450 | } 451 | if(count($clause) > 0) 452 | { 453 | foreach($clause as $name=>$value) 454 | { 455 | if(is_array($value)) 456 | { 457 | $value=$value[2]; 458 | } 459 | $stmt->bindValue($current_all,$value,PDO::PARAM_STR); 460 | $current_all++; 461 | } 462 | } 463 | $stmt->execute(); 464 | } 465 | catch(PDOException $e) 466 | { 467 | $this->error_page($e->getMessage()); 468 | } 469 | } 470 | } 471 | -------------------------------------------------------------------------------- /src/_test.php: -------------------------------------------------------------------------------- 1 | $item["name"], 22 | ]; 23 | // print_r($item); 24 | foreach($item as $i=>$v) { 25 | if($i != "name") { 26 | $item[$i]=str_replace(",", "", $item[$i]);// , 27 | $item[$i]=str_replace("+", "", $item[$i]);// + 28 | } 29 | } 30 | // print_r($item); 31 | $values=[ 32 | "name"=>$item["name"], 33 | "totalCase"=>$item["totalCase"], 34 | "newCase"=>$item["newCase"], 35 | "totalDeath"=>$item["totalDeath"], 36 | "newDeath"=>$item["newDeath"], 37 | "totalRecovered"=>$item["totalRecovered"], 38 | "seriousUser"=>$item["seriousUser"], 39 | ]; 40 | print_r($values); 41 | } 42 | } 43 | update(); 44 | -------------------------------------------------------------------------------- /src/_update.php: -------------------------------------------------------------------------------- 1 | /dev/null 2>&1` 7 | // Current time is: 2020-02-26 7:29:00 PM UTC 8 | // This cron job will be run at: (5 times displayed and more...) 9 | // 2020-02-26 20:00:00 UTC 10 | // 2020-02-26 20:01:00 UTC 11 | // 2020-02-26 20:02:00 UTC 12 | // 2020-02-26 20:03:00 UTC 13 | // 2020-02-26 20:04:00 UTC 14 | // ... 15 | function update() { 16 | global $db; 17 | global $tmpFileName; 18 | $file=get("https://www.worldometers.info/coronavirus/"); 19 | // print_r($file); 20 | $file=$file[0]; 21 | // file_put_contents is suitable for here, but we will use curl for other projects! 22 | // Sample library and project in this case: https://github.com/BaseMax/netphp 23 | file_put_contents($tmpFileName, $file); 24 | $matchs=parseData($file); 25 | $items=prepareData($matchs); 26 | print_r($items); 27 | foreach($items as $item) { 28 | // name, totalCase, newCase, totalDeath, newDeath, totalRecovered, seriousUser 29 | $clauses=[ 30 | "name"=>$item["name"], 31 | ]; 32 | // print_r($item); 33 | foreach($item as $i=>$v) { 34 | if($i != "name") { 35 | $item[$i]=str_replace(",", "", $item[$i]);// , 36 | $item[$i]=str_replace("+", "", $item[$i]);// + 37 | } 38 | } 39 | print_r($item); 40 | $values=[ 41 | "name"=>$item["name"], 42 | "totalCase"=>$item["totalCase"], 43 | "newCase"=>$item["newCase"], 44 | "totalDeath"=>$item["totalDeath"], 45 | "newDeath"=>$item["newDeath"], 46 | "totalRecovered"=>$item["totalRecovered"], 47 | "seriousUser"=>$item["seriousUser"], 48 | ]; 49 | if($db->count("country", $clauses) == 0) { 50 | $db->insert("country", $values); 51 | } 52 | else { 53 | if($db->count("country", $values) == 0) { 54 | // skip 55 | } 56 | else { 57 | print "Update...\n"; 58 | $db->update("country", $clauses, $values); 59 | } 60 | } 61 | } 62 | } 63 | if(isset($argv) and isset($argv[1]) and $argv[1] == "update") { 64 | print "Update...\n"; 65 | update(); 66 | } 67 | -------------------------------------------------------------------------------- /src/index.php: -------------------------------------------------------------------------------- 1 | $value) { 19 | if(substr($name, 0, 5) == "HTTP_") { 20 | $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value; 21 | } 22 | } 23 | return $headers; 24 | } 25 | } 26 | function preapreItems($items) { 27 | foreach($items as $i=>$array) { 28 | if(isset($array["id"])) { 29 | $array["id"]=(int) $array["id"]; 30 | } 31 | if(isset($array["totalCase"])) { 32 | $array["totalCase"]=(int) $array["totalCase"]; 33 | } 34 | if(isset($array["newCase"])) { 35 | $array["newCase"]=(int) $array["newCase"]; 36 | } 37 | if(isset($array["totalDeath"])) { 38 | $array["totalDeath"]=(int) $array["totalDeath"]; 39 | } 40 | if(isset($array["newDeath"])) { 41 | $array["newDeath"]=(int) $array["newDeath"]; 42 | } 43 | if(isset($array["totalRecovered"])) { 44 | $array["totalRecovered"]=(int) $array["totalRecovered"]; 45 | } 46 | if(isset($array["seriousUser"])) { 47 | $array["seriousUser"]=(int) $array["seriousUser"]; 48 | } 49 | $items[$i]=$array; 50 | } 51 | return $items; 52 | } 53 | function supportSort($table, $clauses, $data) { 54 | global $db; 55 | $items=[]; 56 | if(isset($data["sort"])) { 57 | $sort=$data["sort"]; 58 | $type="DESC"; 59 | if(isset($data["type"])) { 60 | $t=strtolower($data["type"]); 61 | if($t == "asc" || $t == "desc") { 62 | $type=$t; 63 | } 64 | else { 65 | display(["status"=>"failed", "message"=>"Sort type is not valid and not allowed!"]); 66 | } 67 | } 68 | $fields=["id","name","totalCase","newCase","totalDeath","newDeath","totalRecovered","seriousUser","datetime"]; 69 | if(in_array($sort, $fields)) { 70 | $items=$db->selects($table, $clauses, "ORDER BY `". $sort ."` ".$type); 71 | } 72 | else { 73 | display(["status"=>"failed", "message"=>"Sort field value is not valid and not allowed!"]); 74 | } 75 | } 76 | else { 77 | $items=$db->selects($table, $clauses); 78 | } 79 | return $items; 80 | } 81 | 82 | $headers=getallheaders(); 83 | if($headers != null && is_array($headers) and count($headers) > 0) { 84 | if(isset($headers["Token"])) { 85 | $token=$headers["Token"]; 86 | $tokenItem=$db->select("token", ["token"=>$token]); 87 | if($tokenItem == null) { 88 | display(["status"=>"failed", "message"=>"This token is not valid!"]); 89 | } 90 | else { 91 | if($tokenItem["getAccess"] == 0 and $tokenItem["postAccess"] == 0) { 92 | display(["status"=>"failed", "message"=>"You did not access to webservice using GET and POST method!"]); 93 | } 94 | else if($tokenItem["getAccess"] == 0 and $tokenItem["postAccess"] == 1) { 95 | $data=$_POST; 96 | } 97 | else if($tokenItem["getAccess"] == 1 and $tokenItem["postAccess"] == 0) { 98 | $data=$_GET; 99 | } 100 | else if($tokenItem["getAccess"] == 1 and $tokenItem["postAccess"] == 1) { 101 | $data=$_GET; 102 | foreach($_POST as $key=>$value) { 103 | $data[$key]=$value; 104 | } 105 | } 106 | if(isset($data["method"])) { 107 | $method=$data["method"]; 108 | if($method == "total") { 109 | if($tokenItem["canTotal"] == 1) { 110 | $all=$db->sum("country", "totalCase"); 111 | $died=$db->sum("country", "totalDeath"); 112 | $recov=$db->sum("country", "totalRecovered"); 113 | display(["status"=>"success", "message"=>"", "result"=>["all"=>$all, "died"=>$died, "recovered"=>$recov]]); 114 | } 115 | else { 116 | display(["status"=>"failed", "message"=>"Sorry, you did not have access to this method!"]); 117 | } 118 | } 119 | else if($method == "country") { 120 | if($tokenItem["canFilter"] == 1) { 121 | if(isset($data["query"])) { 122 | $items=$db->select("country", ["name"=>$data["query"]]); 123 | $items=preapreItems([$items]); 124 | if(isset($items[0]) and $items[0] != "") { 125 | $items=$items[0]; 126 | } 127 | else { 128 | $items=null; 129 | } 130 | display(["status"=>"success", "message"=>"", "result"=>$items]); 131 | } 132 | else { 133 | display(["status"=>"failed", "message"=>"Query value is not avaible!"]); 134 | } 135 | } 136 | else { 137 | display(["status"=>"failed", "message"=>"Sorry, you did not have access to this method!"]); 138 | } 139 | } 140 | else if($method == "search") { 141 | if($tokenItem["canSearch"] == 1) { 142 | if(isset($data["query"])) { 143 | // $items=$db->selects("country", ["name"=>["LIKE", "and", "%".$data["query"] . "%"]]); 144 | $items=supportSort("country", ["name"=>["LIKE", "and", "%".$data["query"] . "%"]], $data); 145 | $items=preapreItems($items); 146 | display(["status"=>"success", "message"=>"", "result"=>$items]); 147 | } 148 | else { 149 | display(["status"=>"failed", "message"=>"Query value is not avaible!"]); 150 | } 151 | } 152 | else { 153 | display(["status"=>"failed", "message"=>"Sorry, you did not have access to this method!"]); 154 | } 155 | } 156 | else if($method == "list") { 157 | if($tokenItem["canView"] == 1) { 158 | $lastTime=$db->select("country", [], "ORDER BY `datetime` DESC"); 159 | // $items=$db->selects("country"); 160 | $items=supportSort("country", [], $data); 161 | $items=preapreItems($items); 162 | display(["status"=>"success", "message"=>"", "lastUpdate"=>$lastTime["datetime"], "result"=>$items]); 163 | } 164 | else { 165 | display(["status"=>"failed", "message"=>"Sorry, you did not have access to this method!"]); 166 | } 167 | } 168 | else { 169 | display(["status"=>"failed", "message"=>"Method type is not valid!"]); 170 | } 171 | } 172 | else { 173 | display(["status"=>"failed", "message"=>"Every request in this webservice need a method type!"]); 174 | } 175 | } 176 | } 177 | else { 178 | display(["status"=>"failed", "message"=>"You did not have access to this webservice without token!"]); 179 | } 180 | } 181 | else { 182 | display(["status"=>"failed", "message"=>"You did not have access to this webservice!"]); 183 | } 184 | --------------------------------------------------------------------------------