Criminals Blue - Nieuw Project

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Voor de gene die de werkende clan bank en donate wil,

      Donate.php

      PHP Source Code

      1. <?php
      2. /*
      3. * This program is free software: you can redistribute it and/or modify
      4. * it under the terms of the GNU General Public License as published by
      5. * the Free Software Foundation, either version 3 of the License, or
      6. * (at your option) any later version.
      7. *
      8. * This program is distributed in the hope that it will be useful,
      9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
      10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      11. * GNU General Public License for more details.
      12. * You should have received a copy of the GNU General Public License
      13. * along with this program. If not, see <http://www.gnu.org/licenses/>.
      14. */
      15. require_once('../../init.php');
      16. // Check if user is loggedin, if not need to be here...
      17. if (LOGGEDIN == FALSE) { header('Location: ' . ROOT_URL . 'index.php'); }
      18. // Check if user is in an clan if not no need to be here...
      19. if ($userData['clan_id'] == 0) { header('Location: ' . ROOT_URL . 'ingame/clan/index.php'); }
      20. $error = array();
      21. $form_error = '';
      22. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
      23. if (!isset($_POST['amount']) OR empty($_POST['amount'])) {
      24. $error[] = 'Er is geen bedrag ingevuld!';
      25. }
      26. elseif (!is_numeric($_POST['amount'])) {
      27. $error[] = 'Het bedrag wat is ingegeven is niet numeriek!';
      28. }
      29. else {
      30. $result = $dbCon->query('SELECT cash FROM users WHERE id = "' . $userData['id'] . '"')->fetch_assoc();
      31. if ($_POST['amount'] > $result['cash']) {
      32. $error[] = 'Het ingegeven bedrag heb je niet in cash!';
      33. }
      34. }
      35. if (count($error) > 0) {
      36. foreach ($error as $item) {
      37. $form_error .= '- ' . $item . '<br />';
      38. }
      39. $tpl->assign('form_error', $form_error);
      40. } else {
      41. // User can donate
      42. $dbCon->query('UPDATE users SET cash = (cash - "' . (int) addslashes($_POST['amount']) . '") WHERE id = "' . $userData['id'] . '"');
      43. $dbCon->query('UPDATE clans SET cash = (cash + "' . (int) addslashes($_POST['amount']) . '") WHERE clan_id = "' . $userData['clan_id'] . '"');
      44. $tpl->assign('success', 'Je hebt succesvol gedoneerd naar je clan!');
      45. }
      46. }
      47. $tpl->display('clan/donate.tpl');
      Display All

      Bank.php

      PHP Source Code

      1. <?php
      2. /*
      3. * This program is free software: you can redistribute it and/or modify
      4. * it under the terms of the GNU General Public License as published by
      5. * the Free Software Foundation, either version 3 of the License, or
      6. * (at your option) any later version.
      7. *
      8. * This program is distributed in the hope that it will be useful,
      9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
      10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      11. * GNU General Public License for more details.
      12. * You should have received a copy of the GNU General Public License
      13. * along with this program. If not, see <http://www.gnu.org/licenses/>.
      14. */
      15. require_once('../../init.php');
      16. $error = array();
      17. $form_error = '';
      18. // Check if user is loggedin, if not need to be here...
      19. if (LOGGEDIN == FALSE) { header('Location: ' . ROOT_URL . 'index.php'); }
      20. // Check if user is in an clan if not no need to be here...
      21. if ($userData['clan_id'] == 0) { header('Location: ' . ROOT_URL . 'ingame/clan/index.php'); }
      22. // Check if user has clan access to this page, if not no need to be here..
      23. if ($userData['clan_level'] < 6) { header('Location: ' . ROOT_URL . 'ingame/clan/index.php'); }
      24. // Check if user has submitted the form
      25. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
      26. // Check if money is enterd and if it is valid
      27. if (!isset($_POST['amount']) OR empty($_POST['amount'])) {
      28. $error[] = 'Er is geen bedrag ingevuld!';
      29. }
      30. elseif (!is_numeric($_POST['amount'])) {
      31. $error[] = 'Het bedrag wat is ingegeven is niet numeriek!';
      32. } else {
      33. // Check if the clan got enough money to deposit / withdraw
      34. $result = $dbCon->query('SELECT cash,bank,bankleft FROM clans WHERE clan_id = "' . $userData['clan_id'] . '"')->fetch_assoc();
      35. // Clan member wants to deposit money
      36. if (isset($_POST['deposit'])) {
      37. if ($_POST['amount'] > $result['cash']) {
      38. $error[] = 'Zoveel heef de clan niet in cash!';
      39. }
      40. // Check if clan hasnt deposit enough times for one day
      41. if ($result['bankleft'] < 1) {
      42. $error[] = 'Je kan vandaag geen stortingen meer naar de clan bank doen!';
      43. }
      44. }
      45. // Clan member wants to withdraw money
      46. else {
      47. if ($_POST['amount'] > $result['bank']) {
      48. $error[] = 'Zoveel heef de clan niet op de bank staan!';
      49. }
      50. }
      51. }
      52. // Check for errors and show them if there are any
      53. if (count($error) > 0) {
      54. foreach ($error as $item) {
      55. $form_error .= '- ' . $item . '<br />';
      56. }
      57. $tpl->assign('form_error', $form_error);
      58. } else {
      59. // Clan member may deposit / withdraw
      60. if (isset($_POST['deposit'])) {
      61. // Clan member is going to deposit money
      62. $dbCon->query('UPDATE clans SET cash = (cash - "' . (int) addslashes($_POST['amount']) . '"),
      63. bank = (bank + "' . (int) addslashes($_POST['amount']) . '")
      64. WHERE clan_id = "' . $userData['clan_id'] . '" ');
      65. $tpl->assign('success', 'Je hebt succesvol geld op de clan bank gezet!');
      66. } else {
      67. // Clan member is going to withdraw money
      68. $dbCon->query('UPDATE clans SET cash = (cash + "' . (int) addslashes($_POST['amount']) . '"),
      69. bank = (bank - "' . (int) addslashes($_POST['amount']) . '")
      70. WHERE clan_id = "' . $userData['clan_id'] . '" ');
      71. $tpl->assign('success', 'Je hebt succesvol geld van de clan bank gehaald!');
      72. }
      73. }
      74. }
      75. // Give general information
      76. $result = $dbCon->query('SELECT cash,bank,bankleft FROM clans WHERE clan_id = "' . $userData['clan_id'] . '"')->fetch_assoc();
      77. $tpl->assign('cash', $result['cash']);
      78. $tpl->assign('bank', $result['bank']);
      79. $tpl->assign('bankleft', $result1['bankleft']);
      80. // Display page
      81. $tpl->display('clan/bank.tpl');
      Display All