Advertisement
Guest User

ANGELA

a guest
Jul 6th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.86 KB | None | 0 0
  1. <?php
  2. error_reporting( ~E_NOTICE ); // avoid notice
  3. session_start();
  4. ob_start();
  5. $passwordd = $_SESSION['passwordd'];
  6. $userid = $_SESSION['usernamee'];
  7. $empno = $_SESSION['employee_no'];
  8. $cartrn = $_SESSION["cartno"];
  9. ?>
  10.  
  11. <?php
  12. if(isset($_POST['submit']))
  13. {
  14. //SMTP needs accurate times, and the PHP time zone MUST be set
  15. //This should be done in your php.ini, but this is how to do it if you don't have access to that
  16. date_default_timezone_set('Etc/UTC');
  17.  
  18. include('connectdb.php');
  19. //get cart no
  20. $sql = "SELECT * FROM cart_rec WHERE cartrn = '$cartrn'";
  21. $result = $conn->query($sql);
  22. while($data = $result->fetch_assoc()) {
  23. $fn = $data['cartfn'];
  24. $pname = $data['cartname'];
  25. $email = $data['cartemail'];
  26. $To = $data['cartemail']; }
  27.  
  28. require 'PHPMailerAutoload.php';
  29.  
  30. $mail = new PHPMailer;
  31. //Tell PHPMailer to use SMTP
  32. $mail->isSMTP();
  33. //Enable SMTP debugging
  34. // 0 = off (for production use)
  35. // 1 = client messages
  36. // 2 = client and server messages
  37. $mail->SMTPDebug = 2;
  38. //Ask for HTML-friendly debug output
  39. $mail->Debugoutput = 'html';
  40. //Set the hostname of the mail server
  41. $mail->Host = 'shop.onemarketglobal.com.ph';
  42. // use
  43. // $mail->Host = gethostbyname('smtp.gmail.com');
  44. // if your network does not support SMTP over IPv6
  45.  
  46. //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
  47. $mail->Port = 587;
  48. //Set the encryption system to use - ssl (deprecated) or tls
  49. $mail->SMTPSecure = 'tls';
  50.  
  51. //Whether to use SMTP authentication
  52. $mail->SMTPAuth = true;
  53. $mail->SMTPOptions = array(
  54. 'ssl' => array(
  55. 'verify_peer' => false,
  56. 'verify_peer_name' => false,
  57. 'allow_self_signed' => true
  58. )
  59. );
  60. //Username to use for SMTP authentication - use full email address for gmail
  61. $mail->Username = "no-reply@shop.onemarketglobal.com.ph";
  62.  
  63. //Password to use for SMTP authentication
  64. $mail->Password = "amcvillamar";
  65.  
  66. //Set who the message is to be sent from
  67. $mail->setFrom('no-reply@shop.onemarketglobal.com.ph', 'One Market Global');
  68.  
  69. //Set an alternative reply-to address
  70. $mail->addReplyTo('no-reply@shop.onemarketglobal.com.ph', 'One Market Global');
  71.  
  72. //Set who the message is to be sent to
  73. $address = $To;
  74. $mail->addAddress($address);
  75.  
  76. //Set the subject line
  77. $mail->Subject = 'Good Day!';
  78.  
  79. //Read an HTML message body from an external file, convert referenced images to embedded,
  80. //convert HTML into a basic plain-text alternative body
  81. $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  82.  
  83. //Replace the plain text body with one created manually
  84. $mail->Body = 'Good day! This is Angela Villamar from On.Ma.Glo Marketing. We would like to inform you that you have completed your order. Wait for the admins to approve your order. Thank you!';
  85. $mail->AltBody = 'Regarding your Order..';
  86. //send the message, check for errors
  87. if (!$mail->send()) {
  88. echo "Mailer Error: " . $mail->ErrorInfo;
  89. }
  90.  
  91. else {
  92. include('connect.php');
  93. $sql = "INSERT INTO comments(comment_subject, comment_text, comment_user)
  94. VALUES ('$fn', '$pname', '$userid')";
  95.  
  96. if ($conn->query($sql) === TRUE) {
  97. header("Location: shoppaymentok.php");
  98. }
  99. else {
  100. echo "Error updating record: " . $conn->error;
  101. }
  102. }
  103. exit();
  104.  
  105. //Section 2: IMAP
  106. //Uncomment these to save your message in the 'Sent Mail' folder.
  107. #if (save_mail($mail)) {
  108. # echo "Message saved!";
  109. #}
  110.  
  111.  
  112.  
  113.  
  114. //Section 2: IMAP
  115. //IMAP commands requires the PHP IMAP Extension, found at: https://php.net/manual/en/imap.setup.php
  116. //Function to call which uses the PHP imap_*() functions to save messages: https://php.net/manual/en/book.imap.php
  117. //You can use imap_getmailboxes($imapStream, '/imap/ssl') to get a list of available folders or labels, this can
  118. //be useful if you are trying to get this working on a non-Gmail IMAP server.
  119. function save_mail($mail) {
  120. //You can change 'Sent Mail' to any other folder or tag
  121. $path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail";
  122.  
  123. //Tell your server to open an IMAP connection using the same username and password as you used for SMTP
  124. $imapStream = imap_open($path, $mail->Username, $mail->Password);
  125.  
  126. $result = imap_append($imapStream, $path, $mail->getSentMIMEMessage());
  127. imap_close($imapStream);
  128.  
  129. return $result;
  130. }
  131. }
  132. ?>
  133.  
  134.  
  135. <!DOCTYPE html>
  136. <html lang="en-US" dir="ltr">
  137.  
  138. <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>
  139. <style>
  140. /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */
  141. .multi-steps > li.is-active:before, .multi-steps > li.is-active ~ li:before {
  142. content: counter(stepNum);
  143. font-family: inherit;
  144. font-weight: 500;
  145. font-size: 20px;
  146. }
  147. .multi-steps > li.is-active:after, .multi-steps > li.is-active ~ li:after {
  148. background-color: #ededed;
  149. }
  150.  
  151. .multi-steps {
  152. display: table;
  153. table-layout: fixed;
  154. width: 100%;
  155. }
  156. .multi-steps > li {
  157. counter-increment: stepNum;
  158. text-align: center;
  159. display: table-cell;
  160. position: relative;
  161. color: tomato;
  162. }
  163. .multi-steps > li:before {
  164. content: '\f00c';
  165. content: '\2713;';
  166. content: '\10003';
  167. content: '\10004';
  168. content: '\2713';
  169. display: block;
  170. margin: 0 auto 4px;
  171. background-color: #fff;
  172. width: 40px;
  173. height: 36px;
  174. line-height: 32px;
  175. text-align: center;
  176. font-weight: bold;
  177. border-width: 4px;
  178. border-style: solid;
  179. border-color: tomato;
  180. border-radius: 80%;
  181. }
  182. .multi-steps > li:after {
  183. content: '';
  184. height: 2px;
  185. width: 100%;
  186. background-color: tomato;
  187. position: absolute;
  188. top: 16px;
  189. left: 50%;
  190. z-index: -1;
  191. }
  192. .multi-steps > li:last-child:after {
  193. display: none;
  194. }
  195. .multi-steps > li.is-active:before {
  196. background-color: #fff;
  197. border-color: tomato;
  198. }
  199. .multi-steps > li.is-active ~ li {
  200. color: #808080;
  201. }
  202. .multi-steps > li.is-active ~ li:before {
  203. background-color: #ededed;
  204. border-color: #ededed;
  205. }
  206.  
  207. .shop-Cart-totalbox {
  208. background-color: #fcfcfc;
  209. padding: 5px 20px 15px 20px;
  210. border: 1px solid lightgrey;
  211.  
  212. }
  213. </style>
  214. <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
  215. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  216. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  217. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  218.  
  219. <!--================TITLE, HEADER, NAVIGATION=================-->
  220. <?php
  221. //get prod id
  222. if(isset($_GET['id']) && !empty($_GET['id']))
  223. {
  224. $code = $_GET['id'];
  225.  
  226. }
  227.  
  228. if(!empty($code)) {
  229.  
  230. include('naviguest.php'); }
  231.  
  232. else {
  233. include('naviall.php');
  234. }
  235. ?>
  236.  
  237.  
  238. <div class="main">
  239. <section class="module">
  240. <div class="container">
  241. <div class="row">
  242. <div class="col-sm-6 col-sm-offset-3">
  243. <h1 class="module-title font-alt">FINISH</h1>
  244. <div class="container-fluid">
  245. <br /><br />
  246. <ul class="list-unstyled multi-steps">
  247. <li>Start</li>
  248. <li>First Step</li>
  249. <li>Middle Stage</li>
  250. <li class="is-active">Finish</li>
  251. </ul>
  252. </div>
  253. </div>
  254. </div>
  255. </div>
  256.  
  257. <section class="module pt-0 pb-0" id="about">
  258. <div class="row position-relative m-0">
  259. <div class="col-xs-12 col-md-6 side-image" data-background="assets/images/ty.jpg"></div>
  260. <div class="col-xs-12 col-md-6 col-md-offset-6 side-image-text">
  261. <div class="row">
  262. <div class="col-sm-12">
  263. <form method="POST">
  264. <input type="hidden" name="subject" id="subject" value="ORDER COMPLETE!" class="form-control">
  265. <input type="hidden" name="comment" id="comment" class="form-control" value="<a href='myorder.php' style='color:#ffffff'><h5>&nbsp; My Order</h5></a>" rows="5">
  266. <h2 class="module-title font-alt align-left" style="color:#846e01">Your Order Details</h2>
  267.  
  268. <?php
  269. if(!empty($code)) { ?>
  270. <div class="module-subtitle font-serif align-left">Please take note of your order details. Click here to view your Order: <a href="myorder.php?id=<?php echo $code;?>" style="color:#b73e66"><u><h3> View my Order</h3></u></a></div><br>
  271.  
  272. <?php } else { ?>
  273. <div class="module-subtitle font-serif align-left">Please take note of your order details. Click here to view your Order: <a href="myorder.php" style="color:#b73e66"><u><h3> Please go here to view the Order </h3></u></a></div>
  274. <?php } ?>
  275.  
  276. <?php include('connectdb.php');
  277. //get cart no
  278. $sql = "SELECT * FROM cart_rec WHERE cartrn = '$cartrn'";
  279. $result = $conn->query($sql);
  280. while($data = $result->fetch_assoc()) {
  281. $fn = $data['cartfn'];
  282. $add = $data['cartadd'];
  283. $lm = $data['cartland'];
  284. $cn = $data['cartcn'];
  285.  
  286. $mop = $data['cartbdo'] . $data['cartcomp'];
  287. $pname = $data['cartname'];
  288. $price = $data['cartprice'];
  289. $qty = $data['cartqty'];
  290. $sub = $data['cartsub'];
  291. $email = $data['cartemail']; }
  292. ?>
  293. <h4>Receipt ID: <b><?php echo $cartrn ?></b></h4>
  294. <h4>Mode of Payment: <b><?php echo $mop ?></b></h4>
  295. <hr>
  296. <h4>Full Name: <strong><?php echo $fn ?></strong></h4>
  297. <h4>Shipping Address: <b><?php echo $add ?></b></h4>
  298. <h4>Landmark: <b><?php echo $lm ?></b></h4>
  299. <h4>Contact No: <b><?php echo $cn ?></b></h4>
  300. <hr>
  301. <h4>Product Name: <b><?php echo $pname ?></b></h4>
  302. <h4>Product Price: <b>₱<?php echo $price ?>.00</b></h4>
  303. <h4>Quantity: <b><?php echo $qty ?></b></h4>
  304. <h4>Subtotal: <b>₱<?php echo $sub ?>.00</b></h4>
  305. <hr>
  306. <h4>Email: <b><?php echo $email ?></b></h4>
  307. <button onClick='return checkMe()' type="submit" name="submit" class="btn btn-lg btn-block btn-round btn-add">CLICK HERE TO SEND YOU AN EMAIL</button>
  308. <style type="text/css">
  309. .btn.btn-add {
  310. background: #f74794;
  311. color: #fff;
  312. }
  313. .btn.btn-add:hover,
  314. .btn.btn-add:focus {
  315. background: rgba(17, 17, 17, 0.8);
  316. }
  317. </style>
  318. </form>
  319. </div>
  320. </div>
  321. </div>
  322. </div>
  323. </section>
  324. </div>
  325. </section>
  326. </div>
  327.  
  328.  
  329.  
  330.  
  331.  
  332. <!-- FOOTER -->
  333. <?php include('footer.php'); ?>
  334. <!-- END OF PAGE -->
  335.  
  336. <!-- EMAIL -->
  337. <script type="text/javascript">
  338. function checkMe() {
  339. if (confirm("Are you sure?")) {
  340. alert("Email Sent!");
  341. return true;
  342. } else {
  343. alert("Email Not Sent");
  344. return false;
  345. }
  346. }
  347. </script>
  348.  
  349. <script type="text/javascript">
  350. $(document).ready(function(){
  351. function load_unseen_notification(view = '')
  352. {
  353. $.ajax({
  354. url:"fetch.php",
  355. method:"POST",
  356. data:{view:view},
  357. dataType:"json",
  358. success:function(data)
  359. {
  360. $('.dropdown-menu').html(data.notification);
  361. if(data.unseen_notification > 0)
  362. {
  363. $('.count').html(data.unseen_notification);
  364. }
  365. }
  366. });
  367. }
  368.  
  369. load_unseen_notification();
  370.  
  371. $('#comment_form').on('submit', function(event){
  372. event.preventDefault();
  373. if($('#subject').val() != '' && $('#comment').val() != '')
  374. {
  375. var form_data = $(this).serialize();
  376. $.ajax({
  377. url:"insert.php",
  378. method:"POST",
  379. data:form_data,
  380. success:function(data)
  381. {
  382. $('#comment_form')[0].reset();
  383. load_unseen_notification();
  384. }
  385. });
  386. }
  387. else
  388. {
  389. alert("Both Fields are Required");
  390. }
  391. });
  392.  
  393. $(document).on('click', '.dropdown', function(){
  394. $('.count').html('');
  395. load_unseen_notification('yes');
  396. });
  397.  
  398. setInterval(function(){
  399. load_unseen_notification();;
  400. }, 5000);
  401.  
  402. });
  403. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement