
Originally Posted by
mlseim
Let's see what you have now (your script).
Hi guys, sorry for the delay to reply. I'm not able to post the whole script, because this forum limits the number of characters in a post. I have to cut it down, but here's (hopefully) all of the pertinent pieces, the PHP script, mySQL query, etc.
I am definitely open to your suggestions for a cleaner and more secure code. Thank you for your help!
Opening query:
HTML Code:
<!DOCTYPE HTML>
/* PHP Database */
<?php include("php-db-info-file.php");
$db = mysql_connect($hostname, $username, $password);
mysql_select_db($database, $db) or die("Unable to select database");
$query = "SELECT * FROM mp_episodes ORDER BY 'id'";
$result = mysql_query($query) or die(mysql_error() . ' in ' . $query);
$num = mysql_num_rows($result) or die(mysql_error() . ' in ' . $result);
/* Episodes */
$i=(int)$_GET['ep'];
if($i>$num) { $i=$num; }
$i--;
if($i<0) { $i=0; }
$n=1;
while ($n <= $num) {
$t[$n]=mysql_result($result,$n-1,"title");
$n++;
}
$id=mysql_result($result,$i,"id");
if($id < 10) {
$id="0$id";
}
$title=mysql_result($result,$i,"title");
$description=mysql_result($result,$i,"description");
$short_description=mysql_result($result,$i,"short_description");
$soundcloud=mysql_result($result,$i,"soundcloud");
$soundcloud_mini=mysql_result($result,$i,"soundcloud_mini");
/* Testimonials */
$query2 = "SELECT * FROM mp_reviews ORDER BY RAND()";
$result2 = mysql_query($query2) or die(mysql_error() . ' in ' . $query2);
$num2 = mysql_num_rows($result2) or die(mysql_error() . ' in ' . $result2);
?>
The Nav section:
HTML Code:
<html>
<head>
<title>The Meditation Podcast - a free podcast using guided meditation and binaural beats</title>
<meta http-equiv="content-type"content="text/html; charset=utf-8" />
<meta name="description"content="" />
<meta name="keywords"content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400"rel="stylesheet" />
<script src="js/jquery.min.js"></script>
<script src="js/config.js"></script>
<script src="js/skel.min.js"></script>
<noscript>
<link rel="stylesheet"href="css/skel-noscript.css" />
<link rel="stylesheet"href="css/style.css" />
<link rel="stylesheet"href="css/style-desktop.css" />
<link rel="stylesheet"href="css/noscript.css" />
</noscript>
<!--[if lte IE 8]><script src="js/html5shiv.js"></script><link rel="stylesheet" href="css/ie8.css" /><![endif]-->
</head>
<body class="homepage">
<!-- Wrapper-->
<div id="wrapper">
<!-- Nav -->
<nav id="nav">
<a href="#home"class="icon icon-home active"><span>Home</span></a>
<a href="#episodes"class="icon icon-play-sign"><span>Episodes</span></a>
<a href="#donate"class="icon icon-gift"><span>Donate</span></a>
<a href="#share"class="icon icon-mail-forward"><span>Share</span></a>
</nav>
A piece of the first "Main/Home" section, with some php for Testimonials:
HTML Code:
<!-- Main -->
<div id="main">
<!-- Home -->
<article id="home"class="panel">
<header>
<h1>The Meditation Podcast</h1>
<!-- Google -->
<script asyncsrc="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- TMP-468x15-text -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:15px;border:0;"
data-ad-client="ca-pub-9448368459623663"
data-ad-slot="2584185811"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</header>
<span class="image-home"></span>
<p>Welcome to The Meditation Podcast, a free podcast produced by Jesse and Jeane Stern, designed to help you benefit from meditation in your everyday life. </p>
<p>
Our podcast is unique because we use binaural beats in the audio that actually affect the brain waves, inducing a deep state of relaxation, and a brain pattern similar to REM sleep. This has the potential to bring about profound healing. We have received emails from people all over the world who have suffered from strokes, emotional losses, trauma, anxiety and insomnia, all of whom have benefitted from our podcast.*</p>
<p><ul class="testimonial">
<?php
$i2=0;
while ($i2 < 3) {
$id2=mysql_result($result2,$i2,"id");
$review=mysql_result($result2,$i2,"review");
$reviewer=mysql_result($result2,$i2,"reviewer");
?>
<li><span class="icon icon-user"style="color:#999;"></span><span>"<?php echo $review; ?>"</span>
</li>
<?php
$i2++;
}
?>
</ul></p>
</article>
A piece of the second "Episodes" section, with the Form tag, and php query for episodes:
HTML Code:
<!-- Episodes -->
<article id="episodes"class="panel">
<header>
<h2>The Meditation Podcast</h2>
<span class="byline">Choose an episode: </span>
<form action=""method="get">
<select name="ep">
<?php
$n=$num;
while ($n >= 1) {
if ($n !== ($i+1)) {
echo "<option value=$n>$t[$n]</option>";
} else {
echo "<option selected value=$n>$t[$n]</option>";
}
$n--;
}
?>
</select>
<input type="submit"value="Go">
</form>
</header>
<!-- SOUNDCLOUD -->
<?php echo $soundcloud; ?>
<!-- Google -->
<script asyncsrc="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- TMP-468x15-text -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:15px;border:0;"
data-ad-client="ca-pub-9448368459623663"
data-ad-slot="2584185811"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<button type="button"><div id="twitter-button"><a href="https://twitter.com/share"data-count="none"data-via="TmpPodcast"class="icon icon-twitter"><span> - Tweet</span></a><script type="text/javascript"src="//platform.twitter.com/widgets.js"></script></div></button>
<button type="button"><span><a href="episodes/tmp_<?php echo $id; ?>.mp3"title="Get this episode - click or right-click here"class="icon icon-cloud-download"> - Download</a></span></button>
<button type="button"><span><a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2FtheMeditationpodcast.com"class="icon icon-facebook-sign"> - Share</a></span></button>
<p><h3>Description - Episode <?php echo $id; ?></h3></p>
<?php echo $description; ?>
</article>
</div>
<!-- Footer -->
<div id="footer">
<ul class="links">
<li>theMeditationPodcast (at) gmail (dot) com</li>
<li>© 2006-2013 Jesse & Jeane Stern, all rights reserved</li>
<li>Design : <a href="http://html5up.net/"style="text-decoration:none;">HTML5 UP</a></li>
</ul>
</div>