<?php
class User
{
public $m_sUserId;
public $m_sUserName;
public $m_sPassword;
public $m_sConfirmPassword;
public $m_sVnaam;
public $m_sAnaam;
public $m_sStraat;
public $m_iNr;
public $m_sGemeente;
public $m_iPostcode;
public $m_sProvincie;
public $m_iTel;
public $m_iGsm;
public $m_sEmail;
public $m_sIkGeslacht;
public $m_sNationaliteit;
public $m_sInkomen;
public $m_sBeroep;
public $m_sDiploma;
public $m_sBurgelijkestaat;
public $m_sKinderen;
public $m_sReligie;
public $m_sIkRook;
public $m_sIkDrink;
public $m_sOpZoekNaar;
public $m_sIkZoek;
public $m_sIkZoekLeeftijd;
public $m_sZijRookt;
public $m_sZijDrinkt;
public $m_sZijKinderen;
public function __set($p_sProperty, $p_vValue)
{
switch($p_sProperty)
{
case "Username":
if(!empty($p_vValue))
{
$this->m_sUserName = $p_vValue;
}
else
{
Throw new Exception("Vul een login in aub.");
}
break;
case "Password":
if(!empty($p_vValue))
{
$this->m_sPassword = $p_vValue;
}
else
{
Throw new Exception("Vul een passwoord in aub.");
}
break;
case "ConfirmPassword":
if(!empty($p_vValue))
{
$this->m_sConfirmPassword = $p_vValue;
}
else
{
Throw new Exception("Confirmeer uw passwoord aub.");
}
break;
case "Vnaam":
if(!empty($p_vValue))
{
$this->m_sVnaam = $p_vValue;
}
break;
case "Anaam":
if(!empty($p_vValue))
{
$this->m_sAnaam = $p_vValue;
}
break;
case "Straat":
if(!empty($p_vValue))
{
$this->m_sStraat = $p_vValue;
}
break;
case "Nr":
if(!empty($p_vValue))
{
$this->m_iNr = $p_vValue;
}
break;
case "Gemeente":
if(!empty($p_vValue))
{
$this->m_sGemeente = $p_vValue;
}
break;
case "Postcode":
if(!empty($p_vValue))
{
$this->m_iPostcode = $p_vValue;
}
break;
case "Provincie":
if(!empty($p_vValue))
{
$this->m_sProvincie = $p_vValue;
}
break;
case "Tel":
if(!empty($p_vValue))
{
$this->m_iTel = $p_vValue;
}
break;
case "Gsm":
if(!empty($p_vValue))
{
$this->m_iGsm = $p_vValue;
}
break;
case "Email":
if(!empty($p_vValue))
{
$this->m_sEmail = $p_vValue;
}
break;
case "IkGeslacht":
if(!empty($p_vValue))
{
$this->m_sIkGeslacht = $p_vValue;
}
break;
case "Nationaliteit":
if(!empty($p_vValue))
{
$this->m_sNationaliteit = $p_vValue;
}
break;
case "Inkomen":
if(!empty($p_vValue))
{
$this->m_sInkomen = $p_vValue;
}
break;
case "Beroep":
if(!empty($p_vValue))
{
$this->m_sBeroep = $p_vValue;
}
break;
case "Diploma":
if(!empty($p_vValue))
{
$this->m_sDiploma = $p_vValue;
}
break;
case "BurgelijkeStaat":
if(!empty($p_vValue))
{
$this->m_sBurgelijkestaat = $p_vValue;
}
break;
case "Kinderen":
if(!empty($p_vValue))
{
$this->m_sKinderen = $p_vValue;
}
break;
case "Religie":
if(!empty($p_vValue))
{
$this->m_sReligie = $p_vValue;
}
break;
case "IkRook":
if(!empty($p_vValue))
{
$this->m_sIkRook = $p_vValue;
}
break;
case "IkDrink":
if(!empty($p_vValue))
{
$this->m_sIkDrink = $p_vValue;
}
break;
case "OpZoekNaar":
if(!empty($p_vValue))
{
$this->m_sOpZoekNaar = $p_vValue;
}
break;
case "IkZoek":
if(!empty($p_vValue))
{
$this->m_sIkZoek = $p_vValue;
}
break;
case "IkZoekLeeftijd":
if(!empty($p_vValue))
{
$this->m_sIkZoekLeeftijd = $p_vValue;
}
break;
case "ZijRookt":
if(!empty($p_vValue))
{
$this->m_sZijRookt = $p_vValue;
}
break;
case "ZijDrinkt":
if(!empty($p_vValue))
{
$this->m_sZijDrinkt = $p_vValue;
}
break;
case "ZijKinderen":
if(!empty($p_vValue))
{
$this->m_sZijKinderen = $p_vValue;
}
break;
}
public function __get($p_sProperty)
{
$vResult = null;
switch($p_sProperty)
{
case "Userid":
$vResult = $this->m_sUserId;
break;
case "Username":
$vResult = $this->m_sUserName;
break;
case "Password":
$vResult = $this->m_sPassword;
break;
case "ConfirmPassword":
$vResult = $this->m_sConfirmPassword;
break;
case "Vnaam":
$vResult = $this->m_sVnaam;
break;
case "Anaam":
$vResult = $this->m_sAnaam;
break;
case "Straat":
$vResult = $this->m_sStraat;
break;
case "Nr":
$vResult = $this->m_iNr;
break;
case "Gemeente":
$vResult = $this->m_sGemeente;
break;
case "Postcode":
$vResult = $this->m_iPostcode;
break;
case "Provincie":
$vResult = $this->m_sProvincie;
break;
case "Tel":
$vResult = $this->m_iTel;
break;
case "Gsm":
$vResult = $this->m_iGsm;
break;
case "Email":
$vResult = $this->m_sEmail;
break;
case "IkGeslacht":
$vResult = $this->m_sIkGeslacht;
break;
case "Nationaliteit":
$vResult = $this->m_sNationaliteit;
break;
case "Inkomen":
$vResult = $this->m_sInkomen;
break;
case "Beroep":
$vResult = $this->m_sBeroep;
break;
case "Diploma":
$vResult = $this->m_sDiploma;
break;
case "BurgelijkeStaat":
$vResult = $this->m_sBurgelijkestaat;
break;
case "Kinderen":
$vResult = $this->m_sKinderen;
break;
case "Religie":
$vResult = $this->m_sReligie;
break;
case "IkRook":
$vResult = $this->m_sIkRook;
break;
case "IkDrink":
$vResult = $this->m_sIkDrink;
break;
case "OpZoekNaar":
$vResult = $this->m_sOpZoekNaar;
break;
case "IkZoek":
$vResult = $this->m_sIkZoek;
break;
case "IkZoekLeeftijd":
$vResult = $this->m_sIkZoekLeeftijd;
break;
case "ZijRookt":
$vResult = $this->m_sZijRookt;
break;
case "ZijDrinkt":
$vResult = $this->m_sZijDrinkt;
break;
case "ZijKinderen":
$vResult = $this->m_sZijKinderen;
break;
}
return $vResult;
}
public function Create()
{
include("Connection.php");
$sSql = "insert into tblusers (
UserName,
UserPassword
)
VALUES (
'".mysqli_real_escape_string($link, $this->m_sUserName)."',
'".mysqli_real_escape_string($link, $this->m_sPassword)."'
);";
if ($rResult = mysqli_query($link, $sSql))
{
//query went OK
}
else
{
echo $sSql;
// er zijn geen query resultaten, dus query is gefaald
throw new Exception('Er is iets foutgelopen. Kon account niet aanmaken!');
}
mysqli_close($link);
}
public function Update()
{
include("Connection.php");
$sSql = "UPDATE tblusers
SET UserVnaam = '".mysqli_real_escape_string($link, $this->m_sVnaam)."',
UserAnaam = '".mysqli_real_escape_string($link, $this->m_sAnaam)."',
UserStraat = '".mysqli_real_escape_string($link, $this->m_sStraat)."',
UserNr = '".mysqli_real_escape_string($link, $this->m_iNr)."',
UserGemeente = '".mysqli_real_escape_string($link, $this->m_sGemeente)."',
UserPostcode = '".mysqli_real_escape_string($link, $this->m_iPostcode)."',
UserProvincie = '".mysqli_real_escape_string($link, $this->m_sProvincie)."',
UserTel = '".mysqli_real_escape_string($link, $this->m_iTel)."',
UserGsm = '".mysqli_real_escape_string($link, $this->m_iGsm)."',
UserEmail = '".mysqli_real_escape_string($link, $this->m_sEmail)."',
UserIkGeslacht = '".mysqli_real_escape_string($link, $this->m_sIkGeslacht)."',
UserNationaliteit = '".mysqli_real_escape_string($link, $this->m_sNationaliteit)."',
UserInkomen = '".mysqli_real_escape_string($link, $this->m_sInkomen)."',
UserBeroep = '".mysqli_real_escape_string($link, $this->m_sBeroep)."',
UserDiploma = '".mysqli_real_escape_string($link, $this->m_sDiploma)."',
UserBurgelijkeStaat = '".mysqli_real_escape_string($link, $this->m_sBurgelijkestaat)."',
UserKinderen = '".mysqli_real_escape_string($link, $this->m_sKinderen)."',
UserReligie = '".mysqli_real_escape_string($link, $this->m_sReligie)."',
UserIkRook = '".mysqli_real_escape_string($link, $this->m_sIkRook)."',
UserIkDrink = '".mysqli_real_escape_string($link, $this->m_sIkDrink)."',
UserOpzoeknaar = '".mysqli_real_escape_string($link, $this->m_sOpZoekNaar)."',
UserIkZoek = '".mysqli_real_escape_string($link, $this->m_sIkZoek)."',
UserIkZoekLeeftijd = '".mysqli_real_escape_string($link, $this->m_sIkZoekLeeftijd)."',
UserZijRookt = '".mysqli_real_escape_string($link, $this->m_sZijRookt)."',
UserZijDrinkt = '".mysqli_real_escape_string($link, $this->m_sZijDrinkt)."',
UserZijKinderen = '".mysqli_real_escape_string($link, $this->m_sZijKinderen)."'
WHERE UserName = '".$this->m_sUserName."'";
if ($rResult = mysqli_query($link, $sSql))
{
//query went OK
}
else
{
echo $sSql;
echo mysqli_error($link);
// er zijn geen query resultaten, dus query is gefaald
throw new Exception('Er is iets foutgelopen. Kon gegevens niet opslaan!');
}
mysqli_close($link);
}
}