| 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/electrojournal.com/admin/ |
Upload File : |
<?php
if($opt1 && ($opt1 === 'add' OR $opt1 === 'edit')):
if($opt1 === 'edit' && $opt2):
$stmt = $mysqli->prepare("SELECT $firstcol, name 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, $name);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
else:
$id = '';$name = '';
endif;
echo <<<EOJ
<input type="hidden" name="dataid" value="{$id}" readonly />
<div class="head">
<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-4 white-text">Submit</button>
</div>
<div class="body">
<div class="row">
<div class="col s12 m6 l6">
<label for="name">font name<b class="red-text right">*</b></label>
<input type="text" name="name" value="{$name}" id="name" />
</div>
<div class="col s12 m6 l6">
<label for="name">choose font</label>
<div class="file-field">
<div class="btn btn-flat grey lighten-1 white-text">
<span>font</span>
<input type="file" name="font" />
</div>
<div class="file-path-wrapper">
<input type="text" placeholder="Only TTF and OTF allowed." class="file-path" />
</div>
</div>
</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">
<button type="button" class="waves-effect btn-flat green white-text" onclick="_curl('add')">Add new</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>
<button type="submit" class="waves-effect btn-flat" onclick="_sopt('transfertojaccess', 'Do you really want to transfer to J Access?')">transfer to j access</button>
<div class="pagination right"><b class="left">Total Rows : {$total_rows}</b></div>
</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>font name</th>
<th>font</th>
<th class="lg right-align" nowrap>creation</th>
<th class="sm center-align" nowrap>action</th>
</tr>
</thead>
<tbody>
EOJ;
$stmt = $mysqli->prepare("SELECT $firstcol, name, file, 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, $name, $file, $creation);
while($stmt->fetch()):
$snum = $snum + 1;
$file = ($file && file_exists($uploadpath.$page.'/'.$file)) ? '<a href="'.$uploadurl.$page.'/'.$file.'">'.$file.'</a>' : 'Font Missing';
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>{$name}</td>
<td>{$file}</td>
<td class="right-align" nowrap>{$fn->nice_date($creation)}</td>
<td class="center-align" nowrap><button type="button" class="blue-text text-accent-4" onclick="_curl('edit/{$id}')">edit</button></td>
</tr>
EOJ;
endwhile;
else:
echo '<tr><td colspan="6" class="center-align">MySQL returned an empty result set (i.e. zero rows).</td></tr>';
endif;
$stmt->close();
echo '</tbody>';
echo '</table>';
endif;
?>