media.php

<?php
session_start();

if (empty($_SESSION[username]) AND empty($_SESSION[passuser])){
  echo "<link href='style.css' rel='stylesheet' type='text/css'>
 <center>Untuk mengakses modul, Anda harus login <br>";
  echo "<a href=index.php><b>LOGIN</b></a></center>";
}
else{
?>

Notice: Use of undefined constant username - assumed 'username' in C:\xampp\htdocs\SourceCodePHP\bab 4\toko\adminweb\media.php on line 4

Notice: Use of undefined constant passuser - assumed 'passuser' in C:\xampp\htdocs\SourceCodePHP\bab 4\toko\adminweb\media.php on line 4

Notice: Use of undefined constant module - assumed 'module' in C:\xampp\htdocs\SourceCodePHP\bab 4\toko\adminweb\content.php on line 9

Repeated error on line 4: if (empty($_SESSION[username]) AND empty($_SESSION[passuser])){

Why is it? I successfully the admin web, and now is the admin page, with few errors.

Recommended Answers

All 4 Replies

These are just notices. PHP prefers that variables be defined before they are used but it will create them as it finds them. If you don't want to see the notices, you can change the error_reporting in the program or in the php.ini file.

The error message line numbers aren't in sync with the listing of the module that you provided so something must have changed in the module since you copied the errors (but that doesn't matter much, the notices would just have different line numbers).

revision: I successfully bypass to the admin web.

Well, basically my point is how to fix the errors so that it won't appears anylonger and at the same time my web works perfectly?

what does it mean: Use of undefined constant username ?

the correct way is

$_SESSION['username']
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.