Skip to content

Commit

Permalink
Remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Oct 17, 2022
1 parent ef119e3 commit 5498c60
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions web/includes/session.php
Expand Up @@ -66,7 +66,6 @@ function zm_session_regenerate_id() {

// Set deleted timestamp. Session data must not be deleted immediately for reasons.
$_SESSION['last_time'] = time();
// Finish session
session_write_close();

session_start();
Expand Down Expand Up @@ -127,17 +126,14 @@ public function __construct() {
*/
}
public function open($path, $name): bool {
ZM\Debug("Session::open ".($this->db?true:false));
return $this->db ? true : false;
}
public function close() : bool {
ZM\Debug("Session::close ");
// The example code closed the db connection.. I don't think we care to.
return true;
}
#[\ReturnTypeWillChange]
public function read($id){
ZM\Debug("Session::read ");
$sth = $this->db->prepare('SELECT data FROM Sessions WHERE id = :id');
if (!$sth->bindParam(':id', $id, PDO::PARAM_STR, 32)) {
ZM\Error("Failed to bind param");
Expand All @@ -150,14 +146,11 @@ public function read($id){
if (( $row = $sth->fetch(PDO::FETCH_ASSOC) ) ) {
return $row['data'];
}
ZM\Debug("Exeuted but no row for $id");
}
ZM\Error("No session for id $id?");
// Return an empty string
return '';
}
public function write($id, $data) : bool {
ZM\Debug("Session::write $id $data");
// Create time stamp
$access = time();

Expand All @@ -167,17 +160,9 @@ public function write($id, $data) : bool {
$sth->bindParam(':access', $access, PDO::PARAM_INT);
$sth->bindParam(':data', $data);

if ($sth->execute()) {
ZM\Debug("sucess");
return true;
} else {
ZM\Debug("failss");
return false;
}
#return $sth->execute() ? true : false;
return $sth->execute() ? true : false;
}
public function destroy($id) : bool {
ZM\Debug("Session::destroy $id");
$sth = $this->db->prepare('DELETE FROM Sessions WHERE Id = :id');
$sth->bindParam(':id', $id, PDO::PARAM_STR, 32);
return $sth->execute() ? true : false;
Expand Down

0 comments on commit 5498c60

Please sign in to comment.