SHARE
Facebook X Pinterest WhatsApp

User Personalization with PHP: The Final Scripts

Written By
thumbnail
Web Webster
Web Webster
May 28, 2009

“The PHP portion of the script deals with the information that
is sent by the HTML form that we will look at shortly. It starts by
including the database connection script. This script contains code
that starts a new session and also some other functions that we
will be using: include “connect.php”;

“By including this script we make all of its contents available
to the addbookmarks script. Next, we run a check to make sure that
no user accidentally accesses this page and ends up with ugly error
messages that my crash our application. We essentially check to see
if a session variable called uname is set. We could basically use
any of the session variables that are created during that
authentication process:

if(!isset($_SESSION[‘uname’])){

“If the variable is not set, then we simply send the user to the
login page since it indicates that the user either tried to access
the application by running this script directly without going
through the authentication process or that the user is trying to
break our application. Either way, we stop this illegal entry into
the application by redirecting the user like so:

//redirect to login page
header(“location:login/login.php”);
}


Complete Story

thumbnail
Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Recommended for you...

5 Best Free and Open Source Text Expander Tools
webmaster
Jun 13, 2025
Grafito: Systemd Journal Log Viewer with a Beautiful Web UI
Bobby Borisov
Jun 12, 2025
FreeBSD Wants to Know a Few Things
brideoflinux
May 11, 2025
NVK enabled for Maxwell, Pascal, and Volta GPUs
Kara Bembridge
May 1, 2025
Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.