All pastes #71970 Raw Edit

headzoo

public php v1 · immutable
#71970 ·published 2006-06-26 12:13 UTC
rendered paste body
<?php/*Template Name: booking*/$missed = array();$missedMessage = null;if ($_POST) {	$emailAddress = 	$_POST['recipient'];	unset($_POST['recipient']);	$subject = 		$_POST['subject'];	unset($_POST['subject']);	$redirect = 		$_POST['redirect'];	unset($_POST['redirect']);	$required = 		$_POST['required'];	unset($_POST['required']);	$from =	 		$_POST['from_email'];	unset($_POST['from_email']);		$requiredFields = explode($required);	$missedFields = false;	foreach ($_POST as $key => $value) {		if (in_array($key, $requiredFields) && empty($value)) {			$missed[$key] = 'class="missed_field"';			$missedFields = true;		}	}	if (!$missedFields) {		foreach ($_POST as $key => $value) {			$emailMessage .= $key . " : $value\r\n";		}		mail($emailAddress, $subject, $emailMessage, "From: $from");		header("Location: $redirect");	} else {		$missedMessage = 'You missed fields.  Please fill in all required fields.';	}}?><?php get_header(); ?><div id="center">	<div class="center-top"></div>		<div class="center-left">					<h6 id="txt-booking">booking</h6>					<div class="page-inv">						<div class="body">														<div class="booking-wrap">						<div class="booking-form">						<FORM method="post">						<input type="hidden" name="recipient" value="cm@sudelectronic.com">						<input type="hidden" name="subject" value="sued electronic booking">						<input type="hidden" name="redirect" value="http://www.sudelectronic.com/">						<input type="hidden" name="from_email" value="bookings@sudelectronic.com" />						<?php if ($missedMessage) { ?> <p class="alert_message"><?php echo $missedMessage; ?></p> <?php } ?>						<strong>Please fill in the form for booking inquiries</strong> // Fields marked with * are required					<div style="width: 45%; padding: 7px 5% 0 0; float: left;">						<p>						<label>Email *</label>						<span><input type="text" <?php echo $missed['email_address']; ?> name="email_address" size="40" maxlength="40" value="<?php echo $_POST['email_address']; ?>" /></span>						</p><p>						<label>Name *</label>						<span><input type="text" <?php echo $missed['full_name']; ?> name="full_name" size="40" maxlength="40" value="<?php echo $_POST['full_name']; ?>" /></span>						</p><p>						<label>PO Box/Street Address</label>						<span><input type="text" <?php echo $missed['po box/ street adress']; ?> name="po box/ street adress" size="40" maxlength="40" value="<?php echo $_POST['po box/ street adress']; ?>" /></span>						</p><p>						<label>Postal/Zip Code</label>						<span><input type="text" <?php echo $missed['postal/ zip code']; ?> name="postal/ zip code" size="40" maxlength="40" value="<?php echo $_POST['postal/ zip code']; ?>" /></span>						</p><p>						<label>City *</label>						<span><input type="text" <?php echo $missed['city']; ?> name="city" size="40" maxlength="40"value="<?php echo $_POST['city']; ?>" /></span>						</p>					</div>					<div style="width: 45%; padding: 7px 5% 0 0; float: left;">						<p>						<label>Country *</label>						<span><input type="text" <?php echo $missed['country']; ?> name="country" size="40" maxlength="40" value="<?php echo $_POST['country']; ?>" /></span>						</p>						<p>						<label>Phone *</label>						<span><input type="text" <?php echo $missed['tel']; ?> name="tel" size="40" maxlength="40" value="<?php echo $_POST['tel']; ?>" /></span>						</p>						<p>						<label>Name of Club/Venue *</label>						<span><input type="text" <?php echo $missed['club/ venue']; ?> name="club/ venue" size="40" maxlength="40" value="<?php echo $_POST['club/ venue']; ?>" /></span>						</p>						<p>						<label>What kind of event (festival, clubnight etc.)</label>						<span><input type="text" <?php echo $missed['what_event']; ?> name="what_event" size="40" maxlength="40" value="<?php echo $_POST['what_event']; ?>" /></span>						</p>						<p>						<label>Suggested date/s * (DD.MM.YY)</label>						<span><input type="text" <?php echo $missed['event_date']; ?> name="event_date" size="40" maxlength="40" value="<?php echo $_POST['event_date']; ?>" /></span>						</p>					</div>					<div class="clr"></div>										<div style="width: 45%; padding: 22px 5% 0 0;">						<p>						<label>Artist you want to book *</label>													<span>						<select name="artist">						  <option selected>-- Select --</option>						  <option>Portable</option>						  <option>Akiko Kiyama</option>						  <option>Lump</option>						  <option>AM/PM</option>						  <option>Milos</option>						  <option>Kai</option>						  <option>Waterprotection</option>						</select>						</span>						</p>					</div>					<div style="width: 65%; padding: 22px 0 0 0;">							<p>						<label>Additional informations and comments</label>						<span><textarea <?php echo $missed['Comments']; ?> name="Comments" rows="6" cols="38"><?php echo $_POST['Comments']; ?></textarea></span>						</p>						<p>						<input type="submit" value="Submit"> <input type="reset" value="Reset">						</p>						<input type="hidden" name="required" value="email,name,city,country,club/ venue,artist,fee,date">						</form>											</div>											</div>					</div>				</div>								</div>		</div>			<div class="center-right">				<h6 id="txt-latest-releases">Latest Releases</h6>								<div class="entry-inv">				<?php					$results = $wpdb->get_results("SELECT ID, post_title, post_content FROM $wpdb->posts WHERE post_status = 'static' AND post_parent = 3 ORDER BY post_date DESC LIMIT 3", ARRAY_A);					if (!empty($results)) {						foreach ($results as $result) {											$postID = $result['ID'];							$title = htmlspecialchars($result['post_title']);							$permalink = get_permalink($postID);														if (get_post_meta($postID, 'excerpt', true)) {								$excerpt = get_post_meta($postID, 'excerpt', true);								$excerpt = nl2br($excerpt);							} else if (stristr($result['post_content'], '<!--more-->')) {								$excerpt = substr($result['post_content'], 0, strpos($result['post_content'], '<!--more-->'));								$excerpt = nl2br($excerpt);														} else {								$excerpt = $result['post_content'];								/**$excerpt = strip_tags($excerpt);*/								$excerpt_length = 55;								$words = explode(' ', $excerpt, $excerpt_length + 1);								if (count($words) > $excerpt_length) {									array_pop($words);									array_push($words, '[...]');									$excerpt = implode(' ', $words);								}								$excerpt = nl2br($excerpt);							}														/**							 This starts the "mini-loop".  Edit the HTML inside here to display the pages							 the way you want.							 */							?>								<div class="body-releases-list">								<p><?php do_action('the_teaser_image', 'http://www.sudelectronic.com/wp/wp-content/themes/sued/images/img-rec.jpg', $postID); ?>								<?php echo $excerpt; ?></p>								</div>															<?php							/**							 End of the mini-loop.  Don't edit past this point							 */						}					}				?>				</div>							</div>					<div class="clr"></div>			</div>			<div id="columns">		<div class="columns-left">		<h5 id="txt-nb-recent-entries">Recent News Blog Entries</h5>		<div class="columns-left-wrap">					<?php $posts = get_posts( "category=3&numberposts=1" ); ?>			<?php if( $posts ) : ?>			<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>		   			<div class="entry">				<div class="top">					<span class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></span>					<span class="date"><?php the_date('Y-m-d'); ?></span>				</div>										<div class="body">					<?php the_excerpt(); ?>					<div class="ifextended">						<span class="more"><a href="<?php comments_link(); ?>">Comments</a> . <a href="<?php the_permalink() ?>">Continue Reading</a></span>					</div>				</div>			</div>					<?php endforeach; ?>			<?php endif; ?>					</div>	</div>			<div class="columns-mid">			<h5 id="txt-nb-recent-comments">Recent Comments</h5>		<div class="columns-mid-wrap">				<div class="entry-list">								<ul>   			<?php c2c_get_recently_commented(4, "<li><span class=\"commented\">At %post_date% <strong>%post_author_posts%</strong> commented on</span><div class=\"title\">%post_URL%</div></li>", ""); ?>				</ul>			</div>		</div>	</div>		<div class="columns-right">					<h6 id="txt-contact-us">Contact Us</h6>		<div class="columns-right-wrap">			<div class="entry">				<div class="body-without-dots">				<p><?php					$content = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = 2");					$content = nl2br($content);						echo $content;						?></p>				</div>			</div>			</div>	</div>			</div>			<div class="clr"></div>	<?php get_footer(); ?>