Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.72 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("../../crm/incp/_inc.php");
  4. include("../backend/configuration_server.php");
  5.  
  6. $p->login->chk(["backto"=>"/whitelabel/manage/add-template"]);
  7. $p->html->start();
  8. $p->html->nav();
  9.  
  10. $loggedusers = $pdo->prepare("SELECT * from adminlist where id=:id");
  11. $loggedusers->bindValue(":id", $p->login->user['id']);
  12. $loggedusers->execute();
  13. $loggeduser = $loggedusers->fetch(PDO::FETCH_ASSOC);
  14. if(isset($_POST['add'])){
  15. if(isset($_POST['password-add']) && isset($_POST['password-conf'])){
  16. if($_POST['password-add'] == $_POST['password-conf']){
  17. $query = "SELECT * FROM accounts WHERE acc_email = :email AND acc_password= :password";
  18. $statement = $pdo->prepare($query);
  19. $statement->execute(
  20. array(
  21. 'email' => $loggeduser["acc_email"],
  22. 'password' => $_POST["password-add"]
  23. ));
  24. if($statement->rowCount()>0){
  25. $offers = [
  26. 'name'=>htmlspecialchars($_POST['template-name']),
  27. 'image'=>htmlspecialchars($_POST['thumb-path']),
  28. 'category'=>htmlspecialchars($_POST['offer-industry']),
  29. 'offer'=>htmlspecialchars($_POST['template-offer']),
  30. 'content'=>htmlspecialchars($_POST['template-path']),
  31. 'added_by'=>$p->login->user['id'],
  32. 'date_added'=>date("Y-m-d h:i:s"),
  33. ];
  34. $addindustry = $pdo->prepare("INSERT into templates (template_name, template_image, template_industry, template_offer, template_content, added_by, date_added) VALUES (:name, :image, :category, :offer, :content, :added_by, :date_added)");
  35. $addindustry->execute($offers);
  36. echo "<script>location='./add-template.php?msg=4'</script>";
  37. }
  38. else {
  39. echo "<script>location='./add-template.php?msg=1'</script>";
  40. }}
  41. else {
  42. echo "<script>location='./add-template.php?msg=2'</script>";
  43. }
  44. }
  45. else {
  46. echo "<script>location='./add-template.php?msg=3'</script>";
  47. }
  48. }
  49. ?>
  50. <!Doctype HTML>
  51. <html>
  52. <head>
  53. <title> Add new Template </title>
  54. <link rel="stylesheet" type="text/css" href="./css/style.css">
  55. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  56. </head>
  57. <body>
  58. <div class="container-fluid ">
  59. <div class="row first-row">
  60. <div class="col-sm-12 information-first">
  61. <img src="./img/logo.png" class="img-responsive"/>
  62. <h1 style="font-weight: normal!important;"> Welcome <?php echo $loggeduser['name']; ?>,</h1>
  63. <h2 style="font-weight: normal!important;"> Please complete the form below to create new template.</h2>
  64.  
  65. <div class="row">
  66. <div class="col-sm-12"></div>
  67. <div class="col-sm-12 forma-first" align="center">
  68. <?php
  69. if(isset($_GET['msg'])){
  70. if($_GET['msg']=="4"){ ?>
  71. <p style="color:green; font-weight:bold; position:relative; top:-25px;">Success: You Have Sucessfully added new template.Affiliates can now select the new template.</p>
  72. <?php }
  73. if($_GET['msg']=="3"){ ?>
  74. <p style="color:red; font-weight:bold; position:relative; top:-25px;">Error: Please Insert Your Password Before Adding New Template.</p>
  75. <?php }
  76. if($_GET['msg']=="2"){ ?>
  77. <p style="color:red; font-weight:bold; position:relative; top:-25px;">Error: Your passwords does not match. Please Try Again.</p>
  78. <?php }
  79. if($_GET['msg']=="1"){ ?>
  80. <p style="color:red; font-weight:bold; position:relative; top:-25px;">Error: The password your entered is incorrect. Please Try Again.</p>
  81. <?php }
  82. }
  83. ?>
  84. <form method="post" class="forma-main">
  85. <input required class="input-first" type="text" name="template-name" placeholder="Template Name" value="">
  86. <br>
  87. <input required class="input-first" type="text" name="thumb-path" placeholder="Thumb Path" value="">
  88. <br>
  89. <select id="industry" class="input-first" name="offer-industry" style="width:73%;">
  90. <?php
  91. $industries = $pdo->prepare("SELECT * from industries");
  92. $industries->execute();
  93. $industry1 = $industries->fetchAll(PDO::FETCH_ASSOC);
  94. foreach($industry1 as $industry) { ?>
  95. <option style="background-color: rgba(0,0,0,0.1);color:black;" value="<?php echo $industry['industry_id']; ?>"><?php echo $industry['industry_name']; ?></option>
  96. <?php } ?>
  97. </select>
  98. <br>
  99. <select id="offer" class="input-first" name="template-offer" style="width:73%;">
  100. <?php
  101. $offers = $pdo->prepare("SELECT * from offers where offer_industry =:offer_industry");
  102. $offers->bindValue(":offer_industry", "1");
  103. $offers->execute();
  104. $offer1 = $offers->fetchAll(PDO::FETCH_ASSOC);
  105. foreach($offer1 as $offer) { ?>
  106. <option style="background-color: rgba(0,0,0,0.1);color:black;" value='1'>General</option>
  107. <option style="background-color: rgba(0,0,0,0.1);color:black;" value="<?php echo $offer['offer_industry']; ?>"><?php echo $offer['offer_name']; ?></option>
  108. <?php } ?>
  109. </select>
  110. <br>
  111. <input required class="input-first" type="text" name="template-path" placeholder="Template Path (templates/template-name/index.php)" value="">
  112. <br>
  113. <input required class="input-first" type="password" name="password-add" placeholder="Password" value="">
  114. <br>
  115. <input required class="input-first" type="password" name="password-conf" placeholder="Confirm Password" value="">
  116. <br>
  117. <input class="button-first" type="submit" value="Create Template" name="add">
  118. </form>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="footer" style="color:#ffffff;">&copy; Copyright 2018 <strong><a>TopDollarHub</a></strong> <br class="line"></div>
  125. </body>
  126. </html>
  127. <script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
  128. <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.js"></script>
  129. <script>
  130. $(document).ready(function() {
  131. $("#industry").change(function() {
  132. var choise = $("#industry").val();
  133.  
  134. $.ajax({
  135. url: "<?php echo $Root_http;?>/whitelabel/ajax/createtmpoffers.php?id="+choise,
  136. success: function(result){
  137. $("#offer").html(result);
  138. }});
  139. });
  140. });
  141. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement