Advertisement
Guest User

Untitled

a guest
Jun 8th, 2015
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.80 KB | None | 0 0
  1. <?php
  2. if( isset($_POST['name']) )
  3. {
  4. //$to = 'eshop@optiplaza.ro'; // Replace with your email
  5. $to = $_POST['budget'].',eshop@optiplaza.ro';
  6. $subject = 'Programare servicii'; // Replace with your subject if you need
  7. $message = 'Nume: ' . $_POST['name'] . "n" .
  8. 'Prenume: ' . $_POST['company']. "n" .
  9. 'E-mail: ' . $_POST['email']. "n" .
  10. 'Telefon: ' . $_POST['phone']. "nn" .
  11. 'Doresc: ' . $_POST['interested']. "n" .
  12. 'Magazin: ' . $_POST['budget']. "n" .
  13. 'Incepand cu: ' . $_POST['start']. "n" .
  14. 'Pana la: ' . $_POST['finish']. "n" .
  15. 'Observatii: ' . $_POST['comment']. "nnn";
  16.  
  17.  
  18. // Get a random 32 bit number.
  19. $num = md5(time());
  20.  
  21. // Define the main headers.
  22. $headers = 'From:' . $_POST['name'] . "rn";
  23. $headers .= 'Reply-To:' . $_POST['email'] . "rn";
  24. $headers .= "MIME-Version: 1.0rn";
  25. $headers .= "Content-Type: multipart/mixed; ";
  26. $headers .= "boundary=$numrn";
  27. $headers .= "--$numrn";
  28.  
  29. // Define the message section
  30. $headers .= "Content-Type: text/plainrn";
  31. $headers .= "Content-Transfer-Encoding:8bitrnn";
  32. $headers .= "$messagern";
  33. $headers .= "--$numrn";
  34.  
  35. if( isset($_FILES['file']['tmp_name']) )
  36. {
  37. // Read the file into a variable
  38. $file = fopen($_FILES['file']['tmp_name'], 'r');
  39. $size = $_FILES['file']['size'];
  40. $content = fread($file, $size);
  41. $encoded_content = chunk_split(base64_encode($content));
  42.  
  43. // Define the attachment section
  44. $headers .= "Content-Type: ". $_FILES['file']['type'] ."; ";
  45. $headers .= 'name="' . $_FILES['file']['name'] . '"' . "rn";
  46. $headers .= "Content-Transfer-Encoding: base64rn";
  47. $headers .= "Content-Disposition: attachment; ";
  48. $headers .= 'filename="' . $_FILES['file']['name'] . '"' . "rnn";
  49. $headers .= "$encoded_contentrn";
  50. $headers .= "--$num--";
  51. }
  52.  
  53. // Send email
  54. mail($to, $subject, '', $headers);
  55. }
  56. ?>
  57.  
  58. <!DOCTYPE html>
  59. <html>
  60. <head>
  61. <title>Programare servicii</title>
  62.  
  63. <meta charset="utf-8">
  64. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  65.  
  66. <link rel="stylesheet" href="css/demo.css">
  67. <link rel="stylesheet" href="css/font-awesome.css">
  68. <link rel="stylesheet" href="css/sky-forms.css">
  69. <link rel="stylesheet" href="css/sky-forms-red.css">
  70. <!--[if lt IE 9]>
  71. <link rel="stylesheet" href="css/sky-forms-ie8.css">
  72. <![endif]-->
  73.  
  74. <script src="js/jquery.min.js"></script>
  75. <script src="js/jquery-ui.min.js"></script>
  76. <script src="js/jquery.form.min.js"></script>
  77. <script src="js/jquery.validate.min.js"></script>
  78. <!--[if lt IE 10]>
  79. <script src="js/jquery.placeholder.min.js"></script>
  80. <![endif]-->
  81. <!--[if lt IE 9]>
  82. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  83. <script src="js/sky-forms-ie8.js"></script>
  84. <![endif]-->
  85. </head>
  86.  
  87. <body class="bg-red">
  88. <div class="body">
  89. <form action="programari.php" method="post" enctype="multipart/form-data" id="sky-form" class="sky-form">
  90. <header>Programare servicii:</header>
  91.  
  92. <fieldset>
  93. <div class="row">
  94. <section class="col col-6">
  95. <label class="input">
  96. <i class="icon-append fa fa-user"></i>
  97. <input type="text" name="name" placeholder="Nume">
  98. </label>
  99. </section>
  100. <section class="col col-6">
  101. <label class="input">
  102. <i class="icon-append fa fa-user"></i>
  103. <input type="text" name="company" placeholder="Prenume">
  104. </label>
  105. </section>
  106. </div>
  107.  
  108. <div class="row">
  109. <section class="col col-6">
  110. <label class="input">
  111. <i class="icon-append fa fa-envelope-o"></i>
  112. <input type="email" name="email" placeholder="E-mail">
  113. </label>
  114. </section>
  115. <section class="col col-6">
  116. <label class="input">
  117. <i class="icon-append fa fa-phone"></i>
  118. <input type="tel" name="phone" placeholder="Telefon">
  119. </label>
  120. </section>
  121. </div>
  122. </fieldset>
  123.  
  124. <fieldset>
  125. <div class="row">
  126. <section class="col col-6">
  127. <label class="select">
  128. <select name="interested">
  129. <option value="none" selected disabled>Alege serviciul</option>
  130. <option value="Ochelari de vedere">Ochelari de vedere</option>
  131. <option value="Consult oftalmologic">Determinare dioptrii</option>
  132. <option value="Card smart">Card smart</option>
  133. </select>
  134. <i></i>
  135. </label>
  136. </section>
  137. <section class="col col-6">
  138. <label class="select">
  139. <select name="budget">
  140. <option value="" selected disabled>Alege magazinul</option>
  141. <option value="email@email.ro">Alba-Iulia-Mall Alba</option>
  142. <option value="email1@email.ro">Bucuresti-Centrul Comercial Orhideea</option>
  143. <option value="email2@email.ro">Bucuresti-Mall Vitan</option>
  144. <option value="email3@email.ro">Bucuresti-Baneasa Shopping City</option>
  145. <option value="email4@email.ro">Bucuresti-Centrul Comercial Esplanada</option>
  146. <option value="email5@email.ro">Bucuresti-Liberty Center</option>
  147. <option value="email6@email.ro">Bucuresti-AFI Palace Cotroceni</option>
  148. <option value="email7@email.ro">Centru Brasov</option>
  149. <option value="email8@email.ro">Coresi Brasov</option>
  150. <option value="email9@email.ro">Cluj-Polus Mall</option>
  151. <option value="email10@email.ro">Constanta-Centrul Comercial Tom</option>
  152. <option value="email11@email.ro">Iasi-Centrul Comercial Felicia</option>
  153. <option value="email12@email.ro">Iasi-Palas Mall</option>
  154. <option value="email13@email.ro">Valcea-River Plaza Mall</option>
  155. <option value="email14@email.ro">Pitesti-Jupiter City</option>
  156. <option value="email15@email.ro">Sibiu-Promenada Mall</option>
  157. <option value="email16@email.ro">Ploiesti-AFI Palace</option>
  158. </select>
  159. <i></i>
  160. </label>
  161. </section>
  162. </div>
  163.  
  164. <div class="row">
  165. <section class="col col-6">
  166. <label class="input">
  167. <i class="icon-append fa fa-calendar"></i>
  168. <input type="text" name="start" id="start" placeholder="Incepand cu...">
  169. </label>
  170. </section>
  171. <section class="col col-6">
  172. <label class="input">
  173. <i class="icon-append fa fa-calendar"></i>
  174. <input type="text" name="finish" id="finish" placeholder="Pana la...">
  175. </label>
  176. </section>
  177. </div>
  178.  
  179. <section>
  180. <label for="file" class="input input-file">
  181. <div class="button"><input type="file" name="file" multiple onchange="this.parentNode.nextSibling.value = this.value">Cauta</div><input type="text" placeholder="Reteta. Doar daca aveti." readonly>
  182. </label>
  183. </section>
  184.  
  185. <section>
  186. <label class="textarea">
  187. <i class="icon-append fa fa-comment"></i>
  188. <textarea rows="5" name="comment" placeholder="Observatii..."></textarea>
  189. </label>
  190. </section>
  191. </fieldset>
  192. <footer>
  193. <button type="submit" class="button">Trimite</button>
  194. <div class="progress"></div>
  195. <!-- <h5 style="color:red">Vei fi contactat de catre colegii din magazinul ales</h5>-->
  196. </footer>
  197. <div class="message">
  198. <i class="fa fa-check"></i>
  199. <p>Multumim!<br>Un consultant o sa va contacteze in cel mai scurt timp posibil.</p>
  200. </div>
  201. </form>
  202. </div>
  203.  
  204. <script type="text/javascript">
  205. $(function()
  206. {
  207. // Datepickers
  208. $('#start').datepicker({
  209. dateFormat: 'dd.mm.yy',
  210. prevText: '<i class="fa fa-chevron-left"></i>',
  211. nextText: '<i class="fa fa-chevron-right"></i>',
  212. onSelect: function( selectedDate )
  213. {
  214. $('#finish').datepicker('option', 'minDate', selectedDate);
  215. }
  216. });
  217. $('#finish').datepicker({
  218. dateFormat: 'dd.mm.yy',
  219. prevText: '<i class="fa fa-chevron-left"></i>',
  220. nextText: '<i class="fa fa-chevron-right"></i>',
  221. onSelect: function( selectedDate )
  222. {
  223. $('#start').datepicker('option', 'maxDate', selectedDate);
  224. }
  225. });
  226.  
  227. // Validation
  228. $("#sky-form").validate(
  229. {
  230. // Rules for form validation
  231. rules:
  232. {
  233. name:
  234. {
  235. required: true
  236. },
  237. email:
  238. {
  239. required: true,
  240. email: true
  241. },
  242. phone:
  243. {
  244. required: true
  245. },
  246. interested:
  247. {
  248. required: true
  249. },
  250. budget:
  251. {
  252. required: true
  253. }
  254. },
  255.  
  256. // Messages for form validation
  257. messages:
  258. {
  259. name:
  260. {
  261. required: 'Introduceti numele'
  262. },
  263. email:
  264. {
  265. required: 'Introduceti adresa de E-mail',
  266. email: 'Introduceti o adresa de email valida'
  267. },
  268. phone:
  269. {
  270. required: 'Introduceti numarul de Telefon'
  271. },
  272. interested:
  273. {
  274. required: 'Va rugam selectati serviciile dorite'
  275. },
  276. budget:
  277. {
  278. required: 'Va rugam selectati magazinul'
  279. }
  280. },
  281.  
  282. // Ajax form submition
  283. submitHandler: function(form)
  284. {
  285. $(form).ajaxSubmit(
  286. {
  287. beforeSend: function()
  288. {
  289. $('#sky-form button[type="submit"]').addClass('button-uploading').attr('disabled', true);
  290. },
  291. uploadProgress: function(event, position, total, percentComplete)
  292. {
  293. $("#sky-form .progress").text(percentComplete + '%');
  294. },
  295. success: function()
  296. {
  297. $("#sky-form").addClass('submited');
  298. $('#sky-form button[type="submit"]').removeClass('button-uploading').attr('disabled', false);
  299. }
  300. });
  301. },
  302.  
  303. // Do not change code below
  304. errorPlacement: function(error, element)
  305. {
  306. error.insertAfter(element.parent());
  307. }
  308. });
  309. });
  310. </script>
  311. </body>
  312. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement