PATH:
home
/
lab2454c
/
spaxtac.com
/
wp-content
/
plugins
/
application_data
<?php /* Plugin Name: application_data Description: application data Version: 1.00 Author: Santanu Ganguly */ /* Copyright 2021 */ add_action('admin_menu', 'application_data'); function application_data(){ add_menu_page('application data', 'Application', 'manage_options', 'application_data', 'application_data_page','',5 ); } function application_data_page() { global $wpdb; $sel_data = "SELECT * FROM application ORDER BY `id` DESC"; $application_data = $wpdb->get_results($sel_data); ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"> <script type="text/javascript"> jQuery(document).ready(function($) { $('#example').dataTable( { order: [[ 0, "desc" ]], pageLength: 10, lengthMenu: [ [ 10,50, 100, 200, -1 ], [ '10','50', '100', '200', 'Show all' ] ], columnDefs: [ { "targets": [1,2,3,4,5,6,7,8,9,10,11], "orderable": false, "searchable": false, } ] } ); } ); </script> <style type="text/css"> /*div#example_length { display: none; }*/ </style> <div class="container-fluid"> <h2>Application Data</h2> <table class="table" id="example"> <thead> <!-- <th>No</th> --> <th>ID</th> <th>Company Name</th> <th>First Name</th> <th>Last Name</th> <th>Email</th> <th>Phone No</th> <th>Job Description</th> <th>Quantity</th> <th>Tax Rate</th> <th>Total Budget</th> <th>Date</th> <th>Status</th> </tr> </thead> <tbody> <?php $i = 1; foreach($application_data as $show_application_data){ $application_id = $show_application_data->id; $CompanyName = $show_application_data->CompanyName; $FirstName = $show_application_data->FirstName; $LastName = $show_application_data->LastName; $EmailId = $show_application_data->EmailId; $PhoneNo = $show_application_data->PhoneNo; $JobDescription = $show_application_data->JobDescription; $Quantity = $show_application_data->Quantity; $TaxRate = $show_application_data->TaxRate; $TotalBudget = $show_application_data->TotalBudget; $application_status = $show_application_data->status; $applicationdate = $show_application_data->date; $dt = new DateTime($applicationdate); $application_date = $dt->format('Y-m-d'); $posturl = site_url()."/wp-admin/admin.php?page=application_data"; if (isset($_POST["approval_date"])){ $application_id = $_POST['application_id']; $status = $_POST['status']; $successful_update = $wpdb->query("UPDATE application SET status = '".$status."' where id = '".$application_id."'"); if($successful_update){ echo "<p style='text-align: center;'><b>Successful Approved.<b><p>"; ?> <script type="text/javascript"> window.setTimeout(function() { window.location.href = '<?php echo $posturl; ?>'; }, 1000); </script> <?php } } ?> <tr> <!-- <td><?php //echo $i; ?></td> --> <td><?php echo $application_id; ?></td> <td><?php echo $CompanyName; ?></td> <td><?php echo $FirstName; ?></td> <td><?php echo $LastName; ?></td> <td><?php echo $EmailId; ?></td> <td><?php echo $PhoneNo; ?></td> <td><?php echo $JobDescription; ?></td> <td><?php echo $Quantity; ?></td> <td><?php echo $TaxRate; ?></td> <td><?php echo $TotalBudget; ?></td> <td><?php echo $application_date; ?></td> <td> <form action="<?php echo $posturl; ?>" method="post"> <input type="hidden" class="form-control" name="application_id" value="<?php echo $application_id; ?>"> <?php if ($application_status == "1") { ?> <input type="hidden" class="form-control" name="status" value="0"> <button type="submit" name="approval_date" value="status_date" class="btn btn-warning">Disapprove</button> <?php }else{ ?> <input type="hidden" class="form-control" name="status" value="1"> <button type="submit" name="approval_date" value="status_date" class="btn btn-info">Approve</button> <?php } ?> </form> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> <?php } function rewards_Info(){ global $wpdb; $posturl = site_url()."/wp-admin/admin.php?page=rewards_Info"; if(isset($_POST['u_submit'])) { $rewards_msz = $_POST['rewards_msz']; $rewards_msz1 = $_POST['rewards_msz1']; $rewards_msz2 = $_POST['rewards_msz2']; $rewards_msz3 = $_POST['rewards_msz3']; $data = array( 'rewards_msz' => $rewards_msz, 'rewards_msz1' => $rewards_msz1, 'rewards_msz2' => $rewards_msz2, 'rewards_msz3' => $rewards_msz3 ); $user = $wpdb->insert('rewards', $data); if($user){ ?> <script type="text/javascript"> window.location.href='https://cosmopolitanexpress.com/wp-admin/admin.php?page=rewards_Info'; </script> <?php }else{ wp_redirect( $posturl.'&data=invalid', 302 ); exit; } } if(isset($_POST["edit"])){ $edit_id = $_POST['edit_id']; $seldata = $wpdb->get_row("SELECT * FROM rewards where id = '".$edit_id."'"); $edit_rewards_msz = stripslashes($seldata->rewards_msz); $edit_rewards_msz1 = stripslashes($seldata->rewards_msz1); $edit_rewards_msz2 = stripslashes($seldata->rewards_msz2); $edit_rewards_msz3 = stripslashes($seldata->rewards_msz3); } if(isset($_POST["u_update"])){ $r_edit_id = $_POST['r_edit_id']; $rewards_msz = $_POST['rewards_msz']; $rewards_msz1 = $_POST['rewards_msz1']; $rewards_msz2 = $_POST['rewards_msz2']; $rewards_msz3 = $_POST['rewards_msz3']; $successful_update = $wpdb->query("UPDATE rewards SET rewards_msz='".$rewards_msz."' , rewards_msz1='".$rewards_msz1."' , rewards_msz2='".$rewards_msz2."' , rewards_msz3='".$rewards_msz3."' where id = '".$r_edit_id."'"); if ($successful_update) { ?> <script type="text/javascript"> window.location.href='https://cosmopolitanexpress.com/wp-admin/admin.php?page=rewards_Info'; </script> <?php }else{ ?> <script type="text/javascript"> window.location.href='https://cosmopolitanexpress.com/wp-admin/admin.php?page=rewards_Info'; </script> <?php } } if (isset($_POST["deleted"])){ $deleted_id = $_POST['deleted_id']; $delete_data = $wpdb->query("DELETE FROM rewards where id = '".$deleted_id."' "); if($delete_data){ ?> <script type="text/javascript"> window.location.href='https://cosmopolitanexpress.com/wp-admin/admin.php?page=rewards_Info'; </script> <?php } } ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <div class="container"> <form class="form-horizontal" action="<?php echo $posturl; ?>" method="post"> <div class="form-group"> <label class="control-label col-sm-2">Reward One:</label> <div class="col-sm-10"> <?php $content = $edit_rewards_msz; $editor_id = "rewards_msz_id"; $settings = array( 'editor_height' => 160, 'textarea_name' => 'rewards_msz', 'tinymce'=>['plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify",'toolbar2'=>"blockquote,hr,table,bullist,numlist,undo,redo,link,unlink"] ); wp_editor( $content, $editor_id, $settings ); ?> </div> <label class="control-label col-sm-2">Reward Two:</label> <div class="col-sm-10"> <?php $content1 = $edit_rewards_msz1; $editor_id = "rewards_msz_id1"; $settings = array( 'editor_height' => 160, 'textarea_name' => 'rewards_msz1', 'tinymce'=>['plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify",'toolbar2'=>"blockquote,hr,table,bullist,numlist,undo,redo,link,unlink"] ); wp_editor( $content1, $editor_id, $settings ); ?> </div> <label class="control-label col-sm-2">Reward Three:</label> <div class="col-sm-10"> <?php $content2 = $edit_rewards_msz2; $editor_id = "rewards_msz_id2"; $settings = array( 'editor_height' => 160, 'textarea_name' => 'rewards_msz2', 'tinymce'=>['plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify",'toolbar2'=>"blockquote,hr,table,bullist,numlist,undo,redo,link,unlink"] ); wp_editor( $content2, $editor_id, $settings ); ?> </div> <label class="control-label col-sm-2">Reward Four:</label> <div class="col-sm-10"> <?php $content3 = $edit_rewards_msz3; $editor_id = "rewards_msz_id3"; $settings = array( 'editor_height' => 160, 'textarea_name' => 'rewards_msz3', 'tinymce'=>['plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify",'toolbar2'=>"blockquote,hr,table,bullist,numlist,undo,redo,link,unlink"] ); wp_editor( $content3, $editor_id, $settings ); ?> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <?php if(isset($_POST["edit"])){ $edit_id = $_POST['edit_id']; ?> <input type="hidden" class="form-control" name="r_edit_id" value="<?php echo $edit_id; ?>"> <button type="submit" name="u_update" class="btn btn-info">Update</button> <?php }else{ ?> <button type="submit" name="u_submit" class="btn btn-info">Submit</button> <?php } ?> </div> </div> </form> </div> <?php $sel_datas = "SELECT * FROM `rewards` ORDER BY id DESC"; $rewards_datas = $wpdb->get_results($sel_datas); ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css"> <script type="text/javascript"> jQuery(document).ready(function($) { $('#example').dataTable( { order: [[ 1, "asc" ]], pageLength: 10, lengthMenu: [ [ 10,50, 100, 200, -1 ], [ '10','50', '100', '200', 'Show all' ] ], columnDefs: [ { "targets": [1,2,3,4,5,6], "orderable": false, "searchable": false, } ] } ); } ); </script> <style type="text/css"> div#example_length { display: none; } </style> <div class="container-fluid"> <h2>Rewards</h2> <table class="table" id="example"> <thead> <th>Date</th> <th>Reward One</th> <th>Reward Two</th> <th>Reward Three</th> <th>Reward Four</th> <th>Edit</th> <th>Deleted</th> </tr> </thead> <tbody> <?php foreach($rewards_datas as $rewards_info){ $rewards_id = $rewards_info->id; $date = $rewards_info->date; $text = strip_shortcodes(stripslashes($rewards_info->rewards_msz)); $text = excerpt_remove_blocks($text); $text = apply_filters( 'the_content', $text ); $text = str_replace( ']]>', ']]>', $text ); $excerpt_length = (int) _x( '55', 'excerpt_length' ); $excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length ); $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[...]' ); $rewards_msz = wp_trim_words( $text, $excerpt_length, $excerpt_more ); $text1 = strip_shortcodes(stripslashes($rewards_info->rewards_msz1)); $text1 = excerpt_remove_blocks($text1); $text1 = apply_filters( 'the_content', $text1 ); $text1 = str_replace( ']]>', ']]>', $text1 ); $excerpt_length1 = (int) _x( '55', 'excerpt_length' ); $excerpt_length1 = (int) apply_filters( 'excerpt_length', $excerpt_length1 ); $excerpt_more1 = apply_filters( 'excerpt_more', ' ' . '[...]' ); $rewards_msz1 = wp_trim_words( $text1, $excerpt_length1, $excerpt_more1 ); $text2 = strip_shortcodes(stripslashes($rewards_info->rewards_msz2)); $text2 = excerpt_remove_blocks($text2); $text2 = apply_filters( 'the_content', $text2 ); $text2 = str_replace( ']]>', ']]>', $text2 ); $excerpt_length2 = (int) _x( '55', 'excerpt_length' ); $excerpt_length2 = (int) apply_filters( 'excerpt_length', $excerpt_length2 ); $excerpt_more2 = apply_filters( 'excerpt_more', ' ' . '[...]' ); $rewards_msz2 = wp_trim_words( $text2, $excerpt_length2, $excerpt_more2 ); $text3 = strip_shortcodes(stripslashes($rewards_info->rewards_msz3)); $text3 = excerpt_remove_blocks($text3); $text3 = apply_filters( 'the_content', $text3 ); $text3 = str_replace( ']]>', ']]>', $text3 ); $excerpt_length3 = (int) _x( '55', 'excerpt_length' ); $excerpt_length3 = (int) apply_filters( 'excerpt_length', $excerpt_length3 ); $excerpt_more3 = apply_filters( 'excerpt_more', ' ' . '[...]' ); $rewards_msz3 = wp_trim_words( $text3, $excerpt_length3, $excerpt_more3 ); ?> <tr> <td><?php echo date("Y-m-d", strtotime($date)); ?></td> <td><?php echo $rewards_msz;?></td> <td><?php echo $rewards_msz1;?></td> <td><?php echo $rewards_msz2;?></td> <td><?php echo $rewards_msz3;?></td> <td> <form action="<?php echo $posturl; ?>" method="post"> <input type="hidden" class="form-control" name="edit_id" value="<?php echo $rewards_id; ?>"> <button type="submit" name="edit" value="edit" class="btn btn-info">Edit</button> </form> </td> <td> <form action="<?php echo $actual_link; ?>" method="post"> <input type="hidden" class="form-control" name="deleted_id" value="<?php echo $rewards_id; ?>"> <button type="submit" name="deleted" value="deleted" class="btn btn-danger" onClick='return confirm("are you sure you want to delete?");'>Delete</button> </form> </td> </tr> <?php } ?> </tbody> </table> </div> <?php }
[+]
..
[-] application_data.php
[edit]