Commit 2713ca28 authored by alexm98's avatar alexm98

Fixed the seenlogger, seen logs now work.

parent 3053923c
File deleted
No preview for this file type
<?php
<?php
class Seenlogger{
public function userAlreadyLogged($user){
$db = new PDO('sqlite:./db.sqlite3');
$statement = $db->prepare("SELECT COUNT(nick) FROM logs WHERE nick LIKE :user");
$statement->execute(array(':user'=>$user));
$db = new PDO('sqlite:./seenlog.sqlite3');
$statement = $db->prepare("SELECT COUNT(nick) FROM log WHERE nick LIKE :user");
$statement->execute([':user' => $user]);
$result = $statement->fetchAll();
if($result[0][0] == 0){
......@@ -18,15 +18,15 @@
$date = date('r');
if(Seenlogger::userAlreadyLogged($user)){
$db = new PDO('sqlite:./db.sqlite3');
$stmt = $db->prepare('UPDATE logs SET seendate = :date WHERE nick LIKE :user');
$stmt->execute(array(':date' => $date,':user'=>$user));
$db = new PDO('sqlite:./seenlog.sqlite3');
$stmt = $db->prepare('UPDATE log SET seen = :date WHERE nick LIKE :user');
$stmt->execute([':date' => $date,':user'=>$user]);
}
else{
$db = new PDO('sqlite:./db.sqlite3');
$stmt = $db->prepare('INSERT INTO logs VALUES(:user,:seen)');
$stmt->execute(array(':user'=>$user,':seen'=>$date));
$stmt->execute([':user'=>$user,':seen'=>$date]);
}
}
}
?>
\ No newline at end of file
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment