All pastes #749148 Raw Edit

Mine

public text v1 · immutable
#749148 ·published 2007-10-25 13:40 UTC
rendered paste body
<?php require_once('Connections/stoneply.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_stoneply, $stoneply);
$query_typeSelect = "SELECT DISTINCT type_of_stone FROM stones ORDER BY type_of_stone ASC";
$typeSelect = mysql_query($query_typeSelect, $stoneply) or die(mysql_error());
$row_typeSelect = mysql_fetch_assoc($typeSelect);
$totalRows_typeSelect = mysql_num_rows($typeSelect);
mysql_select_db($database_stoneply, $stoneply);
$query_colorSelect = "SELECT DISTINCT country_of_origin FROM stones ORDER BY country_of_origin ASC";
$colorSelect = mysql_query($query_colorSelect, $stoneply) or die(mysql_error());
$row_colorSelect = mysql_fetch_assoc($colorSelect);
$totalRows_colorSelect = mysql_num_rows($colorSelect);

$maxRows_sOptions = 20;
$pageNum_sOptions = 0;
if (isset($_GET['pageNum_sOptions'])) {
  $pageNum_sOptions = $_GET['pageNum_sOptions'];
}
$startRow_sOptions = $pageNum_sOptions * $maxRows_sOptions;

mysql_select_db($database_stoneply, $stoneply);
$query_sOptions = "SELECT title, picture, country_of_origin FROM stones";
$query_limit_sOptions = sprintf("%s LIMIT %d, %d", $query_sOptions, $startRow_sOptions, $maxRows_sOptions);
$sOptions = mysql_query($query_limit_sOptions, $stoneply) or die(mysql_error());
$row_sOptions = mysql_fetch_assoc($sOptions);

if (isset($_GET['totalRows_sOptions'])) {
  $totalRows_sOptions = $_GET['totalRows_sOptions'];
} else {
  $all_sOptions = mysql_query($query_sOptions);
  $totalRows_sOptions = mysql_num_rows($all_sOptions);
}
$totalPages_sOptions = ceil($totalRows_sOptions/$maxRows_sOptions)-1;

$queryString_sOptions = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_sOptions") == false && 
        stristr($param, "totalRows_sOptions") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_sOptions = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_sOptions = sprintf("&totalRows_sOptions=%d%s", $totalRows_sOptions, $queryString_sOptions);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Stoneply | A Stromberg Company</title>
<link rel="stylesheet" href="styles.css" type="text/css" media="screen">
<meta name="robots" content="all">
<meta name='keywords' content=''>
<link rel="shortcut icon" href="./images/favicon.ico" type="image/x-icon">
<script src="./includes/sifr.js" type="text/javascript"></script>
<script src="./includes/sifr-addons.js" type="text/javascript"></script>
<!--[if lt IE 7]><script src="./ie7/ie7-standard-p.js" type="text/javascript"></script><![endif]-->
<!--[if lt IE 7]>
<style type="text/css">
div#container{background:#fff url('./images/left.jpg') repeat-y bottom left; width:830px;}
div#footer{clear:both; text-align:center; margin:0 -20px 0 22px;  padding:0 0 5px 0;background:#efe9d6; width:auto;} 
</style><![endif]-->
<script src="includes/sifrstatements.js" type="text/javascript"></script>
<style type="text/css">
td.soimage{padding-right:20px;}
td.soimage img{width:50px;height:50px;border:1px solid #c0c0c0;padding:2px;}
td.socountry{padding-left:50px;}
ul.sonav li{display:inline;}
table thead tr{margin-bottom:20px;}
table tbody td{vertical-align:middle;}
p.showrow, caption{font-size:12px;}
table thead th{font-size:bold;text-align:center;padding-bottom:30px;}
</style>
</head>
<body>
<div id="container">
	<div id="left">
		<div id="headermenu"> <img class="stoneply_logo" src="./images/stoneply_logo.jpg" alt="StonePly Logo">
			<h1><a href="http://www.stoneply.com" name="top" id="top" title="StonePly">StonePly</a></h1>
			<br>
			<br class="clear">
			<p>A Division of</p>
			<img class="stromberg_logo" src="./images/stromberg_logo.jpg" alt="Stomberg Logo">
			<h2><a href="http://www.4stromberg.com">The Stromberg Group</a></h2>
		</div>
		<div id="stoneselect">
			<h3>StoneSelect<sup>&copy;</sup></h3>
			<form action="stoneselect_results.php" enctype="multipart/form-data" id="form_stoneselect" method="post">
				<fieldset>
                <legend>Filter by:</legend>
				<label>Color</label>
				<select  name="color">
					<?php
do {  
?>
					<option value="<?php echo $row_colorSelect['country_of_origin']?>"><?php echo $row_colorSelect['country_of_origin']?></option>
					<?php
} while ($row_colorSelect = mysql_fetch_assoc($colorSelect));
  $rows = mysql_num_rows($colorSelect);
  if($rows > 0) {
      mysql_data_seek($colorSelect, 0);
	  $row_colorSelect = mysql_fetch_assoc($colorSelect);
  }
?>
				</select>
				<label>Type</label>
				<select  name="type">
					<?php
do {  
?>
					<option value="<?php echo $row_typeSelect['type_of_stone']?>"><?php echo $row_typeSelect['type_of_stone']?></option>
					<?php
} while ($row_typeSelect = mysql_fetch_assoc($typeSelect));
  $rows = mysql_num_rows($typeSelect);
  if($rows > 0) {
      mysql_data_seek($typeSelect, 0);
	  $row_typeSelect = mysql_fetch_assoc($typeSelect);
  }
?>
				</select>
				<input class="find" type="submit" id="find" value="Find" title="Find" name="Find">
				</fieldset>
			</form>
			<div id="process">
				<h2>See our Process</h2>
				<p><a href="process.php" title="Process 1"><img src="./images/process_1.jpg" alt="Process 1"></a>&nbsp;<a href="process.php" title="Process 2"><img src="./images/process_2.jpg" alt="Process 2"></a></p>
			</div>
		</div>
		<div id="featured">
			<div id="learn_textures"> <img src="./images/special_textures_img.jpg" alt="Learn more about special textures"> <img class="text" src="./images/special_textures.jpg" alt="Learn more about special textures">
				<p class="learn"><a href="" title="Learn more about special textures">Learn More</a></p>
			</div>
			<div id="learn_special"> <img src="./images/special_applications.jpg" alt="Learn more about  Special Applications">
				<p class="learn"><a href="" title="Learn more about special applications">Learn More</a></p>
			</div>
		</div>
	</div>
	<div id="main">
		<?php include 'includes/main_nav.htm'; ?>
		<div id="featured_project"> <img src="./images/featured_project.jpg"  alt="Featured Project"/></div>
		<div id="content">
        <ul class="sonav">
          <?php if ($pageNum_sOptions > 0) { // Show if not first page ?>
            <li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, 0, $queryString_sOptions); ?>">First</a></li>
            <?php } // Show if not first page ?>
            <?php if ($pageNum_sOptions > 0) { // Show if not first page ?>
            <li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, max(0, $pageNum_sOptions - 1), $queryString_sOptions); ?>">Previous</a></li>
            <?php } // Show if not first page ?>
			<li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, min($totalPages_sOptions, $pageNum_sOptions + 1), $queryString_sOptions); ?>">Next</a></li>
        	<?php if ($pageNum_sOptions < $totalPages_sOptions) { // Show if not last page ?>
          	<li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, $totalPages_sOptions, $queryString_sOptions); ?>">Last</a></li>
          	<?php } // Show if not last page ?>
		</ul>
          <table>
          <caption>Complete list of StonePly stone options</caption>
          <thead>
            <tr>
              <th>Title</th>
              <th>Picture</th>
              <th>Country of Origin</th>
            </tr>
            <thead>
            <tbody>
            <?php do { ?>
              <tr>
                <td><?php echo $row_sOptions['title']; ?></td>
                <td class="soimage"><img src=".<?php echo $row_sOptions['picture']; ?>"></td>
                <td class="socountry"><?php echo $row_sOptions['country_of_origin']; ?></td>
              </tr>
              <?php } while ($row_sOptions = mysql_fetch_assoc($sOptions)); ?>
             </tbody>
          </table>
    	<ul class="sonav">
          	<?php if ($pageNum_sOptions > 0) { // Show if not first page ?>
            <li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, 0, $queryString_sOptions); ?>">First</a></li>
            <?php } // Show if not first page ?>
            <?php if ($pageNum_sOptions > 0) { // Show if not first page ?>
            <li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, max(0, $pageNum_sOptions - 1), $queryString_sOptions); ?>">Previous</a></li>
            <?php } // Show if not first page ?>
			<li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, min($totalPages_sOptions, $pageNum_sOptions + 1), $queryString_sOptions); ?>">Next</a></li>
        	<?php if ($pageNum_sOptions < $totalPages_sOptions) { // Show if not last page ?>
          	<li><a href="<?php printf("%s?pageNum_sOptions=%d%s", $currentPage, $totalPages_sOptions, $queryString_sOptions); ?>">Last</a></li>
          	<?php } // Show if not last page ?>
		 </ul>
         <p class="showrow">Stones <?php echo ($startRow_sOptions + 1) ?> through <?php echo min($startRow_sOptions + $maxRows_sOptions, $totalRows_sOptions) ?> of <?php echo $totalRows_sOptions ?></p>
         </div>
  </div>
	<div id="footer">
		<p class="top"><img src="./images/arrow_px_up.gif" alt="Back to top">&nbsp;<a href="#top" title="Back to top">Back to top</a></p>		<dl>
			<dt>Useful Links</dt>
			<dd>
				<ul>
					<li class="first"><a href="samples.php" title="Click here to get samples">Get Samples</a></li>
					<li><a href="contact_us.php" title="Click here to contact us">Contact Us</a></li>
					<li><a href="stoneply_sitemap.php" title="Click here to view the site map">Site Map</a></li>
				</ul>
			</dd>
		</dl>
		<p id="copy">&copy; 2007 <a href="http://www.4stromberg.com" title="The Stromberg Group">The Stromberg Group</a>. All rights reserved</p>
	</div>
</div>
</body>
</html>
<?php
mysql_free_result($typeSelect);
mysql_free_result($colorSelect);
mysql_free_result($sOptions);
?>