Advertisement
Guest User

Untitled

a guest
Sep 19th, 2011
687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.40 KB | None | 0 0
  1. <?php
  2. /* Customise These Values */
  3. $name = 1;              //set to 1 to show name field, 0 to hide name field
  4. $name = $_REQUEST['name'];               
  5. $successMessage = '<h4>Thank you for your registration</h4><p>We will contact you again shortly with more information closer to the time of the party.</p>';
  6.  
  7. $exportPass = 'password'; //change this to something more secure
  8. /* Delete This */
  9. $_REQUEST['pass']=$exportPass;
  10. /* End Delete */
  11.  
  12.  
  13. if($_REQUEST['export']=='true'&&$_REQUEST['pass']==$exportPass){
  14.     $file='data.csv';
  15.     header("Content-type: application/force-download");
  16.     header("Content-Transfer-Encoding: Binary");
  17.     header("Content-length: ".filesize($file));
  18.     header("Content-disposition: attachment; filename=\"".basename($file)."\"");
  19.     header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
  20.     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  21.     header("Cache-Control: no-cache, must-revalidate");
  22.     header("Pragma: nocache");
  23.     readfile("$file");
  24. }else{
  25. ?>
  26.  
  27.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  28.     <html xmlns="http://www.w3.org/1999/xhtml">
  29.     <head>
  30. <title>Shire</title>
  31. <script src="http://code.jquery.com/jquery-latest.js"></script>
  32. <script src="js/jquery.bxSlider.min.js" type="text/javascript"></script>
  33. <script type="text/javascript">$(function(){$('#slider').bxSlider({auto:true,pager:true});});</script>
  34. <script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
  35. <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" media="screen" />
  36. <link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
  37. <link rel="stylesheet" type="text/css" href="css/form.css" media="screen" />
  38. <script type="text/javascript">$(document).ready(function() {$(".menu, .dresscode, .entertainment, .coaches, .car, .train, .hamptoncourt").fancybox({'width':880,'height':670,'autoScale':false,'transitionIn':'fade','transitionOut':'fade','type':'iframe'});});</script>
  39. <script language="javascript">
  40.     $(document).ready(function(){
  41.         $("form#register").submit(function(){
  42.               var email = $("input#email").val();
  43.               var name = $("input#name").val();
  44.               var attendance $( ".attendance" ).each( function()
  45. {
  46. if( this.checked == true )
  47. {
  48. attendance = this.value
  49. break
  50. }
  51. });
  52.  
  53.               if (email==""||email=="Email")
  54.               {
  55.                     $('#nameInput').append("<p class='required'>required</p>");
  56.                     document.register.email.value='Name';
  57.                     $('#emailInput').append("<p class='required'>required</p>");
  58.                     document.register.name.value='Email';
  59.                     return false;
  60.               }else if(email.indexOf("@") < 1){ // very basic check if email address entered is valid
  61.                     $('#emailInput').append("<p class='required'>invalid</p>"); //could have a different image for invalid input
  62.                     document.register.email.focus();  //could be used to focus on email field
  63.                     $('#nameInput').append("<p class='required'>invalid</p>"); //could have a different image for invalid input
  64.                     document.register.name.focus();
  65.                     return false;                  
  66.               }else{
  67.                   var sendData = 'email='+ email + '&name=' + name + '&attendance=' + attendance;
  68.                   $.ajax({
  69.                     type: "POST",
  70.                     url: "submit.php",
  71.                     data: sendData,
  72.                     success: function() {
  73.                       $('#right').html("<div id='submitted'></div>");
  74.                       $('#submitted').html("<?php echo $successMessage;?>")
  75.                       .hide()
  76.                       .fadeIn(1000, function() {
  77.                        
  78.                       });
  79.                     }
  80.                   });
  81.                   return false;
  82.               }
  83.         });  
  84.     });  
  85.     </script>
  86. </head>
  87.  
  88. <body>
  89. <?php if($_REQUEST['pass']==$exportPass){ ?>
  90.     <div style="position:absolute; top:10px; left:10px; z-index:99; color:#000;">
  91.         <a href="index.php?export=true&pass=<?php echo $exportPass; ?>&time=<?php echo time(); ?>">Export registrations</a>
  92.     </div>
  93.     <?php }?>
  94. <div id="container">
  95. <div id="slider">
  96.   <div class="slide"><img src="images/slider-1.gif" width="652" height="165" /></div>
  97.   <div class="slide"><img src="images/slider-2.gif" width="652" height="165" /></div>
  98.   <div class="slide"><img src="images/slider-3.gif" width="652" height="165" /></div>
  99.   <div class="slide"><img src="images/slider-4.gif" width="652" height="165" /></div>
  100.   <div class="slide"><img src="images/slider-5.gif" width="652" height="165" /></div>
  101. </div>
  102. <div id="leftcol">
  103. <h1>Shire's Annual Party 2011</h1>
  104.   <p>This year, we are excited to be hosting the Shire Annual Party in
  105.     the sumptuous surroundings of Hampton Court Palace.</p>
  106.   <p class="sand">At this stage please use the form below to let us know whether you are able to attend, further information can be found by clicking on
  107.     the buttons to the right.</p>
  108.   <p class="sand"> If you are able to attend you will be sent a further mail with a link through to a page so we can capture all your requirements eg. dietary, transport options etc.
  109. </p>
  110.  
  111.   <div id="registration">
  112.   <h2>Registration Form</h2>
  113.    <div id="right">
  114.    
  115. <form id="register" name="register" method="post" action="submit.php">
  116. <p>Are you able to attend?<br />
  117.       <label>
  118.        <input type="radio" name="attendance" value="Yes" class="attendance" />
  119.             Yes</label>
  120.         <label>
  121.           <input type="radio" name="attendance" value="No" class="attendance" />
  122.             No</label>
  123.        </label>
  124.     </p>
  125.     <div id="nameInput" class="fromrelative">                      
  126.     <input name="name" id="name" type="text" value="Enter your name" class="textBox" maxlength="54" onfocus="if(this.value=='Enter your name')this.value='';" />
  127.     </div>                                
  128.                                     <div id="emailInput" class="fromrelative">
  129.                                     <input name="email" id="email" type="text" value="Enter your Shire email address" class="textBox" maxlength="54" onfocus="if(this.value=='Enter your Shire email address')this.value='';" />
  130.                                    
  131.                               </div>
  132.                                     <input name="Submit" type="submit" value="" class="submit" />
  133.       </form>
  134.                           </div>
  135.   </div>
  136. </div>
  137.  
  138. <div id="rightcol">
  139. <h2>Useful Information</h2>
  140. <ul>
  141. <li><a href="menu.html" class="menu">Menu</a></li>
  142. <li><a href="dresscode.html" class="dresscode">Dress Code</a></li>
  143. <li><a href="entertainment.html" class="entertainment">Entertainment</a></li>
  144. <li><a href="coaches.html" class="coaches">Free Coaches</a></li>
  145. <li><a href="car.html" class="car">Directions by Car</a></li>
  146. <li><a href="train.html" class="train">Directions by Train</a></li>
  147. <li><a href="hamptoncourt.html" class="hamptoncourt">Hampton Court</a></li>
  148. </ul>
  149. <br /><br />
  150. <script language="JavaScript" src="audio/audio-player.js"></script>
  151. <object type="application/x-shockwave-flash" data="audio/player.swf" id="audioplayer1" height="24" width="170">
  152. <param name="movie" value="audio/player.swf">
  153. <param name="FlashVars" value="playerID=audioplayer1&bg=0xf9deaf&leftbg=0xfce9cb&
  154. lefticon=0xb18451&rightbg=0xfce9cb&rightbghover=0x999999&righticon=0xb18451&righticonhover=0xffffff&text=0xb18451&slider=0x666666&track=0xFFFFFF&border=0xf9deaf&loader=0xb18451&loop=yes&autostart=yes&soundFile=audio/music.mp3">
  155. <param name="quality" value="high">
  156. <param name="menu" value="false">
  157. <param name="wmode" value="transparent">
  158. </object>
  159.  
  160. </div>
  161.  
  162.  
  163. </div>
  164. </body>
  165. </html>
  166. <?php
  167. }
  168. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement