Add session IP address logging
This commit is contained in:
parent
8cc0315cf7
commit
f0101aaea2
2
api.php
2
api.php
|
@ -28,7 +28,7 @@ switch ($VARS['action']) {
|
|||
$scrambled["real"][] = $a['aid'];
|
||||
$scrambled["fake"][] = substr(hash("md5", mt_rand()), 0, 20);
|
||||
}
|
||||
$database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "expired" => 0, "#timestamp" => "NOW()"]);
|
||||
$database->insert("sessions", ["skey" => $skey, "aid" => $correct_answer['aid'], "expired" => 0, "#timestamp" => "NOW()", "ipaddr" => getUserIP()]);
|
||||
$sid = $database->id();
|
||||
$scrambled_insert = [];
|
||||
for ($i = 0; $i < count($scrambled['real']); $i++) {
|
||||
|
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
-- MySQL Script generated by MySQL Workbench
|
||||
-- Fri 09 Jun 2017 03:48:51 AM MDT
|
||||
-- Fri 09 Jun 2017 01:26:04 PM MDT
|
||||
-- Model: New Model Version: 1.0
|
||||
-- MySQL Workbench Forward Engineering
|
||||
|
||||
|
@ -38,6 +38,7 @@ CREATE TABLE IF NOT EXISTS `captcheck`.`sessions` (
|
|||
`aid` INT NOT NULL,
|
||||
`expired` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`timestamp` DATETIME NOT NULL,
|
||||
`ipaddr` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`sid`),
|
||||
UNIQUE INDEX `sid_UNIQUE` (`sid` ASC),
|
||||
INDEX `fk_sessions_answers1_idx` (`aid` ASC),
|
||||
|
@ -112,3 +113,4 @@ INSERT INTO `captcheck`.`answers` (`aid`, `aname`, `aimg`) VALUES (29, 'truck',
|
|||
INSERT INTO `captcheck`.`answers` (`aid`, `aname`, `aimg`) VALUES (30, 'gear', 'cog');
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
|
Loading…
Reference in New Issue