Jump to content

Recommended Posts

<?php session_start();

ini_set('display_errors', 1);
error_reporting(E_ALL);

include '../Database/Connection.php';
include '../Database/Utility.php';
include '../Database/Settings.php';


CheckFolder();
isloggedin();
accessneeded("C");

print '<title><?php print $companytitle ?> - File Manager</title>';

print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />';

print '<script type="text/javascript" language="javascript" src="../CoreFiles/JS/lytebox.js"></script>';

print '<link rel="stylesheet" href="../CoreFiles/CSS/lytebox.css" type="text/css" media="screen" />';

print '<link rel="stylesheet" href="CoreFiles/CSS/Gallery.css" type="text/css" media="screen, projection" />';

print '<!--[if lte IE 7]><link rel="stylesheet" href="CoreFiles/CSS/ie_fixes.css" type="text/css" media="screen, projection" /><![endif]-->';

$username = mysql_real_escape_string(stripslashes($_SESSION['username']));

$picture = mysql_real_escape_string(stripslashes($_GET['name']));

$check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error());
$checkcon = mysql_query($check) or die(mysql_error());
while ($checkdet = mysql_fetch_array($checkcon)) {

$ownercheck = $checkdet['owner'];

$picturename = $checkdet['filename'];

}

$url_path = "User_Files/$username/Images";

if ($filename == $picture) {

if ($owner == $username) {

print '<ul class="hoverbox">';

print "<li><a href=''><img src='$url_path/$entry' alt='$picture'><img src='$url_path/$entry' alt='$picture' class='preview'></a></li>";
}
}

print '</ul></body></html>';

?>

 

 

Notice: Undefined variable: filename in C:\xampp\htdocs\family\FileManager\EditImage.php on line 43

Link to comment
https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/
Share on other sites

Sorry i got a var wrong,

 

<?php session_start();

ini_set('display_errors', 1);
error_reporting(E_ALL);

include '../Database/Connection.php';
include '../Database/Utility.php';
include '../Database/Settings.php';


CheckFolder();
isloggedin();
accessneeded("C");

print '<title><?php print $companytitle ?> - File Manager</title>';

print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />';

print '<script type="text/javascript" language="javascript" src="../CoreFiles/JS/lytebox.js"></script>';

print '<link rel="stylesheet" href="../CoreFiles/CSS/lytebox.css" type="text/css" media="screen" />';

print '<link rel="stylesheet" href="CoreFiles/CSS/Gallery.css" type="text/css" media="screen, projection" />';

print '<!--[if lte IE 7]><link rel="stylesheet" href="CoreFiles/CSS/ie_fixes.css" type="text/css" media="screen, projection" /><![endif]-->';

$username = mysql_real_escape_string(stripslashes($_SESSION['username']));

$picture = mysql_real_escape_string(stripslashes($_GET['name']));

$check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error());
$checkcon = mysql_query($check) or die(mysql_error());
while ($checkdet = mysql_fetch_array($checkcon)) {

$ownercheck = $checkdet['owner'];

$picturename = $checkdet['filename'];

}

$url_path = "User_Files/$username/Images";

if ($picturename == $picture) {

if ($owner == $username) {

print '<ul class="hoverbox">';

print "<li><a href=''><img src='$url_path/$entry' alt='$picture'><img src='$url_path/$entry' alt='$picture' class='preview'></a></li>";
}
}

print '</ul></body></html>';

?>

 

Still got the same error on the same line but this time it says

 

Notice: Undefined variable: picturename in C:\xampp\htdocs\family\FileManager\EditImage.php on line 43

<?php session_start();

ini_set('display_errors', 1);
error_reporting(E_ALL);

include '../Database/Connection.php';
include '../Database/Utility.php';
include '../Database/Settings.php';


CheckFolder();
isloggedin();
accessneeded("C");

print '<title><?php print $companytitle ?> - File Manager</title>';

print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />';

print '<script type="text/javascript" language="javascript" src="../CoreFiles/JS/lytebox.js"></script>';

print '<link rel="stylesheet" href="../CoreFiles/CSS/lytebox.css" type="text/css" media="screen" />';

print '<link rel="stylesheet" href="CoreFiles/CSS/Gallery.css" type="text/css" media="screen, projection" />';

print '<!--[if lte IE 7]><link rel="stylesheet" href="CoreFiles/CSS/ie_fixes.css" type="text/css" media="screen, projection" /><![endif]-->';

$username = mysql_real_escape_string(stripslashes($_SESSION['username']));

$picture = mysql_real_escape_string(stripslashes($_GET['name']));

$check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error());
$checkcon = mysql_query($check) or die(mysql_error());
while ($checkdet = mysql_fetch_array($checkcon)) {

$ownercheck = $checkdet['owner'];

$picturename = $checkdet['filename'];

print "$username";

$url_path = "User_Files/$username/Images";

if ($picturename == $picture) {

if ($ownercheck == $username) {

print '<ul class="hoverbox">';

print "<li><a href=''><img src='$url_path/$entry' alt='$picture'><img src='$url_path/$entry' alt='$picture' class='preview'></a></li>";
}
}
}

print '</ul></body></html>';

?>

 

chenged no errors now just blank screen :S

<?php session_start();

ini_set('display_errors', 1);
error_reporting(E_ALL);

include '../Database/Connection.php';
include '../Database/Utility.php';
include '../Database/Settings.php';


CheckFolder();
isloggedin();
accessneeded("C");

print '<title>$companytitle- File Manager</title>';

print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />';

print '<script type="text/javascript" language="javascript" src="../CoreFiles/JS/lytebox.js"></script>';

print '<link rel="stylesheet" href="../CoreFiles/CSS/lytebox.css" type="text/css" media="screen" />';

print '<link rel="stylesheet" href="CoreFiles/CSS/Gallery.css" type="text/css" media="screen, projection" />';

print '<!--[if lte IE 7]><link rel="stylesheet" href="CoreFiles/CSS/ie_fixes.css" type="text/css" media="screen, projection" /><![endif]-->';

$username = mysql_real_escape_string(stripslashes($_SESSION['userid']));

$picture = mysql_real_escape_string(stripslashes($_GET['name']));

$check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error());
$checkcon = mysql_query($check) or die(mysql_error());
while ($checkdet = mysql_fetch_array($checkcon)) {

$ownercheck = $checkdet['owner'];

$picturename = $checkdet['filename'];

$url_path = "User_Files/$username/Images";

if ($picturename == $picture) {

if ($ownercheck == $username) {

print '<ul class="hoverbox">';

print "<li><a href=''><img src='$url_path/$entry' alt='$picture'><img src='$url_path/$entry' alt='$picture' class='preview'></a></li>";
}
}
}

print '</ul></body></html>';

?>

 

This gives me a blank screen but no errors

That's because your code has a fatal parse error -

 

Parse error: parse error in yourfile.php on line 15

 

You need to turn on full php error reporting in php.ini for it to show fatal parse errors. Since your script never runs, the two lines that turn on the error_reporting and display_errors settings never execute.

<?php session_start();

ini_set('display_errors', 1);
error_reporting(E_ALL);

include '../Database/Connection.php';
include '../Database/Utility.php';
include '../Database/Settings.php';


CheckFolder();
isloggedin();
accessneeded("C");

print '<title>$companytitle- File Manager</title>';

print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />';

print '<script type="text/javascript" language="javascript" src="../CoreFiles/JS/lytebox.js"></script>';

print '<link rel="stylesheet" href="../CoreFiles/CSS/lytebox.css" type="text/css" media="screen" />';

print '<link rel="stylesheet" href="CoreFiles/CSS/Gallery.css" type="text/css" media="screen, projection" />';

print '<!--[if lte IE 7]><link rel="stylesheet" href="CoreFiles/CSS/ie_fixes.css" type="text/css" media="screen, projection" /><![endif]-->';

$username = mysql_real_escape_string(stripslashes($_SESSION['userid']));

$picture = mysql_real_escape_string(stripslashes($_GET['name']));

$check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error());
$checkcon = mysql_query($check) or die(mysql_error());
while ($checkdet = mysql_fetch_array($checkcon)) {

$ownercheck = $checkdet['owner'];

$picturename = $checkdet['filename'];

$url_path = "User_Files/$username/Images";

if ($picturename == $picture) {

if ($ownercheck == $username) {

print '<ul class="hoverbox">';

print "<li><a href=''><img src='$url_path/$entry' alt='$picture'><img src='$url_path/$entry' alt='$picture' class='preview'></a></li>";
}
}
}

print '</ul></body></html>';

?>

 

yea the error was because i had php opening and closing tags in a print ''; area, its changed now tho, but still a blank screen.

<?php session_start();

ini_set('display_errors', 1);
error_reporting(E_ALL);

include '../Database/Connection.php';
include '../Database/Utility.php';
include '../Database/Settings.php';


CheckFolder();
isloggedin();
accessneeded("C");

print "<title>$companytitle- File Manager</title>";

print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />';

print '<script type="text/javascript" language="javascript" src="../CoreFiles/JS/lytebox.js"></script>';

print '<link rel="stylesheet" href="../CoreFiles/CSS/lytebox.css" type="text/css" media="screen" />';

print '<link rel="stylesheet" href="CoreFiles/CSS/Gallery.css" type="text/css" media="screen, projection" />';

print '<!--[if lte IE 7]><link rel="stylesheet" href="CoreFiles/CSS/ie_fixes.css" type="text/css" media="screen, projection" /><![endif]-->';

$username = mysql_real_escape_string(stripslashes($_SESSION['userid']));

$picture = mysql_real_escape_string(stripslashes($_GET['name']));

$url_path = "User_Files/$username/Images";

$check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error());
$checkcon = mysql_query($check) or die(mysql_error());
while ($checkdet = mysql_fetch_array($checkcon)) {

$ownercheck = $checkdet['owner'];

$picturename = $checkdet['filename'];

}

if ($picturename == $picture) {

print '1';

if ($ownercheck == $username) {

print '2';

print '<ul class="hoverbox">';

print "<li><a href=''><img src='$url_path/$entry' alt='$picture'><img src='$url_path/$entry' alt='$picture' class='preview'></a></li>";
}
}

print '</ul></body></html>';

?>

 

Ok, so i tidied it up, but i dont get any of the test prints ('1', '2') which means the IF statments arent wokring :S

double check your values coming in ($_SESSION['userid'] and $_GET['name']) to make sure they are what you want them to be.

 

change your query to this and add mysql_num_rows() :

$check = mysql_query("SELECT * FROM `unlock` WHERE owner = '$username'") or die(mysql_error());
if (mysql_num_rows($check) > 0) {
     //put all the stuff here if there is a match in the db; 
     //don't forget to close this;
     //add an else to this statement for error handling;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.