Demo

Probiere ClanSphere aus und teste daran herum. Demo

Nopaste Service - edit.php
pdsteff

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$

$cs_lang = cs_translate('cash');
$cs_post = cs_post('id');
$cs_get = cs_get('id');
$data = array();

$cash_id = empty($cs_get['id']) ? 0 : $cs_get['id'];
if (!empty($cs_post['id']))  $cash_id = $cs_post['id'];

if(isset($_POST['submit'])) {
  
  $cs_cash['cash_inout'] = $_POST['cash_inout'];
  $cs_cash['cash_money'] = $_POST['cash_money'];
  $cs_cash['cash_text'] = $_POST['cash_text'];
  $cs_cash['cash_info'] = $_POST['cash_info'];
  $cs_cash['cash_time'] = cs_datepost('datum','date');
  $users_nick = empty($_REQUEST['users_nick']) ? '' : $_REQUEST['users_nick'];

  $error = '';

  $where = "users_nick = '" . cs_sql_escape($users_nick) . "'";
  $users_data = cs_sql_select(__FILE__, 'users', 'users_id', $where);
  if(empty($users_data['users_id'])) {
    $error .= $cs_lang['no_user'] . cs_html_br(1);
    $cs_cash['users_id'] = 0;
  }
  else
    $cs_cash['users_id'] = $users_data['users_id'];
  
  if(empty($cs_cash['cash_inout'])) {
    $error .= $cs_lang['no_inout'] . cs_html_br(1);
  }
  if(empty($cs_cash['cash_money'])) {
    $error .= $cs_lang['no_money'] . cs_html_br(1);
  }
  if(empty($cs_cash['cash_text'])) {
    $error .= $cs_lang['no_text'] . cs_html_br(1);
  }
  if(empty($cs_cash['cash_time'])) {
    $error .= $cs_lang['no_date'] . cs_html_br(1);
  }
  
}
else {

  $select = 'cash_id, cash_inout, cash_money, cash_time, cash_text, cash_info, users_id';
  $cs_cash = cs_sql_select(__FILE__,'cash',$select,"cash_id = '" . $cash_id . "'");
  
}

if(!isset($_POST['submit']) AND empty($error)) {
  $data['head']['body'] = $cs_lang['body_info'];
} elseif (!empty($error)) {
  $data['head']['body'] = $error;
}

if(!empty($error) OR !isset($_POST['submit'])) {
  
  $data['cash'] = $cs_cash;
  $data['cash']['cash_money'] = cs_secure($data['cash']['cash_money'], 0, 0, 0);
  $data['cash']['cash_text'] = cs_secure($data['cash']['cash_text'], 0, 0, 0);
  $data['cash']['cash_info'] = cs_secure($data['cash']['cash_info'], 0, 0, 0);
  $inoutlist[0]['cash_inout'] = 'in';
  $inoutlist[0]['name'] = $cs_lang['drop_in'];
  $inoutlist[1]['cash_inout'] = 'out';
  $inoutlist[1]['name'] = $cs_lang['drop_out'];
  $data['cash']['inout_sel'] = cs_dropdown('cash_inout','name',$inoutlist,$cs_cash['cash_inout']);

  $data['cash']['date_sel'] = cs_dateselect('datum','date',$cs_cash['cash_time'],2000);

   $data['cash']['abcode_smileys'] = cs_abcode_smileys('cash_info');
   $data['cash']['abcode_features'] = cs_abcode_features('cash_info');

  $data['cash']['id'] = $cash_id;

  $cs_user = cs_sql_select(__FILE__,'users','users_nick',"users_id = '" . $cs_cash['users_id'] . "'");
  $data['cash']['users_sel'] = cs_user($cs_cash['users_id'], $cs_user['users_nick']);
  
  $data['users']['nick'] = empty($users_nick) ? $cs_user['users_nick'] : cs_secure($users_nick, 0, 0, 0);

  echo cs_subtemplate(__FILE__,$data,'cash','edit');
}
else {
  
  $cash_cells = array_keys($cs_cash);
  $cash_save = array_values($cs_cash);
  cs_sql_update(__FILE__,'cash',$cash_cells,$cash_save,$cash_id);

  cs_redirect($cs_lang['changes_done'],'cash');
}