0
The code where my doubt is..
public function queryFixClayTime($data) {
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
if ($_SESSION['claytime'] >= $_SESSION['clayhour']->format('Y-m-d H:i:s')) {
//
} else {
try {
$this->iduser = $data['iduser'];
$this->timeplus = $_SESSION['claytimeplus']->format('Y-m-d H:i:s');
$cst = $this->con->connect()->prepare("UPDATE resources SET claytime = :claytime WHERE iduser = :iduser");
$cst->bindValue(":claytime", $this->timeplus);
$cst->bindValue(":iduser", $this->iduser);
$cst->execute();
$id['iduser'] = $_SESSION['iduser'];
$objupdate = new Resources();
$objupdate->querySelectResource($id);
} catch (PDOException $ex) {
$ex->getMessage();
}
}
}
The focus is here:
$cst->bindValue(":claytime", $this->timeplus);
$cst->bindValue(":iduser", $this->iduser);
Doing it the way above works perfectly
And so too...
$cst->bindValue(":claytime", $_SESSION['claytimeplus']->format('Y-m-d H:i:s'));
$cst->bindValue(":iduser", $_SESSION['iduser']);
What’s the difference between using the $this->iduser
or the $_SESSION['iduser']
Use the $_SESSION
direct is a bad practice of programming ? And somehow it can make the code more insecure ?
How the values of
$this
are defined? It is not from$_SESSION
?– Costamilam
Yes, so the question, what is the difference between using $this or $_SESSION directly in bindValue ? ;-;
– Vazafirst