Jump to content

Weird Validation errors


nepzap2

Recommended Posts

Hello guys. I currently re-designed a page utilizing a control page.

 

I am using an XHTML strict declaration at the top of my document header file (see below).

 

<!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">

 

But when I try to validate I get around 256 errors. And for some reason weird "PHP sessions strings are added to my url's" I have no idea what this is. Below is an example of some of these errors.

 

Can someone help me?

 

#  Warning  Line 61, Column 74: cannot generate system identifier for general entity "PHPSESSID"

…hp?page=Intranet&section=Overview&[b][color=red]PHPSESSID=17b9d814888eb176e68af35bc8f817[/color][/b]…

✉

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (. The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

Entity references start with an ampersand (&) and end with a semicolon (. If you want to use a literal ampersand in your document you must encode it as "&" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and æ are different characters.

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.
# Error Line 61, Column 74: general entity "PHPSESSID" not defined and no default entity

…hp?page=Intranet&section=Overview&[b]PHPSESSID=17b9d814888eb176e68af35bc8f817[/b]…

✉

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

Link to comment
Share on other sites

Thanks for replying Karl.

 

O.K.

 

Below you should find my menu which I include in my header which I then include in my control page.

 

The control page includes a functions page.

 

<div class="megaMenuHover">
<a href="./" class="megaMenuHover">Home</a>

<a href="home.php?page=AboutUs&section=AboutBTI" id="megaanchor" class="megaMenuHover" <?php testPage("AboutUs"); ?>>About BTI</a>

<!--Mega Menu Anchor-->
<a href="home.php?page=Research" id="megaanchor2" class="megaMenuHover" <?php testPage("Research"); ?>>Research</a>


<a href="home.php?page=Education&section=EducationOverview" id="megaanchor3" class="megaMenuHover" <?php testPage("Education"); ?>>Education and Outreach</a>


<a href="home.php?page=Environment" class="megaMenuHover" <?php testPage("Environment"); ?>>Environment</a>


<a href="home.php?page=Employment&section=EmploymentOverview" id="megaanchor4" class="megaMenuHover" <?php testPage("Employment"); ?>>Employment</a>


<a href="home.php?page=Contact&section=Overview" id="megaanchor5" class="megaMenuHover" <?php testPage("Contact"); ?>>Contact</a>

</div>


<!--Mega Drop Down Menu HTML. Retain given CSS classes-->
<div id="megamenu1" class="megamenu">

<div class="column">
<ul>
    
        <li><a href="home.php?page=AboutUs&section=OurMission" class="subMenuLink">Our Mission</a></li>
        <li><a href="home.php?page=AboutUs&section=OurMission#OurVision" class="subMenuLink">Our Vision</a></li>
        <li><a href="home.php?page=AboutUs&section=FromthePresident" class="subMenuLink">From the President</a></li>
        <li><a href="home.php?page=AboutUs&section=OurBoardofDirectors" class="subMenuLink">Our Board of Directors</a></li>
        <li><a href="home.php?page=AboutUs&section=Ethics" class="subMenuLink">Ethics</a></li>
        <li><a href="home.php?page=AboutUs&section=History" class="subMenuLink">History</a></li>
        <li><a href="home.php?page=AboutUs&section=Periodicals" class="subMenuLink">Periodicals</a></li>
    
</ul>
</div>


</div>


<!--Mega Drop Down Menu HTML. Retain given CSS classes-->
<div id="megamenu2" class="megamenu">

<div class="column">

<ul>
    	<li><a href="" style="color: #5d829d; font-weight: bold; text-decoration: none;">Research Overview</a></li>
        <li><a href="home.php?page=Research&section=PGS" class="subMenuLink">Post-Graduate Society</a></li>
        <li><a href="home.php?page=Research&section=LicensingOverview" class="subMenuLink">Licensing</a></li>
        <li><a href="home.php?page=Research&section=listpubs" class="subMenuLink">Published Articles</a></li>
        <li><a href="home.php?page=Research&section=SeminarsAtBTI" class="subMenuLink">Seminars at BTI</a></li>
        <li><a href="home.php?page=Research&section=Resources" class="subMenuLink2">Resources</a></li>
        <li><a href="" style="color: #5d829d; font-weight: bold; text-decoration: none;">Facilities & Services</a></li>
        <li><a href="home.php?page=Research&section=FacilitiesServices" class="subMenuLink">Overview</a></li>
        <li><a href="home.php?page=Research&section=FacilitiesServices&subsection=Auditorium" class="subMenuLink">Auditorium</a></li>
        <li><a href="home.php?page=Research&section=FacilitiesServices&subsection=BiotechnologyCenter" class="subMenuLink">Biotechnology Center</a></li>
        <li><a href="home.php?page=Research&section=FacilitiesServices&subsection=InformationResourceCenter" class="subMenuLink">Information Resource Center</a></li>
        <li><a href="home.php?page=Research&section=FacilitiesServices&subsection=PlantCellImagingCenter" class="subMenuLink">Plant Cell Imaging Center</a></li>
        <li><a href="home.php?page=Research&section=FacilitiesServices&subsection=PlantGrowthFacility" class="subMenuLink">Plant Growth Facility</a></li>	
</ul>

</div>

<div class="column">
<ul>
        <li><a href="" style="color: #5d829d; font-weight: bold; text-decoration: none;">Research Overview</a></li>
        <li><a href="home.php?page=Research&section=FacultyOverview" class="subMenuLink">Overview</a></li>
        <li><a href="KlausApel.php?page=Research" class="subMenuLink">Klaus Apel</a></li>
        <li><a href="GaryBlissard.php?page=Research" class="subMenuLink">Gary Blissard</a></li>
        <li><a href="TomBrutnell.php?page=Research" class="subMenuLink">Tom Brutnell</a></li>
        <li><a href="CarmenCatala.php?page=Research" class="subMenuLink">Carmen Catala</a></li>
        <li><a href="ZhangjunFei.php?page=Research" class="subMenuLink">Zhangjun Fei</a></li>
        <li><a href="JimGiovannoni.php?page=Research" class="subMenuLink">Jim Giovannoni</a></li>
        <li><a href="MariaHarrison.php?page=Research" class="subMenuLink">Maria Harrison</a></li>
        <li><a href="GeorgJander.php?page=Research" class="subMenuLink">Georg Jander</a></li>
        <li><a href="DanKlessig.php?page=Research" class="subMenuLink">Dan Klessig</a></li>
        <li><a href="Ji-YoungLee.php?page=Research" class="subMenuLink">Ji-Young Lee</a></li>
        <li><a href="GregoryMartin.php?page=Research" class="subMenuLink">Gregory Martin</a></li>
        <li><a href="LukasMueller.php?page=Research" class="subMenuLink">Lukas Mueller</a></li>
        <li><a href="SorinaPopescu.php?page=Research" class="subMenuLink">Sorina Popescu</a></li>
        <li><a href="EricRichards.php?page=Research" class="subMenuLink">Eric Richards</a></li>
        <li><a href="FrankSchroeder.php?page=Research" class="subMenuLink">Frank Schroeder</a></li>
        <li><a href="DavidStern.php?page=Research" class="subMenuLink">David Stern</a></li>
        <li><a href="JoyceVanEck.php?page=Research" class="subMenuLink">Joyce Van Eck</a></li>
        <li><a href="home.php?page=Research&section=EmeritusScientists" class="subMenuLink">Emeritus Scientists</a></li>
        <li><a href="home.php?page=Research&section=AdjunctScientists" class="subMenuLink">Adjunct Scientists</a></li>
</ul>
</div>

<br style="clear: left" /> <!--Break after 3rd column. Move this if desired-->

</div>


<!--Mega Drop Down Menu HTML. Retain given CSS classes-->
<div id="megamenu3" class="megamenu">

<div class="column">

<ul>
    	<li>
        	<a href="home.php?page=Education&section=EducationOverview" style="color: #5d829d; font-weight: bold; text-decoration: none;">
            Education Overview</a>
        </li>
        <li><a href="home.php?page=Education&section=TeacherPrograms" class="subMenuLink">Teacher Program</a></li>
        <li><a href="home.php?page=Education&section=EducationResources" class="subMenuLink">Educational Resources</a></li>
        <li><a href="mailto:pgrp-outreach@cornell.edu" class="subMenuLink">Contact Us</a></li>
        
</ul>

</div>

<div class="column">
<ul>
<li>
    <a href="home.php?page=Education&section=Internships#page=PGRPSummerInternships" style="color: #5d829d; font-weight: bold; text-decoration: none;">Internships Overview</a>
                        </li>
    <li><a href="home.php?page=Education&section=Internships#page=FAQ" class="subMenuLink">FAQ</a></li>
    <li><a href="home.php?page=Education&section=Internships#page=PGRPSummerInternships" class="subMenuLink">PGRP Summer Internships</a></li>
    <li><a href="home.php?page=Education&section=Internships#page=PGRPFacultyResearch" class="subMenuLink">PGRP Faculty Research</a></li>
    <li><a href="home.php?page=Education&section=Internships#page=ApplyingInternship" class="subMenuLink">Applying for an Intership</a></li>
    <li><a href="pdfs/Recommendationform_10.pdf" class="subMenuLink">Recommendation Form</a></li>
</ul>
</div>

<br style="clear: left" /> <!--Break after 3rd column. Move this if desired-->

</div>



<!--Mega Drop Down Menu HTML. Retain given CSS classes-->
<div id="megamenu4" class="megamenu">

<div class="column">
<ul>
    
        <li>
        <a href="home.php?page=Employment&section=EmploymentOverview" style="color: #5d829d; font-weight: bold; text-decoration: none;">
        Job Openings</a></li>
        <li><a href="http://www.bti.cornell.edu/pdfs/hr/hrforms/application_form.pdf" class="subMenuLink">Job Application</a></li>
        <li><a href="home.php?page=Education&section=Internships" class="subMenuLink">Internships</a></li>
        <li><a href="home.php?page=Employment&section=WorkStudy" class="subMenuLink">Work-Study</a></li>
    
</ul>
    
</div>


</div>



<!--Mega Drop Down Menu HTML. Retain given CSS classes-->
<div id="megamenu5" class="megamenu">

<div class="column">
<ul>
    
        <li>
        <a href="home.php?page=Contact&section=Overview" style="color: #5d829d; font-weight: bold; text-decoration: none; "class="subMenuLink">
        Contact Overview</a></li>
        <li><a href="pdfs/BTIOrgChart.pdf" class="subMenuLink">Organizational Chart</a></li>
        <li><a href="home.php?page=Contact&section=StaffDirectory" class="subMenuLink">BTI Staff Directory</a></li>
        <li><a href="home.php?page=Contact&section=Scientists" class="subMenuLink">Scientists</a></li>
        <li><a href="home.php?page=Contact&section=Research Associate" class="subMenuLink">Research Associates</a></li>
        <li><a href="home.php?page=Contact&section=Post Doc" class="subMenuLink">Post Docs</a></li>
        <li><a href="home.php?page=Contact&section=Grad Student" class="subMenuLink">Grad Students</a></li>
        <li><a href="home.php?page=Contact&section=Research Support" class="subMenuLink">Research Support</a></li>
        <li><a href="home.php?page=Contact&section=Support" class="subMenuLink">Support</a></li>
        <li><a href="home.php?page=Contact&section=SeniorLeadership" class="subMenuLink">Senior Leadership</a></li>
        <li><a href="home.php?page=Contact&section=Management" class="subMenuLink">Management</a></li>
        <li><a href="home.php?page=Contact&section=Management Scientist" class="subMenuLink">Management/Scientists</a></li>
        <li><a href="home.php?page=Contact&section=Emeritus Scientist" class="subMenuLink">Emeritus Scientists</a></li> 
        <li><a href="home.php?page=Contact&section=Affiliates" class="subMenuLink">Affiliates</a></li>
        <li><a href="home.php?page=Map" class="subMenuLink">Directions to Cornell</a></li>
    
</ul>
    
</div>


</div>



 

This is the top portion of the header.

 

</head>

<body>
<div class="container">
        <div class="banner">
            
        	<div class="bannerMenu">
            	<div class="siteMapMenu">
                	<a href="">SiteMap</a> 
                    <a href="index.php?page=Intranet&section=Overview">Intranet</a> 
                    <a href="http://webportal.bti.cornell.edu/Login.aspx">Web Portal</a> 
                    <a href="index.php?page=Contact&section=Overview">People</a>
                </div>
            	<div class="bannerSearch"><input type='text' id='q' size='18' class="text"></div>
                <div class="cornellAffiliation"><span style="color:#646a5c;">
                The Boyce Thompson Institute is an independent affiliate of</span> 
                <a href="http://www.cornell.edu" style="color: #646a5c;">Cornell University</a></div>
            </div>

    	</div>
        <div class="header" style="margin-left: 6px; padding-top: 0px;">
        	<?php include "includes/mainMenu5.php"; ?>
        </div>
        <div class="mainContentBottom">
        <div class="mainContent" id='mainContent'>

Link to comment
Share on other sites

Hello kenrbnsn,

 

Thanks for answering. Yes I do. I use it in my json_proxy file that handles the querying for my search.

Below is the code. I had commented out the "session_start();" but that did not do anything.

 

<?php

/*
We wanna have sessions enabled for json/ajax because we might in the future add authentication
and session tracking so that only authorized users can get JSON data.
*/
session_start();

/*
The usual connect stuff.  This should come from a single include that other scripts share, but
for now we'll just put it here.
*/
$conn = mysql_pconnect("myhost", "username", "password") or trigger_error(mysql_error(),E_USER_ERROR); 
mysql_select_db ("someDatabse") or die ("I cannot select the database '$dbname' because: " . mysql_error());

/*
Lookup function for staff.  It uses a single lookup parameter which comes from a text box
in the browser.  This means that it could contain one or two words (first name and last name) in
any order.  We'll ignore any characters (a ',' for example) which are not letters.
*/

function getStaffInfo($term){
	if(null == $term) return null;

	//trim $term to remove leading and ending spaces, and return null if $term is empty
	$term = trim($term);
	if("" === $term) return null;

	//replace any non-alphabetic characters with spaces
	$term = ereg_replace("[^A-Za-z]", " ", $term);

	/*
	At this point $term should have one or more values (first/last):
		$term = "Brutnell"   
		$term = "Rosero Camilo" or "Camilo Rosero"
	It could happen that there are multiple spaces in the case of two values (first/last names), 
	so lets ereg_replace for that case
	*/
	$term = ereg_replace(" +", " ", $term);

	//convert all characters to UPPER CASE to make comparison with database values easier
	$term = strtoupper($term);

	//if $term has two values, then the following will return an array of length greater than 1
	$term_array = explode(" ", $term);

	//our $sql statement will basically compare the values in the array with the first and last
	//names in staff_contact_table (in upper case), in any order, to make sure we catch all our 
	//cases
	$where_clause = "WHERE ";
	if(1 == count($term_array)){
		$where_clause .= "UPPER(first_name) LIKE '" . $term_array[0] . "%' OR 
		                  UPPER(last_name) LIKE '" . $term_array[0] . "%'  OR
		                  UPPER(title) LIKE '%" . $term_array[0] . "%' OR
		                  UPPER(title) LIKE '%" . $term_array[0] . "%'";
	}else{
		$where_clause .= "(UPPER(first_name) LIKE '" . $term_array[0] . "%' AND
						   UPPER(last_name) LIKE '" . $term_array[1] . "%') 
											OR
						  (UPPER(first_name) LIKE '" . $term_array[1] . "%' AND
						   UPPER(last_name) LIKE '" . $term_array[0] . "%')
						                    OR
						  UPPER(title) LIKE '%" . $term_array[0] . "%' OR
						  UPPER(title) LIKE '%" . $term_array[1] . "%' OR
						  UPPER(category) LIKE '%" . $term_array[0] . "%' OR
						  UPPER(category) LIKE '%" . $term_array[1] . "%'";

	}


	$sql = "SELECT * FROM staff_contact_table $where_clause ORDER BY last_name ASC";
	$result = mysql_query($sql);
	return $result;
}

//Ths simple function returns a parameter from either $_GET or $_POST, checking in $_GET first
function getParam($name){
	$ret = $_GET[$name];
	if(null == $ret || "" === trim($ret)){
		$ret = $_POST[$name];
	}

	if(null == $ret || "" === trim($ret)){
		return null;
	}

	return $ret;
}

header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');

$function = getParam("function");
$jsoncallback = getParam("jsoncallback");

if("getcontactJSON" === $function){

}
else if("getcontacthtml" === $function){
	$searchterm = getParam("searchterm");
	$staffdata = getStaffInfo($searchterm);
	if(null == $staffdata){
		return "$jsoncallback({'error':'no data', 'searchterm':" . json_encode($searchterm) . "})";
	}
	else{
		$html = "";
		while($row = mysql_fetch_assoc($staffdata)){

			$workgroup = $row['work_group'];

			$html .= "<div style=''>" .
						"<div style='float: left; width: 175px;'>" . 
							"<img src='images/lab_members_images/$workgroup/" . $row['image_name'] . "'>" .
						"</div>" .
						"<div style='float: left; width: 175px;'>" .
							 $row['first_name'] . " " . $row['last_name'] . "<br />" .
							 $row['title'] .
						"</div>" .
					"</div>" .
					"<div style='clear: both;'></div>";
		}
		echo "$jsoncallback({'html':" . json_encode($html) . ", 'searchterm':" . json_encode($searchterm) . "});";
	}
}

?>


<?php



  function json_encode($a=false)
  {
    if (is_null($a)) return 'null';
    if ($a === false) return 'false';
    if ($a === true) return 'true';
    if (is_scalar($a))
    {
      if (is_float($a))
      {
        // Always use "." for floats.
        return floatval(str_replace(",", ".", strval($a)));
      }

      if (is_string($a))
      {
        static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
        return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
      }
      else
        return $a;
    }
    $isList = true;
    for ($i = 0, reset($a); $i < count($a); $i++, next($a))
    {
      if (key($a) !== $i)
      {
        $isList = false;
        break;
      }
    }
    $result = array();
    if ($isList)
    {
      foreach ($a as $v) $result[] = json_encode($v);
      return '[' . join(',', $result) . ']';
    }
    else
    {
      foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
      return '{' . join(',', $result) . '}';
    }
  }
  


?>


Link to comment
Share on other sites

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.