I am a relative newbie to PHP, and am working on a project that combines existing PHP code (login.php) with newly added random image zenphoto PHP code. When both are installed I three error msgs appear when the page loads. Since each of the two codes work fine by themselves, there must be a conflict between the two.
It appears the zenphoto code is causing the login.php code to run as if the user has submitted the login form. I’m not really sure what to change to address the issue. I will include the error msgs, the login.php, and the zenphoto php for the random image placement.
Any help with troubleshooting the issue would be greatly appreciated.
Thanks in advance,
Jon
Error msgs:
Notice: Undefined index: username in /mnt/local/home/mikeysatira/url_address/login.php on line 5
Notice: Undefined index: action in /mnt/local/home/mikeysatira/ url_address /login.php on line 26
Notice: Undefined index: username in /mnt/local/home/mikeysatira/ url_address /login.php on line 32
Login.php (minus table tags):
<?
$loginmessage = "";
if($_REQUEST['username'] != "")
{
if($filterloaded == false)
{
include('inputfilter.php');
}
$TheFilter = new InputFilter();
$validUser = validateUser($TheFilter->process($_REQUEST['username']), $TheFilter->process($_REQUEST['password']));
if($validUser != '')
{
$_SESSION['username'] = $TheFilter->process($_REQUEST['username']);
}
else
{
$loginmessage = "logerror";
}
}
elseif($_REQUEST['action'] == 'logout')
{
session_destroy();
$_SESSION['username'] = "";
}
if($_SESSION['username'] == "" || $loginmessage != "" ) { ?>
<form action="<?= $thisform ?>" method="post">
<? if($loginmessage == "logerror")
{
echo("<p class=\"logbox\"><b>Your User name or password could not be verified. Please try again.</b></p>");
}
?>
<?= $_SESSION['username'] ?></p>
<?
if($_SESSION['admin'] == 1)
{
echo("<p class=\"logbox\">You have logged in under an administrator's account.<br><a href=\"admin.php\">Click here</a> to enter the <b>D2W</b> administration section.</p>");
}
?>
<? } ?>
Top of page:
<?
include('topinclude.php');
$thisform = "home2.php";
?>
Within page:
<? include('login.php'); ?>
Zenphoto
Top of page:
<?php define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
?>
Within page:
<?php $randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "<a href='".$randomImageURL."' title='Random Picture...'>
<img src='". $randomImage->getSizedImage(getOption('image_size')) . "'
alt=\"random image\"\n" . $randomImage->getTitle() . '" /></a>';
?>