Jump to content

Recommended Posts

Okay

Now

#1 the artical should be

{phpfile}locator.php{/phpfile}

 

and

locator.php should be the same as the one we started with but change

print("<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n");

to

print("<form action=\"\" method=\"post\">\n");

 

Give that ago and were see what see get!

I don't know where

Error:
Error Number: 0

is coming from or even why!

 

Just to check i am now going nuts

can you create another file called "test.php"

and add

<?php

include "locator.php";

?>

then open test.php and check it works..

 

i'm pretty sure this is a joomla issule!

Agreed..

 

Solutions:

#1 Don't use code

#2 Don't use joomla

#3 Try Other extensions

#4 find a work around!  (maybe a redirect)

#5 Fix code..

#5.1. ok i think the problem maybe due to a function that joomla considers "risky" only real way to check is to get the list of risky functions or review the code and debug!

 

Infact i have just had an intresting idea!

but its almost 3am so i need to get some sleep!

i'll check back in the morning..

Okay..

Backup your locator.php file and replace its contents with this one

add the include on the Joomla Page and test this

 

(of course i can't test it from here)

 

 

 

<?php

// ----------------------------------------------------------------------
//   File        : locator.php
//   Description : search and display list/view of stores
//   Version     : 1.0
//   Created     : 1/6/2007
//
//   Version     : 1.2
//   Created     : 08/04/2009
//
//   Copyright (c) 2007. All rights reserved.
//
// ----------------------------------------------------------------------

if(!isset($_GET['ajax']))
{
?>
<script language="javascript">
function SubmitForm()
{     
	//we don't need to change anymore of this script
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch(e){
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('locatorcontainer').innerHTML = xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET", "locator.php?ajax=true&stateID="+document.getElementsByName('stateID').value+"&search="+document.getElementsByName('search').value+"&key="+document.getElementsByName('key').value,true);
	xmlHttp.send(null);
}
</script>
<?php
include("settings.php");
include("databasewrapper.php");
include("includes/countrydropdown.php");

print("<style>\n");
include("locator.css");
print("</style>\n");
}

//Allow for magic quotes
if (get_magic_quotes_gpc()) {
   function stripslashes_deep($value)
   {
       $value = is_array($value) ?
                   array_map('stripslashes_deep', $value) :
                   stripslashes($value);

       return $value;
   }

   $_POST = array_map('stripslashes_deep', $_POST);
   $_GET = array_map('stripslashes_deep', $_GET);
   $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
   $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}




//accept variables

if (isset($_REQUEST['search']))
   $strSearch = addslashes($_REQUEST['search']);
else
   $strSearch = "";

if (isset($_REQUEST['key']))
   $strKey = addslashes($_REQUEST['key']);
else
   $strKey = "";

if (isset($_REQUEST['stateID']))
   $strState = addslashes($_REQUEST['stateID']);
else
   $strState = "";

if (isset($_REQUEST['country']))
   $strCountry = addslashes($_REQUEST['country']);
else
   $strCountry = "";

if (isset($_REQUEST['storeID']))
   $intStoreID = addslashes($_REQUEST['storeID']);
else
   $intStoreID = "";

if (isset($_REQUEST['pn']))
   $intPage = $_REQUEST['pn'];
else
   $intPage = 1;

$intStartrecord = (($intPage*$intPublicpagesize)-($intPublicpagesize));

//maintain state between pages

$strPublicstate = get_public_state(0);
$strNavpublicstate = get_public_state(1);


//main page control logic

if(!isset($_GET['ajax'])) print("<div id=\"locatorcontainer\">\n");

if ($intStoreID != "")
{
   location_info($intStoreID);
}else{
   if ($strSearch != "")
   {
      sql_prep(); 
      $intRecordsfound = record_count($SQLstmt);
      $intTotalpages = get_page_total();
      
      if ($intRecordsfound > 0)
      {
         sql_for_results();
         search_feedback();
         results_status();
         location_list();
         display_paged_navigation();
      }else{
         search_feedback();
         no_records_found();
      }
   }else{
      location_search();
   }
}

if(!isset($_GET['ajax'])) print("</div>\n"); // end locatorcontainer div




// ----------------------------------------------------------------------
//   Function    : location_search
//   Description : prints a search form to query store locations
//   Usage       : location_search()
//
// ----------------------------------------------------------------------

function location_search() {

   global $SetStateSearch, $SetCountrySearch;

   print("<div id=\"locatorform\">\n");
   print("<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n");
   print("  <tr>\n");
   print("    <td class=\"locatorheading\">Find a Kitchen in your area</td>\n");
   print("  </tr>\n");
   print("  <tr><td align=\"right\" class=\"viewall\"><a href=\"" . $_SERVER['PHP_SELF'] . "?search=true\">view all</a></td></tr>\n");
   print("  <tr>\n");
   print("<form action=\"\" method=\"post\">\n");
   print("<input type=\"hidden\" name=\"search\" value=\"true\">\n");
   print("    <td class=\"formtext\"><span class=\"formheading\">Keyword</span> (Business Name, Postcode, Town or County etc.)<br>");
   print("<input type=\"text\" name=\"key\"></td>\n");
   print("  </tr>\n");

   //if state search enabled
   if ($SetStateSearch == "ON") {

      print("  <tr>\n");
      print("    <td>");
      print("<span class=\"formheading\">County</span><br>\n");
      
      include("includes/statedropdown.php");

      print("    </td>\n");
      print("  </tr>\n");

   }

   //if country search enabled
   if ($SetCountrySearch == "ON") {

      print("  <tr>\n");
      print("    <td>");
      print("<span class=\"formheading\">Country</span><br>\n");
      
      countrydropdown();

      print("    </td>\n");
      print("  </tr>\n");

   }

   print("  <tr><td height=\"8\"></td></tr>\n");
   print("  <tr>\n");
   print("    <td><input type=\"image\" src=\"images/formbutton.gif\" value=\"submit\" onclick=\"SubmitForm();\" border=\"0\"></td>\n");
   print("  </tr>\n");

   print("</form>\n");
   print("</table>\n");
   print("</div>\n"); // end locatorform div

}




// ----------------------------------------------------------------------
//   Function    : location_list
//   Description : prints a list of stores based on search parameters
//   Usage       : location_list()
//
// ----------------------------------------------------------------------

function location_list() {

   global $SQLstmt;
   global $strPublicstate;
   global $SetShowCountry;

   print("<div id=\"searchresults\">\n");

   $resultSet = dbaction($SQLstmt);

   while ($row = getrsrow($resultSet)) {

      print("<div class=\"storerow\">\n");

      if ($row['storename'] != "")
         print("<div class=\"rowheading\"><a href=\"" . $_SERVER['PHP_SELF'] . "?storeID=" . $row['storeID'] . "$strPublicstate\">" . $row['storename'] . "</a></div>\n");

      if ($row['address'] != "")
         print $row['address'] . "<br>";

      // build address remainder
      $strBuildaddress = "";

      if ($row['suburb'] != "")
         $strBuildaddress .= $row['suburb'];

      if ($row['city'] != "")
      {
         if ($strBuildaddress != "")
            $strBuildaddress .= ", ";     
  
         $strBuildaddress .= $row['city'];
      }

      if ($row['statename'] != "")
      {
         if ($row['suburb'] != "" || $row['city'] != "")
            $strBuildaddress .= ", ";

         $strBuildaddress .= $row['statename'] . ".";
      }

      if ($row['country'] != "" || $row['zippostcode'] != "")
      {
         $strBuildaddress .= "<br>";
      
         if ($SetShowCountry == "ON")
         {
            if ($row['country'] != "")
               $strBuildaddress .= $row['country'] . "  ";
         }

         if ($row['zippostcode'] != "")
            $strBuildaddress .= $row['zippostcode'];

      }     

      if ($strBuildaddress != "")
         print $strBuildaddress;


      if ($row['telephone1'] != "")
         print "<br>" . $row['telephone1'];

      if ($row['telephone2'] != "")
         print "<br>" . $row['telephone2'];

      if ($row['maplink'] != "") 
      {
         print("<div id=\"resultmaplink\">\n");
         print("<a href=\"http://" . $row['maplink'] . "\" target=\"_blank\">View Profile</a> ");
         print("<a href=\"http://" . $row['maplink'] . "\" target=\"_blank\"><img src=\"images/mapicon.gif\" border=\"0\"></a>");
         print("</div>\n");
      }

      print("\n</div>\n"); // end storerow div

   }

   print("</div>\n");  // end searchresults div

}




// ----------------------------------------------------------------------
//   Function    : location_info
//   Description : prints complete information on a store
//   Usage       : location_info($storeID)
//
// ----------------------------------------------------------------------

function location_info($storeID) {

   global $strPublicstate;
   global $SetShowStoreHours;
   global $SetShowCountry;

   $SQLstmt = "SELECT slstore.*, slstate.statename FROM slstore " .
              "LEFT JOIN slstate ON slstore.stateID = slstate.stateID " .
              "WHERE storeID = '$storeID'";

   $resultSet = dbaction($SQLstmt);
   $row = getrsrow($resultSet);


   print("<div id=\"fullinfocontainer\">\n");

   //return to results list link
   print("<div id=\"backtoresults\"><a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strPublicstate\">Back to results</a></div>\n");

   print("<div id=\"fullinfotopsep\"></div>\n");

   print("<div id=\"storename\">" . $row['storename'] ."</div>\n");

   print("<div id=\"addressdescription\">\n");

   print("<div id=\"addressbox\">\n");
   if ($row['address'] != "")
      print $row['address'] . "<br>";

   // build address remainder
   $strBuildaddress = "";

   if ($row['suburb'] != "")
      $strBuildaddress .= $row['suburb'];

   if ($row['city'] != "")
   {
      if ($strBuildaddress != "")
         $strBuildaddress .= ", ";     
  
      $strBuildaddress .= $row['city'];
   }

   if ($row['statename'] != "")
   {
      if ($row['suburb'] != "" || $row['city'] != "")
         $strBuildaddress .= ", ";

      $strBuildaddress .= $row['statename'] . ".";
   }

   if ($row['country'] != "" || $row['zippostcode'] != "")
   {
      $strBuildaddress .= "<br>";
      
      if ($SetShowCountry == "ON")
      {
         if ($row['country'] != "")
            $strBuildaddress .= $row['country'] . "  ";
      }

      if ($row['zippostcode'] != "")
         $strBuildaddress .= $row['zippostcode'];

   }     

   if ($strBuildaddress != "")
      print $strBuildaddress;


   // telephone numbers
   if ($row['telephone1'] != "")
      print "<br>" . $row['telephone1'];

   if ($row['telephone2'] != "")
      print "<br>" . $row['telephone2'];   

   print("</div>\n"); // end addressbox div

   print("<div id=\"descriptionbox\">\n");
   if ($row['description'] != "")
      print $row['description'];
   print("</div>\n");

   print("</div>\n"); // end addressdescription div


   //other comms
   if ($row['fax'] != "" || $row['website'] != "" || $row['email'])
   {

      print("<div id=\"othercomms\">\n");
      print("<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">\n");

      if ($row['fax'] != "")
      {
         print("<tr><td class=\"othercommstext\">Fax:</td><td class=\"othercommstext\">" . $row['fax'] . "</td></tr>\n");
      }

      if ($row['website'] != "")
      {
         print("<tr><td class=\"othercommstext\">Website:</td><td class=\"othercommstext\"><a href=\"http://" . $row['website'] . "\" target=\"_blank\">" . $row['website'] . "</a></td></tr>\n");
      }

      if ($row['email'] != "")
      {
         print("<tr><td class=\"othercommstext\">Email:</td><td class=\"othercommstext\"><a href=\"mailto:" . $row['email'] . "\">" . $row['email'] . "</td></tr>\n");
      }

      print("</table>\n");
      print("</div>\n");

   }


   if ($SetShowStoreHours == "ON")
   {

      print("<div id=\"storehours\">\n");

      if ($row['openmonday'] != "" || $row['closemonday'] != "" || $row['opentuesday'] != "" || $row['closetuesday'] != "" || $row['openwednesday'] != "" || $row['closewednesday'] != "" || $row['openthursday'] != "" || $row['closethursday'] != "" || $row['openfriday'] != "" || $row['closefriday'] != "" || $row['opensaturday'] != "" || $row['closesaturday'] != "" || $row['opensunday'] != "" || $row['closesunday'] != "")
      {

         //store hours
         print("<span class=\"fullheading\">Store Hours</span><br>\n");
         print("<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">\n");
         print("  <tr>\n");
         print("    <td class=\"hourstext\"></td><td class=\"hourstext\">Open</td><td></td><td class=\"hourstext\">Close</td>\n");
         print("  </tr>\n");

         if ($row['openmonday'] != "" || $row['closemonday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\" width=\"92\">Monday</td><td class=\"hourstext\">" . $row['openmonday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closemonday'] . "</td>");
            print("  </tr>\n");
         }

         if ($row['opentuesday'] !="" || $row['closetuesday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\">Tuesday</td><td class=\"hourstext\">" . $row['opentuesday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closetuesday'] . "</td>");
            print("  </tr>\n");
         }

         if ($row['openwednesday'] !="" || $row['closewednesday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\">Wednesday</td><td class=\"hourstext\">" . $row['openwednesday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closewednesday'] . "</td>");
            print("  </tr>\n");
         }

         if ($row['openthursday'] !="" || $row['closethursday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\">Thursday</td><td class=\"hourstext\">" . $row['openthursday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closethursday'] . "</td>");
            print("  </tr>\n");
         }

         if ($row['openfriday'] !="" || $row['closefriday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\">Friday</td><td class=\"hourstext\">" . $row['openfriday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closefriday'] . "</td>");
            print("  </tr>\n");
         }

         if ($row['opensaturday'] !="" || $row['closesaturday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\">Saturday</td><td class=\"hourstext\">" . $row['opensaturday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closesaturday'] . "</td>");
            print("  </tr>\n");
         }

         if ($row['opensunday'] !="" || $row['closesunday'] != "")
         {
            print("  <tr>\n");
            print("    <td class=\"hourstext\">Sunday</td><td class=\"hourstext\">" . $row['opensunday'] . "</td><td>-</td><td class=\"hourstext\">" . $row['closesunday'] . "</td>");
            print("  </tr>\n");
         }

         print("</table>\n");

      }

      if ($row['opencloseinfo'] != "")
      {
         print ("<div id=\"extrahours\">" . $row['opencloseinfo'] . "</div>\n");
      }

      print("</div>\n"); // end storehours div

   }


   //store manager
   if ($row['storemanager'] != "")
      print("<div id=\"storemanager\"><span class=\"fullheading\">Store Manager</span><br> " . $row['storemanager'] . "</div>\n");

   //map link and directions
   if ($row['maplink'] != "")
      print("<div id=\"maplink\"><a href=\"http://" . $row['maplink'] . "\" target=\"_blank\">View Map</a></div>\n");

   if ($row['directions'] != "")
      print("<div id=\"directions\"><span class=\"fullheading\">Directions</span><br>" . $row['directions'] . "</div>");

   print("<div id=\"fullinfobottomsep\"></div>\n");

   print("</div>\n"); // end fullinfocontainer

}




// ----------------------------------------------------------------------
//   Function    : sql_prep
//   Description : sets SQL variables to find number of records found
//                 and prepare to run main query
//   Usage       : sql_prep()
//
// ----------------------------------------------------------------------

function sql_prep() {

   global $SQLstmt, $SQLselect, $SQLfrom, $SQLwhere;
   global $strKey, $strState, $strCountry;
   global $SetDebug;

   //Build FROM part
   $SQLfrom =  " FROM slstore LEFT JOIN slstate ON slstore.stateID = slstate.stateID";


   //Build WHERE part

   $SQLwhere = " WHERE (recordstatus = 'active')";

   if ($strKey != "" || $strState != "" || $strCountry != "")
   {

      if ($strKey != "")
      {
         $SQLwhere .= " AND (storename LIKE '%$strKey%' OR address LIKE '%$strKey%'" .
                      " OR city LIKE '%$strKey%' OR suburb LIKE '%$strKey%' OR statename LIKE '%$strKey%'" .
                      " OR country LIKE '%$strKey%' OR zippostcode LIKE '%$strKey%')";  
      }

      if ($strState != "")
      {
         $SQLwhere .= " AND (slstore.stateID = $strState)";
      }

      if ($strCountry != "")
      {
         $SQLwhere .= " AND (country = '$strCountry')";
      }

   }


   //SQL to find number of records
   $SQLselect = "SELECT COUNT(*)";
   $SQLstmt = $SQLselect . $SQLfrom . $SQLwhere;

   if ($SetDebug == "ON")
   {
      print("<div class=\"debug\">$SQLstmt</div>");
   }


}




// ----------------------------------------------------------------------
//   Function    : sql_for_results
//   Description : creates the remainder of the sql parts required and 
//                 sets the actual record retrieval SQL query 
//   Usage       : sql_for_results()
//
// ----------------------------------------------------------------------

function sql_for_results() {

   global $SQLstmt, $SQLselect, $SQLfrom, $SQLwhere, $SQLorder;
   global $intStartrecord;
   global $intPublicpagesize;
   global $SetDebug;

   //SQL to retrieve all or a subset of store records
   $SQLselect = "SELECT storeID, storename, address, city, suburb, country, " .
                "statename, zippostcode, telephone1, telephone2, maplink";
   $SQLorder = " ORDER BY storename";
   $SQLlimit = " LIMIT $intStartrecord, $intPublicpagesize";
   $SQLstmt = $SQLselect . $SQLfrom . $SQLwhere . $SQLorder . $SQLlimit;

   if ($SetDebug == "ON")
   {
      print("<div class=\"debug\">$SQLstmt</div>\n");
   }

}




// ----------------------------------------------------------------------
//   Function    : record_count
//   Description : returns number of records found during search
//   Usage       : record_count($SQLstmt)
//   Parameters  : $SQLstmt - SQL for total query record count
//   Returns     : $intRecordsfound - how many records will be returned
//                 by query
//
// ----------------------------------------------------------------------

function record_count($SQLstmt) {

   $resultSet = dbaction($SQLstmt);
   $row = getrsrow($resultSet);
   $intRecordsfound = $row[0];
   return $intRecordsfound;

}





// ----------------------------------------------------------------------
//   Function    : get_page_total
//   Description : return the number of record result pages available
//                 using the total number of records found and the
//                 page size from the settings.php file
//   Usage       : get_page_total()
//   Returns     : intTotalpages - how many record result pages there are
//                 given the number of records found and the page size
//                 setting
//
// ----------------------------------------------------------------------

function get_page_total() {

   global $intRecordsfound;
   global $intPublicpagesize;

   if (fmod($intRecordsfound, $intPublicpagesize) == 0)
   {
      $intTotalpages = $intRecordsfound/$intPublicpagesize;      
   }
   else
   {
      $intTotalpages = ceil($intRecordsfound/$intPublicpagesize);
   }

   return $intTotalpages;

}




// ----------------------------------------------------------------------
//   Function    : search_feedback
//   Description : prints feedback on search parameters
//   Usage       : search_feedback()
//
// ----------------------------------------------------------------------

function search_feedback() {

   global $strKey, $strState, $strCountry;

   print("<div id=\"searchfeedback\">\n");

   if ($strKey != "" || $strState != "" || $strCountry != "")
   {

      print("You searched on ");

      if ($strKey != "")
         print("Keyword: <span class=\"searchfeedbackbold\">" . stripslashes($strKey) . "</span>   ");   

      if ($strState != "")
      {
         $SQLstmt2 = "SELECT statename FROM slstate WHERE stateID = '$strState'";
         $resultSet2 = dbaction($SQLstmt2);
         $row = getrsrow($resultSet2);
         print("County: <span class=\"searchfeedbackbold\">" . $row['statename'] . "</span>   ");  
      }

      if ($strCountry != "")
         print("Country: <span class=\"searchfeedbackbold\">" . stripslashes($strCountry) . "</span>   ");  

   }

   print("<span class=\"searchagain\"><a href=\"" . $_SERVER['PHP_SELF'] . "\">new search</a></span>\n");

   print("</div>\n"); // end searchfeedback div

}




// ----------------------------------------------------------------------
//   Function    : results_status
//   Description : shows status info on the number of records returned in
//                 a result list and which ones are currently shown
//   Usage       : resultsstatus()
//
// ----------------------------------------------------------------------

function results_status() {

   global $intRecordsfound;
   global $intPage;
   global $intStartrecord;
   global $intPublicpagesize;

   print("<div id=\"recordsfound\">");
   print("Showing results <span class=\"recordsfoundbold\">" . ($intStartrecord+1) . ""); 
   print("</span> - <span class=\"recordsfoundbold\">");

   if (($intPublicpagesize*$intPage) < $intRecordsfound)
      print($intPublicpagesize*$intPage);
   else
      print($intRecordsfound);            

   print(" </span> of <span class=\"recordsfoundbold\">$intRecordsfound</span>");
   print("</div>\n");

}




// ----------------------------------------------------------------------
//   Function    : no_records_found
//   Description : print no records found message
//   Usage       : norecordsfound()
//
// ----------------------------------------------------------------------

function no_records_found() {

   print("<div id=\"norecordsfound\">No records found</div>\n");

}




// ----------------------------------------------------------------------
//   Function    : display_paged_navigation
//   Description : diplays the page navigation links when a search 
//                 result has more than 1 page of records
//   Usage       : display_paged_navigation()
//
// ----------------------------------------------------------------------

function display_paged_navigation() {

   global $intTotalpages;
   global $intPage;
   global $intPublicchaptersize;

   global $strNavpublicstate;

   // only show page navigation links if number of pages > 1
   if ($intTotalpages > 1)
   {


      // calculate current chapter based on current page
      if (fmod($intPage, $intPublicchaptersize) == 0)
         $intChapter = ($intPage/$intPublicchaptersize);
      else
         $intChapter = ceil($intPage/$intPublicchaptersize); 


      // display paged record navigation bar
      print("<div id=\"pagenavcontainer\">\n"); 
      print("<div id=\"pagenavigation\">\n");


      // display previous chapter link if it exists
      if ($intChapter > 1)
      {
         print("<div id=\"pagenavprev\">"); 
         print("<a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strNavpublicstate");
         print("&pn=" . ((($intChapter-1)*$intPublicchaptersize)-$intPublicchaptersize+1) . "");
         print("\">Prev $intPublicchaptersize pages</a>");
         print("</div>\n");
      }


      // display page links
      $intStartat = (($intChapter*$intPublicchaptersize) - ($intPublicchaptersize - 1));

      if ($intTotalpages < ($intChapter*$intPublicchaptersize))
         $intFinishat = $intTotalpages;
      else
         $intFinishat = ($intChapter*$intPublicchaptersize);

      for($x=$intStartat;$x<=$intFinishat;$x++)
      {
         if ($intPage == $x)
         {
            print("<div class=\"pagenavbox\">$x</div>\n");
         }
         else 
         {
            print("<div class=\"pagenavbox\">");
            print("<a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strNavpublicstate&pn=$x");
            print("\">$x</a></div>\n");
         }
      }

        
      // display next chapter link if it exists
      if (($intChapter * $intPublicchaptersize) < $intTotalpages)
      {
         print("<div id=\"pagenavnext\">");
         print("<a href=\"" . $_SERVER['PHP_SELF'] . "?search=true$strNavpublicstate");
         print("&pn=" . (($intChapter*$intPublicchaptersize)+1) . "");
         print("\">Next $intPublicchaptersize pages</a>");
         print("</div>\n");
      }


      print("</div>\n"); // end pagenavigation div
      print("</div>\n"); // end pagenavcontainer div

   } // end if total pages > 0


}




// ----------------------------------------------------------------------
//   Function    : get_public_state
//   Description : return part of a querystring which can be added to
//                 links to maintain search state
//   Usage       : get_public_state($intMode)
//   Arguments   : $intMode -  identifies whether to return querystring
//                             components for general or page navigation
//                             links
//
// ----------------------------------------------------------------------

function get_public_state($intMode) {


   $strPublicstate = "";
   $strNavpublicstate = "";

   if (isset($_REQUEST['key']))
   {
      if ($_REQUEST['key'] != "")
      { 
         $strPublicstate .= "&key=" . urlencode($_REQUEST['key']);
      }
   }

   if (isset($_REQUEST['stateID']))
   {
      if ($_REQUEST['stateID'] != "")
      { 
         $strPublicstate .= "&stateID=" . urlencode($_REQUEST['stateID']);
      }
   }

   if (isset($_REQUEST['country']))
   {
      if ($_REQUEST['country'] != "")
      { 
         $strPublicstate .= "&country=" . urlencode($_REQUEST['country']);
      }
   }


   $strNavpublicstate = $strPublicstate;


   if (isset($_REQUEST['pn']))
   {
      $strPublicstate .= "&pn=" . $_REQUEST['pn'];
   }


   //return result based on $intMode supplied
   if ($intMode == 0)
   {
      //pass back querystring version of current state
      return $strPublicstate;
   }
   else if ($intMode == 1)
   {
      //pass back querystring version of current state for navigation links
      return $strNavpublicstate;  
   }

}


?>

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.