| 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
isset($package) OR die('No direct access allowed.');
if($opt1 && ($opt1 === 'add' OR $opt1 === 'edit')):
if($opt1 === 'edit' && $opt2):
$stmt = $mysqli->prepare("SELECT $firstcol, name, title, h1heading, metadescription, metakeyword, content, hits, status, creation 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, $title, $h1heading, $metadescription, $metakeyword, $content, $hits, $status, $creation);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
else:
$id = '';$name = '';$title = '';$h1heading = '';$metadescription = '';$metakeyword = '';$content = '';$status = 'enabled';
endif;
$status = $status === 'enabled' ? 'checked' : '';
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>
<input type="text" name="uploadedfileurl" placeholder="Uploaded file URL" class="grey lighten-2 right url" onfocus="this.select()" readonly />
</div>
<div class="body">
<div class="row">
<div class="col s12 m4 l3">
<label for="name">page name<b class="red-text right">*</b></label>
<input type="text" name="name" value="{$name}" id="name" />
</div>
<div class="col s12 m8 l9">
<label for="title">page title<b class="red-text right">*</b></label>
<input type="text" name="title" value="{$title}" id="title" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="h1heading">h1heading</label>
<input type="text" name="h1heading" value="{$h1heading}" id="h1heading" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="metadescription">meta description<b class="red-text right">*</b></label>
<input type="text" name="metadescription" value="{$metadescription}" id="metadescription" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
<label for="metakeyword">meta keywords<b class="red-text right">*</b></label>
<input type="text" name="metakeyword" value="{$metakeyword}" id="metakeyword" />
</div>
</div>
<div class="row">
<div class="col s12 m12 l12 lg">
<label for="content">content</label><br clear="all">
<textarea rows="25" cols="25" name="content" class="htmleditor">{$content}</textarea>
</div>
</div>
<div class="row chk">
<div class="col s12 m12 l12">
<label for="status" class="chklab left"><input type="checkbox" name="status" value="enabled" id="status" {$status} />status</label>
</div>
</div>
</div>
<div class="fixed-action-btn">
<button type="button" class="btn-floating blue accent-4" onclick="$('.upf').show(0);"><i class="material-icons">file_upload</i></button>
</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 blue accent-4 white-text h" onclick="_sopt('savechanges')">Save changes</button>
<button type="submit" class="waves-effect btn-flat h" onclick="_sopt('enabled')">Enable</button>
<button type="submit" class="waves-effect btn-flat h" onclick="_sopt('disabled')">Disable</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>
<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 class="lg" nowrap>name</th>
<th>title</th>
<th class="sm center-align" nowrap>hits</th>
<th class="sm center-align" nowrap>status</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, title, hits, status, creation FROM $table ORDER BY name ASC") or die($mysqli->error);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0):
$stmt->bind_result($id, $name, $title, $hits, $status, $creation);
while($stmt->fetch()):
$snum = $snum + 1;
$color = $status === 'enabled' ? 'green-text' : 'red-text';
$option = $status === 'enabled' ? 'disabled' : 'enabled';
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>{$name}</td>
<td><input type="text" name="title[$id]" value="{$title}" /></td>
<td class="center-align" nowrap>{$hits}</td>
<td class="center-align" nowrap>
<button type="submit" class="{$color}" onclick="_sopt('{$option}', '', this)">{$status}</button>
</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="8" class="center-align">MySQL returned an empty result set (i.e. zero rows).</td></tr>';
endif;
$stmt->close();
echo '</tbody>';
echo '</table>';
endif;
?>