Posts

Showing posts with the label php

Hint

What Is It? Switching between different programming languages and projects daily can be challenging. To make things easier, I decided to create a quick-access utility for storing and retrieving code snippets, examples, and notes. The new features you learn from various frameworks are often useful later—if not for yourself, then for your coworkers. While Googling is an option, it often takes up valuable time. My solution? A small utility that lets you access your notes in less than 2-3 seconds. Recently, I’ve been working extensively with PostgreSQL, so I decided to build this tool using this reliable open-source database. What Can It Do? This utility allows you to quickly search for syntax examples across multiple programming languages. It’s designed to help you find what you need with minimal effort. How Does It Work? The utility is command-line-based and currently supports space-separated search terms. Here’s how it works: Command Line Interface : You enter your search directly into ...

Unexpected Session Logout Issue in CodeIgniter: A Case Study

The Problem Recently, at work, we encountered a puzzling issue with our web application, which was built using the CodeIgniter PHP framework. Users were being logged out unexpectedly, and the logout behavior was irregular and hard to predict. Although we noticed this problem early on, it was difficult to reproduce consistently, making debugging a challenge. The issue seemed random, but we eventually observed that it occurred more frequently when the screen displaying a map of POI (Points of Interest) positions was refreshed at short intervals, such as every few seconds. What Was the Cause? Initially, we suspected the session was expiring prematurely. However, upon closer inspection, we discovered that the session cookie was being truncated—losing about 10 to 20 characters. This led us to investigate the CodeIgniter Security class, specifically the xss_clean function, which is designed to prevent cross-site scripting (XSS) attacks. The root cause was a regular expression within xss_cle...