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>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0110.01016.77
8.5.00.0190.01116.84
8.4.160.0230.01519.82
8.4.150.0300.01119.56
8.4.140.0340.00817.85
8.4.130.0270.00819.52
8.4.120.0380.00917.91
8.4.110.0400.00917.89
8.4.100.0440.01117.80
8.4.90.0420.01017.86
8.4.80.0430.01217.98
8.4.70.0470.00717.85
8.4.60.0430.01017.73
8.4.50.0350.01117.77
8.4.40.0350.01017.78
8.4.30.0410.01418.00
8.4.20.0380.00917.73
8.4.10.0330.00717.76
8.3.290.0290.00518.39
8.3.280.0210.00518.46
8.3.270.0250.00416.95
8.3.260.0210.00916.85
8.3.250.0280.01116.66
8.3.240.0290.01216.73
8.3.230.0310.01016.72
8.3.220.0330.00916.71
8.3.210.0320.00816.88
8.3.200.0290.01216.75
8.3.190.0330.00816.77
8.3.180.0350.01216.87
8.3.170.0370.01516.75
8.3.160.0430.01216.85
8.3.150.0420.01116.86
8.3.140.0420.00816.78
8.3.130.0390.00816.92
8.3.120.0370.01016.82
8.3.110.0340.01316.93
8.3.100.0420.01016.72
8.3.90.0390.01316.86
8.3.80.0390.01116.89
8.3.70.0420.01117.04
8.3.60.0410.01117.04
8.3.50.0430.00716.62
8.3.40.0370.01018.10
8.3.30.0300.01117.89
8.3.20.0260.01318.03
8.3.10.0330.00717.88
8.3.00.0230.00618.11
8.2.300.0490.01118.05
8.2.290.0360.00916.58
8.2.280.0370.00616.94
8.2.270.0320.01316.68
8.1.340.0340.01217.62
5.6.400.0210.00716.16

preferences:
30.8 ms | 403 KiB | 5 Q