| 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/www/cropandweed/admin/ |
Upload File : |
<?php
if($opt1 && ($opt1 === 'add' OR $opt1 === 'edit' OR $opt1 === 'import')):
if($opt1 === 'edit' && $opt2):
$stmt = $mysqli->prepare("SELECT $firstcol, manuscriptid, title, author, 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, $manuscriptid, $title, $author, $status);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
$optfld = '';
else:
$id = '';$manuscriptid = '';$title = '';$author = '';$status = '';
endif;
if($opt1 === 'add' OR $opt1 === 'edit'):
echo <<<EOJ
<input type="hidden" name="dataid" value="{$id}" />
<div class="head white">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="submit" class="waves-effect btn-flat blue accent-3">submit</button>
</div>
<div class="body white">
<div class="row">
<div class="col s12 m12 l12">
<label for="manuscriptid">manuscript id<b class="red-text right">*</b></label>
<input type="text" name="manuscriptid" value="{$manuscriptid}" id="manuscriptid" class="int" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="title">article title<b class="red-text right">*</b></label><br clear="all">
<textarea rows="25" cols="25" name="title" id="htmleditor">{$title}</textarea>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="author">author<b class="red-text right">*</b></label>
<input type="text" name="author" value="{$author}" id="author" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="status">status<b class="red-text right">*</b></label>
<input type="text" name="status" value="{$status}" id="status" />
</div>
</div>
</div>
EOJ;
elseif($opt1 === 'import'):
echo <<<EOJ
<div class="head white">
<button type="button" class="waves-effect btn-flat" onclick="history.back()"><i class="material-icons">keyboard_return</i></button>
<button type="submit" class="waves-effect btn-flat blue accent-3">submit</button>
</div>
<div class="body white">
<div class="row">
<div class="col s12 m12 l12">
<div class="file-field">
<div class="btn btn-flat grey lighten-1">
<span>excel file</span>
<input type="file" name="file" />
</div>
<div class="file-path-wrapper">
<input type="text" name="file" placeholder="Only excel file allowed." class="file-path" />
</div>
</div>
</div>
</div>
</div>
EOJ;
else:
echo 'Invalid option selection.';
endif;
else:
$keyword = "%$keyword%";
if($opt1 === 'search'):
$stmt = $mysqli->prepare("SELECT * FROM $table WHERE (title LIKE ? OR author 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 white">
<button type="button" class="waves-effect btn-flat green" onclick="cURL('add')">add new</button>
<button type="button" class="waves-effect btn-flat" onclick="cURL('import')"><i class="material-icons left">file_upload</i>import</button>
<button type="submit" class="waves-effect btn-flat blue accent-3 h" onclick="sOPT('savechanges', '')">save changes</button>
<button type="submit" class="waves-effect btn-flat h" onclick="sOPT('delete', 'Do you really want to delete?')"><i class="material-icons">delete</i></button>
{$pagination->get($total_rows, $page_number, $item_per_page)}
</div>
<table class="table">
<thead>
<tr>
<th class="xs center-align"><input type="checkbox" name="checkall" id="checkall" value="" /></th>
<th class="xs center-align">s. no.</th>
<th class="xs center-align">ms no.</th>
<th>title</th>
<th>author</th>
<th class="md center-align">status</th>
<th class="xs center-align">action</th>
</tr>
</thead>
<tbody>
EOJ;
if($opt1 === 'search'):
$stmt = $mysqli->prepare("SELECT $firstcol, manuscriptid, title, author, status FROM $table WHERE (title LIKE ? OR author LIKE ?) ORDER BY $firstcol DESC") or die($mysqli->error);
$stmt->bind_param('ss', $keyword, $keyword);
else:
$stmt = $mysqli->prepare("SELECT $firstcol, manuscriptid, title, author, status 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, $manuscriptid, $title, $author, $status);
while($stmt->fetch()):
$snum = $page_number === 1 ? $snum + 1 : $page_position++ + 1;
$title = html_entity_decode($title);
$author = html_entity_decode($author);
echo <<<EOJ
<tr>
<td class="center-align"><input type="checkbox" name="dataid[]" value="{$id}" class="checkbox" /></td>
<td class="center-align">{$snum}</td>
<td class="center-align">{$manuscriptid}</td>
<td>{$title}</td>
<td>{$author}</td>
<td><input type="text" name="status[$id]" value="{$status}" /></td>
<td class="center-align"><button type="button" class="blue-text text-accent-3" onclick="cURL('edit/{$id}')">edit</button></td>
</tr>
EOJ;
endwhile;
$stmt->close();
else:
echo '<tr><td class="center-align" colspan="7">MySQL returned an empty result set (i.e. zero rows).</td></tr>';
endif;
echo '</tbody>';
echo '</table>';
endif;
?>