| 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/jyotishajournal/admin/ |
Upload File : |
<?php
if(($opt1) && ($opt1 === 'add' || $opt1 === 'edit' || $opt1 === 'view')):
if(($opt1 === 'edit' || $opt1 === 'view') && ($opt2)):
$stmt = $mysqli->prepare("SELECT $firstcol, name, title, h1heading, metadescription, metakeyword, content, hits, 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, $creation);
$stmt->fetch();
$stmt->close();
if($count_rows !== 1):
die('Invalid data selection.');
endif;
$delete = delete($id);
$title = html_entity_decode($title);$metadescription = html_entity_decode($metadescription);$metakeyword = html_entity_decode($metakeyword);$content = html_entity_decode($content);
$creation = dateformat($creation, true);
else:
$id = '';$name = '';$h1heading = '';$title = '';$metadescription = '';$metakeyword = '';$content = '';
endif;
if($opt1 === 'view'):
echo <<<EOJ
<div class="head">
{$back}{$delete}
<input type="button" value="edit" class="action" onclick="gourl('edit/{$id}')" />
</div>
<table border="0" cellpaddign="0" cellspacing="0" class="table view">
<tr><th>Page Id</th><td>#{$id}</td></tr>
<tr><th>Page Name</th><td>{$name}</td></tr>
<tr><th>Page Title</th><td>{$title}</td></tr>
<tr><th>Meta Description</th><td>{$metadescription}</td></tr>
<tr><th>Meta Keyword</th><td>{$metakeyword}</td></tr>
<tr><th>Page Content</th><td>{$content}</td></tr>
<tr><th>Page Hits</th><td>{$hits}</td></tr>
<tr><th>Date Created</th><td>{$creation}</td></tr>
</table>
EOJ;
elseif(($opt1 === 'add' || $opt1 === 'edit')):
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" />
<input type="button" value="upload file" class="action" onclick="compose('.upf')" style="float:right;margin:0px" />
</div>
<div class="body">
<div class="row">
<div class="fl" style="width:25%">
<label class="flbl">Page Name <small>(Only A-Za-z0-9-_. allowed)</small>:<span class="fr">*</span></label>
<input type="text" name="name" value="{$name}" class="field" />
</div>
<div class="fr" style="width:75%;padding-left:15px">
<label class="flbl">Page Title :<span class="fr">*</span></label>
<input type="text" name="title" value="{$title}" class="field" />
</div>
</div>
<div class="row">
<label class="flbl">H1heading :</label>
<input type="text" name="h1heading" value="{$h1heading}" class="field" />
</div>
<div class="row">
<label class="flbl">Meta Description :<span class="fr">*</span></label>
<input type="text" name="metadesc" value="{$metadescription}" class="field" />
</div>
<div class="row">
<label class="flbl">Meta Keywords :<span class="fr">*</span></label>
<input type="text" name="metakeyword" value="{$metakeyword}" class="field" />
</div>
<div class="row">
<label class="flbl">Page Content :</label>
<div class="fluid lg">
<textarea rows="25" cols="25" name="content" id="editor" class="field">{$content}</textarea>
</div>
</div>
</div>
EOJ;
else:
echo 'Invalid option selection.';
endif;
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="save changes" class="action b hidden" onclick="setopt(this, 'savechanges')" />
<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" class="lg">name</th>
<th align="left" valign="middle">title</th>
<th align="right" valign="middle" class="sm">hits</th>
<th align="right" valign="middle" class="md">date created</th>
<th align="center" valign="middle" class="sm">action</th>
</tr>
</thead>
<tbody>
EOJ;
$stmt = $mysqli->prepare("SELECT $firstcol, name, title, hits, 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, $creation);
while($stmt->fetch()):
$snum = ($page_number == 1) ? $snum + 1 : $page_position++ + 1;
$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">{$name}</td>
<td align="left" valign="middle">
<input type="text" name="title[$id]" value="{$title}" class="field noborder" onfocus="checkbox(this)" onkeypress="return (event.keyCode!=13)" />
</td>
<td align="right" valign="middle">{$hits}</td>
<td align="right" valign="middle">{$creation}</td>
<td align="center" valign="middle">
<button type="button" onclick="gourl('view/{$id}')">view</button>
<button type="button" onclick="gourl('edit/{$id}')">edit</button>
</td>
</tr>
EOJ;
endwhile;
$stmt->close();
else:
echo '<tr><td align="center" valign="middle" colspan="7">' . $emptyrows . '</td></tr>';
endif;
echo '</tbody>';
echo '</table>';
endif;
?>