CAMP part 1, registration, apply, new login screen, wide layout
This commit is contained in:
197
_class/class_camp_user.php
Normal file
197
_class/class_camp_user.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
class camp_user {
|
||||
private $cu_id;
|
||||
private $cu_email;
|
||||
private $cu_password;
|
||||
private $cu_reg_date;
|
||||
private $cu_last_login = null;
|
||||
private $cu_deleted;
|
||||
private $logged_in;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value of cu_id.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_cu_id()
|
||||
{
|
||||
return $this->cu_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of cu_id.
|
||||
*
|
||||
* @param mixed $cu_id the cu id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_cu_id($cu_id)
|
||||
{
|
||||
$this->cu_id = $cu_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of cu_email.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_cu_email()
|
||||
{
|
||||
return $this->cu_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of cu_email.
|
||||
*
|
||||
* @param mixed $cu_email the cu email
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_cu_email($cu_email)
|
||||
{
|
||||
$this->cu_email = $cu_email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of cu_password.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_cu_password()
|
||||
{
|
||||
return $this->cu_password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of cu_password.
|
||||
*
|
||||
* @param mixed $cu_password the cu password
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_cu_password($cu_password)
|
||||
{
|
||||
$this->cu_password = $cu_password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of cu_reg_date.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_cu_reg_date()
|
||||
{
|
||||
return $this->cu_reg_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of cu_reg_date.
|
||||
*
|
||||
* @param mixed $cu_reg_date the cu reg date
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_cu_reg_date($cu_reg_date)
|
||||
{
|
||||
$this->cu_reg_date = $cu_reg_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of cu_last_login.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_cu_last_login()
|
||||
{
|
||||
return $this->cu_last_login;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of cu_last_login.
|
||||
*
|
||||
* @param mixed $cu_last_login the cu last login
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_cu_last_login($cu_last_login)
|
||||
{
|
||||
$this->cu_last_login = $cu_last_login;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of cu_deleted.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_cu_deleted()
|
||||
{
|
||||
return $this->cu_deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of cu_deleted.
|
||||
*
|
||||
* @param mixed $cu_deleted the cu deleted
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_cu_deleted($cu_deleted)
|
||||
{
|
||||
$this->cu_deleted = $cu_deleted;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function update_login_time($_cu_id = null) {
|
||||
global $sql;
|
||||
//az adott user_id-n updateli a login_time-ot
|
||||
$sql->update_table('camp_user', array('cu_last_login' => date('Y-m-d')), array('cu_id' => (empty($_cu_id)?$this->get_cu_id():$_cu_id)));
|
||||
}
|
||||
|
||||
|
||||
public function set_user_data_by_id($_id) {
|
||||
global $sql;
|
||||
$cu_data_assoc_array = $sql->assoc_array("select * from camp_user where cu_id = " . $_id);
|
||||
$cu_data_array = $cu_data_assoc_array[0];
|
||||
foreach ($cu_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value);
|
||||
$this->set_login(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function is_logged_in() {
|
||||
//leellenőrzi cookie alapján h be vagyunk-e jelentkezve
|
||||
//JAVÍTVA: adja vissza az adattag igazságértékét
|
||||
return $this->logged_in;
|
||||
}
|
||||
|
||||
public function set_login($_login) {
|
||||
//bool-t kap paraméterül
|
||||
$this->logged_in = $_login;
|
||||
}
|
||||
|
||||
public static function create_camp_user($_email, $_password, $_reg_date) {
|
||||
global $sql;
|
||||
return $sql->insert_into('camp_user', array(
|
||||
'cu_email' => $_email,
|
||||
'cu_password' => md5($_password),
|
||||
'cu_reg_date' => $_reg_date,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user