3v4l.org

run code in 300+ PHP versions simultaneously
<?php include ('include/sess_vars.php'); if(!$_SESSION['username']) { header("Location: login.php");//redirect to the login page to secure the welcome page without login access. } $reseller_id = $_SESSION['id']; include_once ('include/conn.php'); include_once ('include/functions.php'); $sSQL = "SELECT count(id) as cnt"; $sSQL .= " from users "; $sSQL .= " where 1 "; $sSQL .= " and expires > current_date and expires < date_add(current_date, interval 4 day) "; if (($_SESSION['reseller_id'] > 0) && ($_SESSION['gid'] == 4)) { $sSQL .= " and reseller_id in (" . $reseller_id . ")"; } //echo $sSQL; $sel = mysqli_query($dbcon, $sSQL); while ($rowUser = mysqli_fetch_assoc($sel)) { $tUsers = $rowUser["cnt"]; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="description" content /> <meta name="author" content /> <title>Expiring Users</title> <link href="css/styles.css" rel="stylesheet" /> <link href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css" rel="stylesheet" crossorigin="anonymous" /> <link rel="icon" type="image/x-icon" href="assets/img/favicon.png" /> <script data-search-pseudo-elements defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.27.0/feather.min.js" crossorigin="anonymous"></script> <style> div.dt-buttons { float: right; margin-left:10px; } </style> </head> <body> <?php include('navbar.php'); ?> <div id="layoutSidenav_content"> <main> <header class="page-header page-header-dark bg-gradient-primary-to-secondary pb-10"> <div class="container"> <div class="page-header-content pt-4"> <div class="row align-items-center justify-content-between"> <div class="col-auto mt-4"> <div class="page-header-subtitle">Expiring Users</div> </div> </div> </div> </div> </header> <!-- Main page content--> <div class="container-fluid mt-n10"> <div class="card mb-4"> <div class="card-header">Expiring Users (Total Expiring Users in next 4 days: <?php echo $tUsers;?>)</div> <div class="card-body"> <div class="datatable"> <table class="table table-bordered table-hover" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>Info</th> <th>Name</th> <th>IP</th> <th>Cy</th> <th>MAC</th> <th>STB</th> <th>Reseller</th> <th>Tariff</th> <th>Status</th> <th>Reg Date</th> <th>Exp Date</th> <th>Comment</th> <th>Events</th> </tr> </thead> <tfoot> <tr> <th>Info</th> <th>Name</th> <th>IP</th> <th>Cy</th> <th>MAC</th> <th>STB</th> <th>Reseller</th> <th>Tariff</th> <th>Status</th> <th>Reg Date</th> <th>Exp Date</th> <th>Comment</th> <th>Events</th> </tr> </tfoot> </table> </div> </div> </div> </div> </main> <footer class="footer mt-auto footer-light"> <div class="container-fluid"> <div class="row"> <div class="col-md-6 small">Copyright &#xA9; 2021</div> </div> </div> </footer> </div> <div class="modal" tabindex="-1" id="infoModal" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">User Info</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <p></p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script> <script src="js/scripts.js"></script> <script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js" crossorigin="anonymous"></script> <script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js" crossorigin="anonymous"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js'></script> <script src='https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js'></script> <script src='https://cdn.datatables.net/buttons/1.5.2/js/buttons.bootstrap4.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js'></script> <script src='https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js'></script> <script src='https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js'></script> <script src='https://cdn.datatables.net/buttons/1.5.2/js/buttons.colVis.min.js'></script> </body> </html> <script> $(document).ready(function() { $("#infoModal").on("show.bs.modal", function(event) { var button = $(event.relatedTarget); var id = button.data('id'); $.ajax({ type: 'post', url: 'ajaxfile.php?userid=' + id, // data: 'userid=' + userid, // data: {userid: userid}, success: function(response){ // Add response in Modal body $('.modal-body').html(response); // Display Modal $('#infoModal').modal('show'); } }); }); /* For Export Buttons available inside jquery-datatable "server side processing" - Start - due to "server side processing" jquery datatble doesn't support all data to be exported - below function makes the datatable to export all records when "server side processing" is on */ function newexportaction(e, dt, button, config) { var self = this; var oldStart = dt.settings()[0]._iDisplayStart; dt.one('preXhr', function (e, s, data) { // Just this once, load all data from the server... data.start = 0; data.length = 2147483647; dt.one('preDraw', function (e, settings) { // Call the original action function if (button[0].className.indexOf('buttons-copy') >= 0) { $.fn.dataTable.ext.buttons.copyHtml5.action.call(self, e, dt, button, config); } else if (button[0].className.indexOf('buttons-excel') >= 0) { $.fn.dataTable.ext.buttons.excelHtml5.available(dt, config) ? $.fn.dataTable.ext.buttons.excelHtml5.action.call(self, e, dt, button, config) : $.fn.dataTable.ext.buttons.excelFlash.action.call(self, e, dt, button, config); } else if (button[0].className.indexOf('buttons-csv') >= 0) { $.fn.dataTable.ext.buttons.csvHtml5.available(dt, config) ? $.fn.dataTable.ext.buttons.csvHtml5.action.call(self, e, dt, button, config) : $.fn.dataTable.ext.buttons.csvFlash.action.call(self, e, dt, button, config); } else if (button[0].className.indexOf('buttons-pdf') >= 0) { $.fn.dataTable.ext.buttons.pdfHtml5.available(dt, config) ? $.fn.dataTable.ext.buttons.pdfHtml5.action.call(self, e, dt, button, config) : $.fn.dataTable.ext.buttons.pdfFlash.action.call(self, e, dt, button, config); } else if (button[0].className.indexOf('buttons-print') >= 0) { $.fn.dataTable.ext.buttons.print.action(e, dt, button, config); } dt.one('preXhr', function (e, s, data) { // DataTables thinks the first item displayed is index 0, but we're not drawing that. // Set the property to what it was before exporting. settings._iDisplayStart = oldStart; data.start = oldStart; }); // Reload the grid with the original page. Otherwise, API functions like table.cell(this) don't work properly. setTimeout(dt.ajax.reload, 0); // Prevent rendering of the full data to the DOM return false; }); }); // Requery the server with the new one-time export settings dt.ajax.reload(); }; //For Export Buttons available inside jquery-datatable "server side processing" - End var str1; var adm_str = ''; $('#dataTable').dataTable( { "processing": true, "serverSide": true, "serverMethod": 'post', "ajax": { 'url':'server_side_expiring_users.php' }, "searchDelay": 1000, "pagingType": "full_numbers", "searching": true, "ordering": true, "pageLength": 25, "lengthMenu": [10, 25, 50, 100, 250], dom: "<'row'<'col-md-2'f'><'col-md-10'B>>" + "<'row'<'col-md-9'><'col-md-2'>>" + "<'row'<'col-md-12't>><'row'<'col-md-12'ip>>", "buttons": [ { "extend": 'excel', "text": '<i class="far fa-file-excel style="color: white;"></i> Export', "titleAttr": 'Excel', exportOptions: { columns: [4,1,11,3,5,9,10,7,6], modifier: { search: 'applied', order: 'applied' } }, "action": newexportaction }, { extend: 'pageLength', titleAttr: 'Records to Display', className: 'selectTable' }, ], "columns": [ { data: 'id', "width": "10px", render: function ( data, type, row ) { return '<button type="button" class="userinfo" data-toggle="modal" data-id=' + data + ' data-target="#infoModal">Info</button>'; } }, { data: 'fname', "width": "60px" }, { data: 'ip', "width": "30px", render: function ( data, type, row ) { return '<a target="_blank" href="https://whatismyipaddress.com/ip/' + data + '">' + data + '</a> <br>' + row.isp; } }, { data: 'country', "width": "10px", "orderable": false, "targets": 0 }, { data: 'mac', "width": "30px", render: function ( data, type, row ) { return '<a href="edit_user.php?id=' + row.id + '"> ' + data + '</>'; } }, { data: 'stb_type', "width": "30px" }, { data: 'rName', "width": "30px" }, { data: 'tName', "width": "45px" }, { data: 'status', "width": "30px", "render": function (data, type, row) { if (row.keep_alive <= 900 ) { return data + ' <a style="color: green" title="Online" <i class="fas fa-check-square"></i></a>'; } else { return data; } } }, { data: 'created', "width": "60px" }, { data: 'expire_billing_date', "width": "60px" }, { data: "comment", "width": "60px" }, { data: 'mac', "width": "60px", render: function ( data, type, row ) { if (row.status === 'Active' && row.auto_renew == 'true') { str1 = '<a class="butMsg" href="message_mag.php?id=' + row.id + '" style="color: steelblue" title="Send Message"><i class="fas fa-inbox"></i></a>&nbsp;/&nbsp;' + '<a class="butRenew" href=renew_user.php?id=' + row.id + ' style="color: blue" title="Renew"><i class="fas fa-retweet"></i></a>&nbsp;/&nbsp;' + '<a class="butEdit" href="edit_user.php?id=' + row.id + '" style="color: green" title="Edit User"><i class="fas fa-pen-square"></i></a>&nbsp;/&nbsp;' + '<a class="butAutoRenewal" style="color: green" title="Auto Renewal Enabled"><i class="fas fa-check-circle"></i></a>&nbsp;/&nbsp;' + '<a class="butDisable" href="disable_user.php?id=' + row.id + '" style="color: green" title="Disable User"><i class="fas fa-ban"></i></a>'; } else if (row.status === 'Active' && row.auto_renew == 'false') { str1 = '<a class="butMsg" href="message_mag.php?id=' + row.id + '" style="color: steelblue" title="Send Message"><i class="fas fa-inbox"></i></a>&nbsp;/&nbsp;' + '<a class="butRenew" href=renew_user.php?id=' + row.id + ' style="color: blue" title="Renew"><i class="fas fa-retweet"></i></a>&nbsp;/&nbsp;' + '<a class="butEdit" href="edit_user.php?id=' + row.id + '" style="color: green" title="Edit User"><i class="fas fa-pen-square"></i></a>&nbsp;/&nbsp;' + '<a class="butAutoRenewal" style="color: red" title="Auto Renewal Disabled"><i class="fas fa-check-circle"></i></a>&nbsp;/&nbsp;' + '<a class="butDisable" href="disable_user.php?id=' + row.id + '" style="color: green" title="Disable User"><i class="fas fa-ban"></i></a>'; } else { str1 = '<a class="butMsg" href="message_mag.php?id=' + row.id + '" style="color: steelblue" title="Send Message"><i class="fas fa-inbox"></i></a>&nbsp;/&nbsp;' + '<a class="butRenew" href=renew_user.php?id=' + row.id + ' style="color: blue" title="Renew"><i class="fas fa-retweet"></i></a>&nbsp;/&nbsp;' + '<a class="butEdit" href="edit_user.php?id=' + row.id + '" style="color: green" title="Edit User"><i class="fas fa-pen-square"></i></a>&nbsp;/&nbsp;' + '<a class="butAutoRenewal" style="color: red" title="Auto Renewal Disabled"><i class="fas fa-check-circle"></i></a>&nbsp;/&nbsp;' + '<a class="butDisable" href="disable_user.php?id=' + row.id + '" style="color: red" title="Enable User"><i class="fas fa-ban"></i></a>'; } <?php if ($is_admin == 1 ) echo "adm_str = '&nbsp;/&nbsp;<a class=\"butDelete\" href=\"delete_user.php?id=' + row.id + '\" style=\"color: red\" title=\"Delete User\"><i class=\"fas fa-trash-alt\"></i></a>'";?> return str1 + adm_str; } }, ] }); } ); </script>
Output for 8.5.0 - 8.5.1
Warning: include(include/sess_vars.php): Failed to open stream: No such file or directory in /in/uKNnG on line 2 Warning: include(): Failed opening 'include/sess_vars.php' for inclusion (include_path='.:') in /in/uKNnG on line 2 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 4 Warning: Trying to access array offset on null in /in/uKNnG on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/uKNnG:2) in /in/uKNnG on line 7 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 10 Warning: Trying to access array offset on null in /in/uKNnG on line 10 Warning: include_once(include/conn.php): Failed to open stream: No such file or directory in /in/uKNnG on line 11 Warning: include_once(): Failed opening 'include/conn.php' for inclusion (include_path='.:') in /in/uKNnG on line 11 Warning: include_once(include/functions.php): Failed to open stream: No such file or directory in /in/uKNnG on line 12 Warning: include_once(): Failed opening 'include/functions.php' for inclusion (include_path='.:') in /in/uKNnG on line 12 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 20 Warning: Trying to access array offset on null in /in/uKNnG on line 20 Fatal error: Uncaught Error: Call to undefined function mysqli_query() in /in/uKNnG:25 Stack trace: #0 {main} thrown in /in/uKNnG on line 25
Process exited with code 255.
Output for 8.3.0 - 8.3.29, 8.4.1 - 8.4.16
Warning: include(): open_basedir restriction in effect. File(include/sess_vars.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 2 Warning: include(include/sess_vars.php): Failed to open stream: Operation not permitted in /in/uKNnG on line 2 Warning: include(): Failed opening 'include/sess_vars.php' for inclusion (include_path='.:') in /in/uKNnG on line 2 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 4 Warning: Trying to access array offset on null in /in/uKNnG on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/uKNnG:2) in /in/uKNnG on line 7 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 10 Warning: Trying to access array offset on null in /in/uKNnG on line 10 Warning: include_once(): open_basedir restriction in effect. File(include/conn.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 11 Warning: include_once(include/conn.php): Failed to open stream: Operation not permitted in /in/uKNnG on line 11 Warning: include_once(): Failed opening 'include/conn.php' for inclusion (include_path='.:') in /in/uKNnG on line 11 Warning: include_once(): open_basedir restriction in effect. File(include/functions.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 12 Warning: include_once(include/functions.php): Failed to open stream: Operation not permitted in /in/uKNnG on line 12 Warning: include_once(): Failed opening 'include/functions.php' for inclusion (include_path='.:') in /in/uKNnG on line 12 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 20 Warning: Trying to access array offset on null in /in/uKNnG on line 20 Fatal error: Uncaught Error: Call to undefined function mysqli_query() in /in/uKNnG:25 Stack trace: #0 {main} thrown in /in/uKNnG on line 25
Process exited with code 255.
Output for 8.1.34, 8.2.27 - 8.2.30
Warning: include(): open_basedir restriction in effect. File(include/sess_vars.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 2 Warning: include(include/sess_vars.php): Failed to open stream: Operation not permitted in /in/uKNnG on line 2 Warning: include(): Failed opening 'include/sess_vars.php' for inclusion (include_path='.:') in /in/uKNnG on line 2 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 4 Warning: Trying to access array offset on value of type null in /in/uKNnG on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/uKNnG:2) in /in/uKNnG on line 7 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 10 Warning: Trying to access array offset on value of type null in /in/uKNnG on line 10 Warning: include_once(): open_basedir restriction in effect. File(include/conn.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 11 Warning: include_once(include/conn.php): Failed to open stream: Operation not permitted in /in/uKNnG on line 11 Warning: include_once(): Failed opening 'include/conn.php' for inclusion (include_path='.:') in /in/uKNnG on line 11 Warning: include_once(): open_basedir restriction in effect. File(include/functions.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 12 Warning: include_once(include/functions.php): Failed to open stream: Operation not permitted in /in/uKNnG on line 12 Warning: include_once(): Failed opening 'include/functions.php' for inclusion (include_path='.:') in /in/uKNnG on line 12 Warning: Undefined global variable $_SESSION in /in/uKNnG on line 20 Warning: Trying to access array offset on value of type null in /in/uKNnG on line 20 Fatal error: Uncaught Error: Call to undefined function mysqli_query() in /in/uKNnG:25 Stack trace: #0 {main} thrown in /in/uKNnG on line 25
Process exited with code 255.
Output for 5.6.40
Warning: include(): open_basedir restriction in effect. File(include/sess_vars.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 2 Warning: include(include/sess_vars.php): failed to open stream: Operation not permitted in /in/uKNnG on line 2 Warning: include(): Failed opening 'include/sess_vars.php' for inclusion (include_path='.:') in /in/uKNnG on line 2 Notice: Undefined variable: _SESSION in /in/uKNnG on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/uKNnG:2) in /in/uKNnG on line 7 Notice: Undefined variable: _SESSION in /in/uKNnG on line 10 Warning: include_once(): open_basedir restriction in effect. File(include/conn.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 11 Warning: include_once(include/conn.php): failed to open stream: Operation not permitted in /in/uKNnG on line 11 Warning: include_once(): Failed opening 'include/conn.php' for inclusion (include_path='.:') in /in/uKNnG on line 11 Warning: include_once(): open_basedir restriction in effect. File(include/functions.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/uKNnG on line 12 Warning: include_once(include/functions.php): failed to open stream: Operation not permitted in /in/uKNnG on line 12 Warning: include_once(): Failed opening 'include/functions.php' for inclusion (include_path='.:') in /in/uKNnG on line 12 Notice: Undefined variable: _SESSION in /in/uKNnG on line 20 Fatal error: Call to undefined function mysqli_query() in /in/uKNnG on line 25
Process exited with code 255.

preferences:
28.51 ms | 418 KiB | 5 Q