diff --git a/config.ini.php b/config.ini.php new file mode 100644 index 0000000..fd406cd --- /dev/null +++ b/config.ini.php @@ -0,0 +1,13 @@ +; diff --git a/setup.php b/setup.php index f9235ac..4959762 100644 --- a/setup.php +++ b/setup.php @@ -1,13 +1,20 @@ connect_errno){ - die("connection error: ".$msql->connect_error); +try{ + $pdo=new PDO($dsn,$conffile["user"],$conffile["password"]); +}catch(\PDOException $e){ + throw new \PDOException($e->getMessage(), (int)$e->getCode()); } -$string="SELECT id,file,title,hover FROM comics ORDER BY CASE WHEN (id='$id') THEN 0 ELSE 1 END, id DESC"; -$qry=$msql->query($string) or die($msql->error); -$comic=$qry->fetch_assoc(); +$string="SELECT id,file,title,hover FROM comics ORDER BY CASE WHEN (id=?) THEN 0 ELSE 1 END, id DESC"; +$qry=$pdo->prepare($string); +$qry->execute([$id]); +$comic=$qry->fetch(PDO::FETCH_ASSOC); ?> \ No newline at end of file