| 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/patholjournal.com/admin/ |
Upload File : |
<?php
if(($opt1) && ($opt1 === 'add' || $opt1 === 'edit')):
if(($opt1 === 'edit' && $opt2)):
$stmt = $mysqli->prepare("SELECT $firstcol, image, status FROM $table WHERE $firstcol = ? LIMIT 1") or die($mysqli->error);
$stmt->bind_param('i', $opt2);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->bind_result($id, $image, $status);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
else:
$id = '';$status = 'enabled';
endif;
$status = ($status == 'enabled') ? 'checked' : NULL;
echo <<<EOJ
<input type="hidden" name="dataid" value="{$id}" readonly="readonly" />
<div class="head">
{$back}
<input type="reset" value="reset" class="action" />
<input type="submit" value="submit" class="action b button" />
</div>
<div class="body">
<div class="row">
<label class="flbl">Image :<span class="fr">*</span></label>
<input type="file" name="image" class="field field-file lg" />
</div>
<div class="row">
<div class="rw">
<label><input type="checkbox" name="status" value="enabled" {$status} />status</label>
</div>
</div>
</div>
EOJ;
else:
$stmt = $mysqli->prepare("SELECT * FROM $table") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
$total_rows = $stmt->num_rows();
$stmt->close();
echo <<<EOJ
<div class="head">
<input type="button" value="create new" class="action g" onclick="gourl('add')" />
<input type="submit" value="" class="action ico delete hidden" onclick="setopt(this, 'delete', 'Do you really want to delete?')" />
<input type="submit" value="enable all" class="action" onclick="setopt(this, 'enableall')" />
<input type="submit" value="disable all" class="action" onclick="setopt(this, 'disableall')" />
<div class="fr"><b>Total Rows : {$total_rows}</b></div>
</div>
<table border="0" cellpadding="0" cellspacing="0" class="table">
<thead>
<tr>
<th align="center" valign="middle" class="xs"><input type="checkbox" name="select_all" id="select_all" value="" /></th>
<th align="center" valign="middle" class="xs">s. no.</th>
<th align="left" valign="middle">image</th>
<th align="center" valign="middle" class="md">status</th>
<th align="right" valign="middle" class="md">creation</th>
<th align="center" valign="middle" class="sm">action</th>
</tr>
</thead>
<tbody>
EOJ;
$stmt = $mysqli->prepare("SELECT $firstcol, image, status, creation FROM $table ORDER BY $firstcol DESC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($id, $image, $status, $creation);
while($stmt->fetch()):
$snum = ($page_number == 1) ? $snum + 1 : $page_position++ + 1;
$image = (($image && file_exists($bannersuploadpath . $image))) ? '<img src="'.$bannersdir.$image.'" alt="'.$image.'" style="max-width:500px" >' : '';
$stat = ($status == 'enabled') ? 'disabled' : 'enabled';
$creation = dateformat($creation);
echo <<<EOJ
<tr>
<td align="center" valign="middle"><input type="checkbox" name="dataid[]" value="{$id}" class="checkbox" /></td>
<td align="center" valign="middle">{$snum}</td>
<td align="left" valign="middle">{$image}</td>
<td align="center" valign="middle"><button type="button" class="{$status}" onclick="dopost('{$stat}', '{$id}')">{$status}</button></td>
<td align="right" valign="middle">{$creation}</td>
<td align="center" valign="middle"><button type="button" onclick="gourl('edit/{$id}')">edit</button></td>
</tr>
EOJ;
endwhile;
$stmt->close();
else:
echo '<tr><td align="center" valign="middle" colspan="6">' . $emptyrows . '</td></tr>';
endif;
echo '</tbody>';
echo '</table>';
endif;
?>