Skip to content

Tag: php

Detect user exit site

I have an urge to detect when a user leaves my site in order to record accurately the session length of the user in question. I have thought of a couple possible solutions for this: I first thought I could use onbeforeunload and send a simple ajax to record the last activity but what practice has shown me is …

Safely remove migration In Laravel

In Laravel, there appears to be a command for creating a migration, but not removing. Create migration command: If I want to delete the migration, can I just safely delete the corresponding migrations file within the database/migrations folder? Migrations file: Answer I accidentally created a migration with a…

PHP: stream remote pdf to client browser

there’s a pdf generated on an external service and I would like to stream the pdf to the browser in my php server while streaming to client so that I don’t need to download the pdf from the remote file and then start initializing download. I would just have the file immediately download or stream …

Getting an error using constants

I have a lot of pages, all of which require the file characters.php. This file contains constants which define many things in my website. They are defined like this, for example: const $humanHEALTH = …

Build documentation from PHP code

I heard that the .NET manual was built from code and the most important parts have manually been improved later. Googleing has not turned up with anything so far. Most of the stuff I found wore …

I just can’t destroy a session in php

When I logout by destroying the session and start another one it always shows me the first session info I started $_SESSION[‘username’]; What I mean here is that : I started a session the first time I logged with this username –> AAAAAA And destroyed the session using the file logout.php …