Skip to content
Snippets Groups Projects
Commit c30bbd7b authored by Eric Laufer's avatar Eric Laufer
Browse files

Bug #39

Bug #39
parent 56c7da00
Branches
No related merge requests found
......@@ -4,6 +4,7 @@ class betreiber{
private $db;
private $error = 0;
private $meldung;
private $post = array();
public function __construct(){
global $datenbank;
......@@ -20,36 +21,42 @@ class betreiber{
public function post_pruef(){
global $_POST;
if(empty($_POST['name'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_NAME_FALSE;}
if(empty($_POST['betreiber_id']) OR !is_numeric($_POST['betreiber_id'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_BID_FALSE;}
if(empty($_POST['betreiber_passwort'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_BPW_FALSE;}
if(empty($_POST['schnittstelle'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_DATEI;}
if(empty($_POST['einzahltext'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_EINZAHLTEXT;}
if(empty($_POST['auszahltext'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_AUSZAHLTEXT;}
if($_POST['anfragen_tag'] != 0 AND (empty($_POST['anfragen_tag']) OR !is_numeric($_POST['anfragen_tag'])) ){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_ANFRAGEN_TAG;}
if($_POST['anfragen_user'] != 0 AND (empty($_POST['anfragen_user']) OR !is_numeric($_POST['anfragen_user'])) ){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_ANFRAGEN_USER;}
if(empty($_POST['waehrung_name'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_WNAME;}
if(empty($_POST['punktewert']) OR !is_numeric($_POST['punktewert'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_PUNKTEWERT;}
if(empty($_POST['wertepunkt']) OR !is_numeric($_POST['wertepunkt'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_WERTPUNKTE;}
if(isset($_POST['aktiv']) || $_POST['aktiv'] == 'on'){ $_POST['aktiv'] = 1;}else{ $_POST['aktiv'] = 0;}
if(isset($_POST['aktiv_ein']) || $_POST['aktiv_ein'] == 'on'){ $_POST['aktiv_ein'] = 1;}else{ $_POST['aktiv_ein'] = 0;}
if(isset($_POST['aktiv_aus']) || $_POST['aktiv_aus'] == 'on'){ $_POST['aktiv_aus'] = 1;}else{ $_POST['aktiv_aus'] = 0;}
if(empty($this->post['name'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_NAME_FALSE;}
if(empty($this->post['betreiber_id']) OR !is_numeric($this->post['betreiber_id'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_BID_FALSE;}
if(empty($this->post['betreiber_passwort'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_BPW_FALSE;}
if(empty($this->post['schnittstelle'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_DATEI;}
if(empty($this->post['einzahltext'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_EINZAHLTEXT;}
if(empty($this->post['auszahltext'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_AUSZAHLTEXT;}
if($this->post['anfragen_tag'] != 0 AND (empty($this->post['anfragen_tag']) OR !is_numeric($this->post['anfragen_tag'])) ){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_ANFRAGEN_TAG;}
if($this->post['anfragen_user'] != 0 AND (empty($this->post['anfragen_user']) OR !is_numeric($this->post['anfragen_user'])) ){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_ANFRAGEN_USER;}
if(empty($this->post['waehrung_name'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_WNAME;}
if(empty($this->post['punktewert']) OR !is_numeric($this->post['punktewert'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_PUNKTEWERT;}
if(empty($this->post['wertepunkt']) OR !is_numeric($this->post['wertepunkt'])){ $this->error = 1; $this->meldung .= POST_PRUEF_BETREIBERDATEN_WERTPUNKTE;}
if(isset($this->post['aktiv'])){
if($this->post['aktiv'] == 'on'){ $this->post['aktiv'] = 1;}else{ $this->post['aktiv'] = 0;}
}
if(isset($this->post['aktiv_ein'])){
if($this->post['aktiv_ein'] == 'on'){$this->post['aktiv_ein'] = 1;}else{ $this->post['aktiv_ein'] = 0;}
}
if(isset($this->post['aktiv_aus'])){
if($this->post['aktiv_aus'] == 'on'){ $this->post['aktiv_aus'] = 1;}else{ $this->post['aktiv_aus'] = 0;}
}
}
public function post_array($daten){
foreach($daten as $key => $value) {
if($key != '' AND $key != 'run'){
$array[$key] = $this->db->escape($value);
if($key != '' AND $key != 'run' && $value != ''){
$this->post[$this->db->escape($key)] = $this->db->escape($value);
}
}
return $array;
}
public function hinzufuegen(){
global $_POST;
$this->post_array($_POST);
$this->post_pruef();
if($this->error == 0){
$insert = $this->db->insert(PREFIX . SCHNITT , $this->post_array($_POST));
$insert = $this->db->insert(PREFIX . SCHNITT , $this->post);
if($insert == true){
$this->meldung = BETREIBERDATEN_SAVE_TRUE;
}else{
......@@ -63,8 +70,9 @@ class betreiber{
public function updaten(){
global $_POST;
$this->post_array($_POST);
$this->post_pruef();
$update = $this->db->update(PREFIX . SCHNITT , $this->post_array($_POST) , array("schnittstelle" => $this->db->escape($_POST['schnittstelle']) ) , 1);
$update = $this->db->update(PREFIX . SCHNITT , $this->post , array("schnittstelle" => $this->db->escape($_POST['schnittstelle']) ) , 1);
if($update == true){
$this->meldung = BETREIBERDATEN_SAVE_TRUE;
}else{
......
......@@ -32,7 +32,7 @@ if(!isset($_POST['passwort_2'])) { $_POST['passwort_2'] = "";}
if(!isset($_POST['bdate'])) { $_POST['badate'] = "";}
if(!isset($_POST['agb'])) { $_POST['agb'] = "";}
if(!isset($_POST['data'])) { $_POST['data'] = "";}
if(!isset($_POST['newsletter'])) { $_POST['newsletter'] = "1";}
if(!isset($_POST['newsletter'])) { $_POST['newsletter'] = "";}
if(!isset($error)) { $error = "";}
if(!isset($anmeldeok)) { $anmeldeok = "";}
if(!isset($ak)) { $ak = "";}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment