Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.83 KB | None | 0 0
  1. <?php
  2.  
  3. $data = $_POST;
  4. class MyDB extends SQLite3 {
  5.         function __construct() {
  6.             $this->open('/var/www/precedentinfo.kg/public_html/forcategory/precedent.db');
  7. }
  8. }
  9. $db = new MyDB();
  10. if(isset($data['category_submit'])) {
  11.  
  12.     $email = $data['category_email'];
  13.     $arr = array_keys($data);
  14.     $st = "";
  15.     foreach ($arr as $key) {
  16.         $st .=$key.',';
  17.  
  18.     }
  19.     $category = substr($st, 15, -17);
  20.  
  21.     $rows = $db->query("SELECT COUNT(*) as count FROM applicants where applicant_email='$email'");
  22. $row = $rows->fetchArray();
  23. $numRows = $row['count'];
  24.  
  25. if($email != '' && $numRows==0){
  26.     $ret = $db->query("insert into applicants (applicant_email, applicant_category) values ('$email', '$category')");
  27.  
  28.     header("Location: http://precedentinfo.kg/");
  29. }
  30. else {
  31. $current = $db->query("select * from applicants where applicant_email = '$email'");
  32.  
  33.     $current = $current->fetchArray();
  34.     $applicant_category = $current['applicant_category'];
  35.  
  36.     $category_arr = explode(",", $applicant_category);
  37.  
  38.     $new_category_arr = explode(",", $category);
  39.  
  40.     foreach($new_category_arr as $new) {
  41.         if(!(in_array($new, $category_arr))) $applicant_category .= ','.$new;
  42.     }
  43.  
  44.     $db->query("update applicants set applicant_category = '$applicant_category' where applicant_email = '$email'");
  45.  
  46.     header("Location: http://precedentinfo.kg/");
  47. }
  48. }
  49. ?>
  50.  
  51. <?php
  52. /**
  53.  * The Header for our theme.
  54.  *
  55.  * @package Betheme
  56.  * @author Muffin group
  57.  * @link http://muffingroup.com
  58.  */
  59. ?>
  60. <!DOCTYPE html>
  61. <?php
  62.     if( $_GET && key_exists('mfn-rtl', $_GET) ):
  63.         echo '<html class="no-js" lang="ar" dir="rtl">';
  64. else:
  65. ?>
  66. <html class="no-js<?php echo mfn_user_os(); ?>" <?php language_attributes(); ?>
  67. <?php mfn_tag_schema(); ?>>
  68. <?php endif; ?>
  69.  
  70. <!-- head -->
  71.  
  72. <head>
  73.  
  74.     <!-- meta -->
  75.     <meta charset="<?php bloginfo( 'charset' ); ?>" />
  76.     <?php
  77.     if( mfn_opts_get('responsive') ){
  78.         if( mfn_opts_get('responsive-zoom') ){
  79.             echo '<meta name="viewport" content="width=device-width, initial-scale=1" />';
  80.     } else {
  81.     echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />';
  82.     }
  83.  
  84.     }
  85.     ?>
  86.  
  87.     <?php do_action('wp_seo'); ?>
  88.  
  89.     <link rel="shortcut icon" href="<?php mfn_opts_show( 'favicon-img', THEME_URI .'/images/favicon.ico' ); ?>" />
  90.     <?php if( mfn_opts_get('apple-touch-icon') ): ?>
  91.     <link rel="apple-touch-icon" href="<?php mfn_opts_show( 'apple-touch-icon' ); ?>" />
  92.     <?php endif; ?>
  93.  
  94.     <!-- wp_head() -->
  95.     <?php wp_head(); ?>
  96. </head>
  97.  
  98. <!-- body -->
  99.  
  100. <body <?php body_class(); ?>>
  101.  
  102. <div class="remodal" data-remodal-id="modal_calendar" role="dialog" aria-labelledby="<?php echo __('Posts by date', 'precedent'); ?>" aria-describedby="<?php echo __('Posts by date', 'precedent'); ?>">
  103.     <button data-remodal-action="close" class="remodal-close" aria-label="<?php echo __('Close', 'precedent'); ?>"></button>
  104.     <div class="remodal-content">
  105.         <?php dynamic_sidebar( 'sidecalendar' ); ?>
  106.     </div>
  107. </div>
  108.  
  109. <div class="remodal" data-remodal-id="modal_subscribe" role="dialog" aria-labelledby="<?php echo __('Subscribe for daily newsletter', 'precedent'); ?>" aria-describedby="<?php echo __('Subscribe for daily newsletter', 'precedent'); ?>">
  110.     <button data-remodal-action="close" class="remodal-close" aria-label="<?php echo __('Close', 'precedent'); ?>"></button>
  111.     <div class="remodal-content">
  112.         <div class="subscribe-content" style="max-width: 1200px;display: flex;justify-content: space-around;flex-wrap:wrap;">
  113.             <div style="display: inline-block; margin-bottom: 50px;">
  114.                 <?php dynamic_sidebar( 'subscribe' ); ?>
  115.             </div>
  116.             <div style="float: left;">
  117.                 <aside class="widget widget_mailster_signup" style="max-width: 380px;">
  118.                     <h3>
  119.                         Подписаться на рассылку законопроектов
  120.                     </h3>
  121.                     <div class="mailster-widget mailster-widget-signup">
  122.  
  123.                         <div class="mailster-form-fields" style="display: flex;">
  124.                             <div class="mailster-wrapper mailster-email-wrapper">
  125.                                 <form method="POST">
  126.                     <input type="text" placeholder="Enter email" name="category_email" required>
  127.                     <div style="height: 150px;display:block;float: left;overflow-y: scroll">
  128.  
  129.         <table>
  130.  
  131.             <tbody>
  132.             <?php
  133.          $ret = $db->query("select * from categories");
  134.  
  135.             while($row = $ret->fetchArray(SQLITE3_ASSOC) ) {
  136.                 echo "<tr>";
  137.                 echo "<td><input type='checkbox' name='".$row['category_id']."'></td>";
  138.                 echo "<td>".$row['category_name']."</td>";
  139.                 echo "</tr>";
  140.             }
  141.         ?>
  142.             </tbody>
  143.  
  144.         </table>
  145.  
  146.  
  147.  
  148.  
  149.     </div>
  150.  
  151.                                         <div class="mailster-wrapper mailster-submit-wrapper form-submit">
  152.                                             <input name="category_submit" type="submit" value="подписаться" class="submit-button button" style="margin-top: 20px;" aria-label="подписаться">
  153.                                         </div>
  154.  
  155.                                 </form></div>
  156.                             </div>
  157.  
  158.                         </div>
  159.  
  160.                     </div>
  161.  
  162.                 </aside>
  163.             </div>
  164.         </div>
  165.     </div>
  166. </div>
  167.  
  168. <?php if ( !is_user_logged_in() ):?>
  169. <div class="remodal" data-remodal-id="modal_login_register" role="dialog" aria-labelledby="<?php echo __('Login/Register', 'precedent'); ?>" aria-describedby="<?php echo __('Login/Register', 'precedent'); ?>">
  170.     <button data-remodal-action="close" class="remodal-close" aria-label="<?php echo __('Close', 'precedent'); ?>"></button>
  171.     <div class="remodal-content">
  172.         <div class="login-reg">
  173.             <?php dynamic_sidebar( 'login-or-register' );?>
  174.         </div>
  175.     </div>
  176. </div>
  177. <?php endif; ?>
  178.  
  179. <div class="remodal" data-remodal-id="modal_contacts" role="dialog" aria-labelledby="<?php echo __('Contacts', 'precedent'); ?>" aria-describedby="<?php echo __('Contacts', 'precedent'); ?>">
  180.     <button data-remodal-action="close" class="remodal-close" aria-label="<?php echo __('Close', 'precedent'); ?>"></button>
  181.     <div class="remodal-content">
  182.         <div class="contacts">
  183.             <?php
  184.                     echo do_shortcode('[page-content-sc id="194"]')
  185.                 ?>
  186.  
  187.         </div>
  188.     </div>
  189. </div>
  190.  
  191. <?php do_action( 'mfn_hook_top' ); ?>
  192.  
  193. <?php get_template_part( 'includes/header', 'sliding-area' ); ?>
  194.  
  195. <?php if( mfn_header_style( true ) == 'header-creative' ) get_template_part( 'includes/header', 'creative' ); ?>
  196.  
  197. <!-- #Wrapper -->
  198. <div id="Wrapper">
  199.  
  200.     <?php
  201.             // Featured Image | Parallax ----------
  202.             $header_style = '';
  203.  
  204.             if( mfn_opts_get( 'img-subheader-attachment' ) == 'parallax' ){
  205.  
  206.                 if( mfn_opts_get( 'parallax' ) == 'stellar' ){
  207.                     $header_style = ' class="bg-parallax" data-stellar-background-ratio="0.5"';
  208.                 } else {
  209.                     $header_style = ' class="bg-parallax" data-enllax-ratio="0.3"';
  210.                 }
  211.  
  212.             }
  213.         ?>
  214.  
  215.     <?php if( mfn_header_style( true ) == 'header-below' ) echo mfn_slider(); ?>
  216.  
  217.     <!-- #Header_bg -->
  218.     <div id="Header_wrapper" <?php echo $header_style; ?>>
  219.  
  220.     <!-- #Header -->
  221.     <header id="Header">
  222.         <?php if( mfn_header_style( true ) != 'header-creative' ) get_template_part( 'includes/header', 'top-area' ); ?>
  223.         <?php if( mfn_header_style( true ) != 'header-below' ) echo mfn_slider(); ?>
  224.     </header>
  225.  
  226.     <?php
  227.                 if( ( mfn_opts_get('subheader') != 'all' ) &&
  228.                     ( ! get_post_meta( mfn_ID(), 'mfn-post-hide-title', true ) ) &&
  229.                     ( get_post_meta( mfn_ID(), 'mfn-post-template', true ) != 'intro' ) ){
  230.  
  231.                     $subheader_advanced = mfn_opts_get( 'subheader-advanced' );
  232.  
  233.                     $subheader_style = '';
  234.  
  235.                     if( mfn_opts_get( 'subheader-padding' ) ){
  236.                         $subheader_style .= 'padding:'. mfn_opts_get( 'subheader-padding' ) .';';
  237.                     }
  238.  
  239.                     if( is_search() ){
  240.                         // Page title -------------------------
  241.  
  242.                         echo '<div id="Subheader" class="search-subheader" style="'. $subheader_style .'">';
  243.     echo '<div class="container">';
  244.     echo '<div class="column one-second">';
  245.  
  246.         if( trim( $_GET['s'] ) ){
  247.         global $wp_query;
  248.         $total_results = $wp_query->found_posts;
  249.         } else {
  250.         $total_results = 0;
  251.         }
  252.  
  253.         $translate['search-results'] = mfn_opts_get('translate') ? mfn_opts_get('translate-search-results','results found for:') : __('results found for:','betheme');
  254.         $translate[ 'search-placeholder' ] = mfn_opts_get( 'translate' ) ? mfn_opts_get( 'translate-search-placeholder', 'Enter your search' ) : __( 'Enter your search', 'betheme' );
  255.         echo '<form method="get" id="#search_head" action="'. esc_url( home_url( '/' ) ) .'">';
  256.  
  257.             echo '<button type="submit" class="search-button icon-search-fine"></button>';
  258.             echo '<input type="text" class="field" name="s" id="s" placeholder="'. $translate['search-placeholder'] .'" value="'.esc_html( $_GET['s']) .'" />';
  259.             echo '<input type="submit" class="submit" value="" style="display:none;" />';
  260.  
  261.             echo '</form>';
  262.         echo '<div class="clearfix"></div>';
  263.  
  264.         echo  __('Total found', 'precedent'). ' ' . $total_results .' '. _n('material', 'material(s)', $total_results ,'precedent');
  265.  
  266.         echo '</div>';
  267.     echo '</div>';
  268.     echo '</div>';
  269.  
  270. } elseif( ! mfn_slider_isset() || ( is_array( $subheader_advanced ) && isset( $subheader_advanced['slider-show'] ) ) ){
  271. // Page title -------------------------
  272.  
  273. // Subheader | Options
  274. $subheader_options = mfn_opts_get( 'subheader' );
  275.  
  276. if( is_home() && ! get_option( 'page_for_posts' ) && ! mfn_opts_get( 'blog-page' ) ){
  277. $subheader_show = false;
  278. } elseif( is_array( $subheader_options ) && isset( $subheader_options[ 'hide-subheader' ] ) ){
  279. $subheader_show = false;
  280. } elseif( get_post_meta( mfn_ID(), 'mfn-post-hide-title', true ) ){
  281. $subheader_show = false;
  282. } else {
  283. $subheader_show = true;
  284. }
  285.  
  286. // title
  287. if( is_array( $subheader_options ) && isset( $subheader_options[ 'hide-title' ] ) ){
  288. $title_show = false;
  289. } else {
  290. $title_show = true;
  291. }
  292.  
  293. // breadcrumbs
  294. if( is_array( $subheader_options ) && isset( $subheader_options[ 'hide-breadcrumbs' ] ) ){
  295. $breadcrumbs_show = false;
  296. } else {
  297. $breadcrumbs_show = true;
  298. }
  299.  
  300. if( is_array( $subheader_advanced ) && isset( $subheader_advanced[ 'breadcrumbs-link' ] ) ){
  301. $breadcrumbs_link = 'has-link';
  302. } else {
  303. $breadcrumbs_link = 'no-link';
  304. }
  305.  
  306. // Subheader | Print
  307. if( $subheader_show ){
  308. echo '<div id="Subheader" style="'. $subheader_style .'">';
  309.     echo '<div class="container">';
  310.         echo '<div class="column one">';
  311.  
  312.             // Title
  313.             if( $title_show ){
  314.             $title_tag = mfn_opts_get( 'subheader-title-tag', 'h1' );
  315.             echo '<'. $title_tag .' class="title">'. mfn_page_title() .'</'. $title_tag .'>';
  316.         }
  317.  
  318.         // Breadcrumbs
  319.         if( $breadcrumbs_show ){
  320.         mfn_breadcrumbs( $breadcrumbs_link );
  321.         }
  322.  
  323.         echo '</div>';
  324.     echo '</div>';
  325. echo '</div>';
  326. }
  327.  
  328. }
  329.  
  330. }
  331. ?>
  332.  
  333. </div>
  334.  
  335. <?php
  336.             // Single Post | Template: Intro
  337.             if( get_post_meta( mfn_ID(), 'mfn-post-template', true ) == 'intro' ){
  338.                 get_template_part( 'includes/header', 'single-intro' );
  339.             }
  340.         ?>
  341.  
  342. <?php do_action( 'mfn_hook_content_before' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement