Added deletion of user ability
This commit is contained in:
parent
4beabd5df3
commit
7226890aa1
4
TODO
4
TODO
@ -9,7 +9,3 @@ install.php :
|
||||
=============
|
||||
* Link beside password field to toggle visible / not visible
|
||||
* TRUNCATE before CREATE TABLE in install.php
|
||||
|
||||
index.php :
|
||||
===========
|
||||
* Delete user (+ check if not you)
|
||||
|
@ -165,4 +165,27 @@ class Storage {
|
||||
|
||||
$this->id = (!isset($this->id) ? $this->connection->lastInsertId() : $this->id);
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$query = 'DELETE FROM '.MYSQL_PREFIX.$this->TABLE_NAME.' WHERE ';
|
||||
|
||||
$i = false;
|
||||
foreach($this->fields as $field=>$type) {
|
||||
if(!empty($this->$field)) {
|
||||
if($i) { $query .= ' AND '; } else { $i = true; }
|
||||
|
||||
$query .= $field.'=:'.$field;
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->connection->prepare($query);
|
||||
|
||||
foreach($this->fields as $field=>$type) {
|
||||
if(!empty($this->$field)) {
|
||||
$query->bindParam(':'.$field, $this->$field);
|
||||
}
|
||||
}
|
||||
|
||||
$query->execute();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user