| Server IP : 192.169.170.185 / Your IP : 216.73.216.97 Web Server : Apache System : Linux p3plmcpnl495852.prod.phx3.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64 User : akhilnew ( 1712764) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/akhilnew/public_html/masscomjournal.com/admin/ |
Upload File : |
<?php
function statuses($status)
{
$statuses = array('Submit', 'Under Review', 'Accepted', 'Dues Completed', 'Proof Send', 'Published');
$lists = '';
foreach($statuses as $list):
$lists .= '<option value="'.$list.'" '.($status === $list ? 'selected' : '').'>'.$list.'</option>';
endforeach;
return $lists;
}
if($opt1 === 'search'):
$stmt = $mysqli->prepare("SELECT * FROM $table WHERE (email LIKE ? OR title LIKE ?)") or die($mysqli->error);
$stmt->bind_param('ss', $keyword, $keyword);
$stmt->execute();
$stmt->store_result();
$total_rows = $stmt->num_rows();
$stmt->close();
else:
$stmt = $mysqli->prepare("SELECT * FROM $table") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$total_rows = $stmt->num_rows();
$stmt->close();
endif;
echo <<<EOJ
<div class="head">
<button type="submit" class="waves-effect btn-flat blue accent-4 white-text h" onclick="_sopt('savechanges')">Save changes</button>
<button type="submit" class="waves-effect btn-flat red h" onclick="_sopt('delete', 'Do you really want to delete?')"><i class="material-icons white-text">delete</i></button>
{$pagination->get($total_rows, $page_number, $item_per_page)}
</div>
<table class="table">
<thead>
<tr>
<th class="xs center-align" nowrap><input type="checkbox" name="checkall" value="" class="checkall" /></th>
<th class="xs center-align" nowrap>s. no.</th>
<th nowrap>email</th>
<th>title</th>
<th class="lg center-align">status</th>
<th class="md center-align" nowrap>publish</th>
<th class="lg right-align" nowrap>creation</th>
</tr>
</thead>
<tbody>
EOJ;
if($opt1 === 'search'):
$stmt = $mysqli->prepare("SELECT $firstcol, email, title, status, publish, creation FROM $table WHERE (email LIKE ? OR title LIKE ?) ORDER BY $firstcol DESC") or die($mysqli->error);
$stmt->bind_param('ss', $keyword, $keyword);
else:
$stmt = $mysqli->prepare("SELECT $firstcol, email, title, status, publish, creation FROM $table ORDER BY $firstcol DESC LIMIT $page_position, $item_per_page") or die($mysqli->error);
endif;
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($id, $email, $title, $status, $publish, $creation);
while($stmt->fetch()):
$snum = $page_number === 1 ? $snum + 1 : $page_position++ + 1;
$status = statuses($status);
$publish = $publish !== '0000-00-00' ? date('d/m/Y', strtotime($publish)) : '<i>Not Published</i>';
echo <<<EOJ
<tr>
<td class="center-align" nowrap><input type="checkbox" name="dataid[]" value="{$id}" class="checkbox" /></td>
<td class="center-align" nowrap>{$snum}</td>
<td nowrap>{$email}</td>
<td>{$title}</td>
<td class="center-align">
<select name="status[$id]" class="browser-default" onchange="if(this.value) { _sopt('', '', this); $('button.h').show(0); } else { $(this).parents('tr').find('.checkbox').attr('checked',false); $('button.h').hide(0); }">
<option value="" selected="selected">Select Status</option>
{$status}
</select>
</td>
<td class="center-align" nowrap>{$publish}</td>
<td class="right-align" nowrap>{$fn->nice_date($creation)}</td>
</tr>
EOJ;
endwhile;
else:
echo '<tr><td colspan="7" class="center-align">MySQL returned an empty result set (i.e. zero rows).</td></tr>';
endif;
$stmt->close();
echo '</tbody>';
echo '</table>';
?>