<?php
interface Gateway {
public function getId();
public function setId();
public function getUser();
public function setUser();
public function getPassword();
public function setPassword();
public function getAccountId();
public function setAccountId();
public function getIpAddress();
public function setIpAddress();
public function getDatum();
public function setDatum();
}
class ServerDataGateway implements Gateway {
protected $db;
protected $id;
protected $delid;
protected $user;
protected $pw;
protected $account;
protected $ipaddress;
protected $datum;
function __construct($id = 0,$delid = 0,$user,$pw,$account,$ipaddress)
{
$this->id = $id;
$this->delid = $delid;
$this->user = $user;
$this->pw = $pw;
$this->account = $account;
$this->ipaddress = $ipaddress;
}
public function prepareData() {
$this->id = htmlspecialchars(utf8_decode($this->id));
$this->user = htmlspecialchars(utf8_decode($this->user));
$this->pw = htmlspecialchars(utf8_decode($this->pw));
$this->account = htmlspecialchars($this->account);
$this->ipaddress = htmlspecialchars(utf8_decode($this->ipaddress));
}
public function getId() {
if (is_numeric($this->id)) {
return $this->id;
}
return false;
}
public function setId() {
if (is_numeric($this->id)) {
return $this->id;
}
return false;
}
public function getUser() {
return $this->user;
}
public function setUser() {
return $this->user;
}
public function getPassword() {
return sha1($this->pw);
}
public function setPassword() {
return sha1($this->pw);
}
public function getAccountId() {
return sha1($this->account);
}
public function setAccountId() {
return sha1($this->account);
}
public function getIpAddress() {
return $this->ipaddress;
}
public function setIpAddress() {
return $this->ipaddress;
}
public function getDatum() {
return $this->datum;
}
public function setDatum() {
if ($this->datum == '') {
$this->datum = date('Y-m-d H:i:s');
}
$this->datum = htmlspecialchars($this->datum);
return $this->datum;
}
}
?>