Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("../../crm/incp/_inc.php");
- include("../backend/configuration_server.php");
- $p->login->chk(["backto"=>"/whitelabel/manage/add-template"]);
- $p->html->start();
- $p->html->nav();
- $loggedusers = $pdo->prepare("SELECT * from adminlist where id=:id");
- $loggedusers->bindValue(":id", $p->login->user['id']);
- $loggedusers->execute();
- $loggeduser = $loggedusers->fetch(PDO::FETCH_ASSOC);
- if(isset($_POST['add'])){
- if(isset($_POST['password-add']) && isset($_POST['password-conf'])){
- if($_POST['password-add'] == $_POST['password-conf']){
- $query = "SELECT * FROM accounts WHERE acc_email = :email AND acc_password= :password";
- $statement = $pdo->prepare($query);
- $statement->execute(
- array(
- 'email' => $loggeduser["acc_email"],
- 'password' => $_POST["password-add"]
- ));
- if($statement->rowCount()>0){
- $offers = [
- 'name'=>htmlspecialchars($_POST['template-name']),
- 'image'=>htmlspecialchars($_POST['thumb-path']),
- 'category'=>htmlspecialchars($_POST['offer-industry']),
- 'offer'=>htmlspecialchars($_POST['template-offer']),
- 'content'=>htmlspecialchars($_POST['template-path']),
- 'added_by'=>$p->login->user['id'],
- 'date_added'=>date("Y-m-d h:i:s"),
- ];
- $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)");
- $addindustry->execute($offers);
- echo "<script>location='./add-template.php?msg=4'</script>";
- }
- else {
- echo "<script>location='./add-template.php?msg=1'</script>";
- }}
- else {
- echo "<script>location='./add-template.php?msg=2'</script>";
- }
- }
- else {
- echo "<script>location='./add-template.php?msg=3'</script>";
- }
- }
- ?>
- <!Doctype HTML>
- <html>
- <head>
- <title> Add new Template </title>
- <link rel="stylesheet" type="text/css" href="./css/style.css">
- <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
- </head>
- <body>
- <div class="container-fluid ">
- <div class="row first-row">
- <div class="col-sm-12 information-first">
- <img src="./img/logo.png" class="img-responsive"/>
- <h1 style="font-weight: normal!important;"> Welcome <?php echo $loggeduser['name']; ?>,</h1>
- <h2 style="font-weight: normal!important;"> Please complete the form below to create new template.</h2>
- <div class="row">
- <div class="col-sm-12"></div>
- <div class="col-sm-12 forma-first" align="center">
- <?php
- if(isset($_GET['msg'])){
- if($_GET['msg']=="4"){ ?>
- <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>
- <?php }
- if($_GET['msg']=="3"){ ?>
- <p style="color:red; font-weight:bold; position:relative; top:-25px;">Error: Please Insert Your Password Before Adding New Template.</p>
- <?php }
- if($_GET['msg']=="2"){ ?>
- <p style="color:red; font-weight:bold; position:relative; top:-25px;">Error: Your passwords does not match. Please Try Again.</p>
- <?php }
- if($_GET['msg']=="1"){ ?>
- <p style="color:red; font-weight:bold; position:relative; top:-25px;">Error: The password your entered is incorrect. Please Try Again.</p>
- <?php }
- }
- ?>
- <form method="post" class="forma-main">
- <input required class="input-first" type="text" name="template-name" placeholder="Template Name" value="">
- <br>
- <input required class="input-first" type="text" name="thumb-path" placeholder="Thumb Path" value="">
- <br>
- <select id="industry" class="input-first" name="offer-industry" style="width:73%;">
- <?php
- $industries = $pdo->prepare("SELECT * from industries");
- $industries->execute();
- $industry1 = $industries->fetchAll(PDO::FETCH_ASSOC);
- foreach($industry1 as $industry) { ?>
- <option style="background-color: rgba(0,0,0,0.1);color:black;" value="<?php echo $industry['industry_id']; ?>"><?php echo $industry['industry_name']; ?></option>
- <?php } ?>
- </select>
- <br>
- <select id="offer" class="input-first" name="template-offer" style="width:73%;">
- <?php
- $offers = $pdo->prepare("SELECT * from offers where offer_industry =:offer_industry");
- $offers->bindValue(":offer_industry", "1");
- $offers->execute();
- $offer1 = $offers->fetchAll(PDO::FETCH_ASSOC);
- foreach($offer1 as $offer) { ?>
- <option style="background-color: rgba(0,0,0,0.1);color:black;" value='1'>General</option>
- <option style="background-color: rgba(0,0,0,0.1);color:black;" value="<?php echo $offer['offer_industry']; ?>"><?php echo $offer['offer_name']; ?></option>
- <?php } ?>
- </select>
- <br>
- <input required class="input-first" type="text" name="template-path" placeholder="Template Path (templates/template-name/index.php)" value="">
- <br>
- <input required class="input-first" type="password" name="password-add" placeholder="Password" value="">
- <br>
- <input required class="input-first" type="password" name="password-conf" placeholder="Confirm Password" value="">
- <br>
- <input class="button-first" type="submit" value="Create Template" name="add">
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="footer" style="color:#ffffff;">© Copyright 2018 <strong><a>TopDollarHub</a></strong> <br class="line"></div>
- </body>
- </html>
- <script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.js"></script>
- <script>
- $(document).ready(function() {
- $("#industry").change(function() {
- var choise = $("#industry").val();
- $.ajax({
- url: "<?php echo $Root_http;?>/whitelabel/ajax/createtmpoffers.php?id="+choise,
- success: function(result){
- $("#offer").html(result);
- }});
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement