jamesxg1 Posted April 19, 2009 Share Posted April 19, 2009 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/ Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Author Share Posted April 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813752 Share on other sites More sharing options...
jackpf Posted April 19, 2009 Share Posted April 19, 2009 You've closed your PHP tag, half of that stuff isn't even being parsed. Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813754 Share on other sites More sharing options...
soak Posted April 19, 2009 Share Posted April 19, 2009 If your set query returns no results: $check = "SELECT * FROM `unlock` WHERE owner = '$username'" or die(mysql_error()); $picturename will never be set. Set it to a default value at the start of your script. Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813756 Share on other sites More sharing options...
jackpf Posted April 19, 2009 Share Posted April 19, 2009 Wait...no, I'm confused. You have closed your tags, but you've opened one within another. You can't do that...are you not getting an error? Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813761 Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Author Share Posted April 19, 2009 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813762 Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Author Share Posted April 19, 2009 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813764 Share on other sites More sharing options...
PFMaBiSmAd Posted April 19, 2009 Share Posted April 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813765 Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Author Share Posted April 19, 2009 <?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. Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813767 Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Author Share Posted April 19, 2009 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813771 Share on other sites More sharing options...
mrMarcus Posted April 19, 2009 Share Posted April 19, 2009 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; Quote Link to comment https://forums.phpfreaks.com/topic/154744-solved-undefined-varible-help/#findComment-813777 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.