All pastes #2099437 Raw Edit

Something

public text v1 · immutable
#2099437 ·published 2012-01-04 20:02 UTC
rendered paste body
<?php require_once('Connections/sginc.php'); ?>
<?php $rnum = rand(6,9) ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $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;
}
}
 
mysql_select_db($database_sginc, $sginc);
$query_selectHeading = "SELECT itemContent FROM mashupnew WHERE itemCategory = 'heading1' ORDER BY RAND() LIMIT 1;";
$selectHeading = mysql_query($query_selectHeading, $sginc) or die(mysql_error());
$row_selectHeading = mysql_fetch_assoc($selectHeading);
$totalRows_selectHeading = mysql_num_rows($selectHeading);
 
mysql_select_db($database_sginc, $sginc);
$query_selectBodyList = "
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'mainlist1' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'mainlist2' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'mainlist3' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'mainlist4' ORDER BY RAND() LIMIT 1)
";
$selectBodyList = mysql_query($query_selectBodyList, $sginc) or die(mysql_error());
$row_selectBodyList = mysql_fetch_assoc($selectBodyList);
$totalRows_selectBodyList = mysql_num_rows($selectBodyList);
 
mysql_select_db($database_sginc, $sginc);
$query_selectADhead = "SELECT itemContent FROM mashupnew WHERE itemCategory = 'adheading' ORDER BY RAND() LIMIT 1;";
$selectADhead = mysql_query($query_selectADhead, $sginc) or die(mysql_error());
$row_selectADhead = mysql_fetch_assoc($selectADhead);
$totalRows_selectADhead = mysql_num_rows($selectADhead);
 
mysql_select_db($database_sginc, $sginc);
$query_selectNShead = "SELECT itemContent FROM mashupnew WHERE itemCategory = 'nextstep' ORDER BY RAND() LIMIT 1;";
$selectNShead = mysql_query($query_selectNShead, $sginc) or die(mysql_error());
$row_selectNShead = mysql_fetch_assoc($selectNShead);
$totalRows_selectNShead = mysql_num_rows($selectNShead);
 
mysql_select_db($database_sginc, $sginc);
$query_selectNSbody = "SELECT itemContent FROM mashupnew WHERE itemCategory = 'nsbody' ORDER BY RAND() LIMIT 1;";
$selectNSbody = mysql_query($query_selectNSbody, $sginc) or die(mysql_error());
$row_selectNSbody = mysql_fetch_assoc($selectNSbody);
$totalRows_selectNSbody = mysql_num_rows($selectNSbody);
 
mysql_select_db($database_sginc, $sginc);
$query_selectRandomPanel = "SELECT itemID, itemImage, itemName, itemVerseText, itemVerseLocation FROM panels WHERE itemCTTSHORT = 'lifeofchrist' ORDER BY RAND() LIMIT 1;";
$selectRandomPanel = mysql_query($query_selectRandomPanel, $sginc) or die(mysql_error());
$row_selectRandomPanel = mysql_fetch_assoc($selectRandomPanel);
$totalRows_selectRandomPanel = mysql_num_rows($selectRandomPanel);
 
mysql_select_db($database_sginc, $sginc);
$query_selectBodyListItems = "
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist1' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist2' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist3' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist4' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist5' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist6' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist7' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist8' ORDER BY RAND() LIMIT 1)
UNION
(SELECT itemContent FROM mashupnew WHERE itemCategory = 'adlist9' ORDER BY RAND() LIMIT 1)
";

$selectBodyListItems = mysql_query($query_selectBodyListItems, $sginc) or die(mysql_error());
$totalRows_selectBodyListItems = mysql_num_rows($selectBodyListItems);
//$row_selectBodyListItems = mysql_fetch_assoc($selectBodyListItems);
$rnum_selectBodyListItems = rand(6,9);
$counter_selectBodyListItems = 0;
$bodyListItems = array()
while($thisRow = mysql_fetch_assoc($selectBodyListItems) && $counter_selectBodyListItems < $rnum_selectBodyListItems) {
	$bodyListItems[$counter_selectBodyListItems] = $thisRow;
	$counter_selectBodyListItems++;
}
mysql_free_result($selectBodyListItems);

?>
<!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>Untitled Document</title>
<style type="text/css">
*{margin:0;padding:0;}
html, body{background-color:#000;color:#c0c0c0;font-family:Arial;Verdana, sans-serif;font-size:14px;line-height:20px;}
h1, h2{color:#fff;}
div#content{width:800px;margin:0 auto;}
ul{margin-left:35px;}
h1, h2, h3{margin:10px;line-height:35px;}
img{float:left;margin:40px;}
p#vtext{margin-top:90px;font-style:italic;font-size:12px;}
p#vloc{font-style:italic;font-size:12px;}
</style>
</head>
<body>
	<div id="content">
		<div id="panel">
		<?php do { ?>
		<h1>Window <?php echo $row_selectRandomPanel['itemID']; ?>: <?php echo $row_selectRandomPanel['itemName']; ?></h1>
		<img alt="" src="images/glass/panels/medium/<?php echo $row_selectRandomPanel['itemImage']; ?>">
		<p id="vtext"><?php echo $row_selectRandomPanel['itemVerseText']; ?></p>
		<p id="vloc"><?php echo $row_selectRandomPanel['itemVerseLocation']; ?></p>
		<?php } while ($row_selectRandomPanel = mysql_fetch_assoc($selectRandomPanel)); ?>
		</div>
		<div id="mashup">
		<?php echo $row_selectHeading['itemContent']; ?>
		<ul>
		<?php do { ?>
		<?php echo $row_selectBodyList['itemContent']; ?>
		<?php } while ($row_selectBodyList = mysql_fetch_assoc($selectBodyList)); ?>
		</ul>
		<?php echo $row_selectADhead['itemContent']; ?> 
		<ul>
		<?php do { ?>
		  <?php echo $row_selectBodyListItems['itemContent']; ?>
		  <?php } while ($row_selectBodyListItems = mysql_fetch_assoc($selectBodyListItems)); ?>
		</ul>

		<?php echo $row_selectNShead['itemContent']; ?>

		<?php echo $row_selectNSbody['itemContent']; ?>
		<p>Stained Glass Inc.<br>Phone: 903-454-0904 | Web: http://www.stainedglassinc.com | Email: info@stainedglassinc.com<br>4400 Oneal St., Greenville, TX 75401
		</div>
	</div>
</body>
</html>
<?php
mysql_free_result($selectHeading);
mysql_free_result($selectBodyList);
mysql_free_result($selectADhead);
mysql_free_result($selectNShead);
mysql_free_result($selectNSbody);
mysql_free_result($selectRandomPanel);
mysql_free_result($selectBodyListItems);
?>