<?php
$lcheck = "b";
$z = "b";
eval (" ?>" . headera() . " <?php ");
if ($_GET['load'] == "pages") {

$template = file_get_contents("".$siteurl."/templates/".$maintheme."/pages.php");

if (($_GET['page'] == "") && ($_GET['id'] == "")) {
echo abclist("", "?load=pages");
if (($_GET['abc']) && (strlen($_GET['abc']) == 1)) {
$sql = mysql_query("SELECT * FROM ".$pre."pages WHERE type = 'backend' AND url LIKE '".$_GET['abc']."%' ORDER BY `".$by."` ".$type." LIMIT ".$limit."");
while($row = mysql_fetch_array($sql)) {
echo "- <a href='".$pagepart1.$row[url].$pagepart2."'>".stripslashes($row[name])."</a><br>";
}
}
if ($_GET['abc'] == "") {
$sql = mysql_query("SELECT * FROM ".$pre."pages WHERE type = 'backend' ORDER BY `".$by."` ".$type." LIMIT ".$limit."");
while($row = mysql_fetch_array($sql)) {
echo "- <a href='".$pagepart1.$row[url].$pagepart2."'>".stripslashes($row[name])."</a><br>";
}
}
}

if (($_GET['page']) && ($_GET['id'] == "")) {
$query="SELECT * FROM ".$pre."pages WHERE url = '".$_GET['page']."'";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)) {

$vatepb[0] = "{name}";
$vatepb[1] = "{content}";
$tatepb[0] = stripslashes($row[name]);
$tatepb[1] = stripslashes($row[content]);

if ($row[online] == "No") {
echo "Sorry, but this page is offline!";
} else {
eval (" ?>" . str_replace($vatepb, $tatepb, $template) . " <?php ");
}
}
}

if (($_GET['page'] == "") && ($_GET['id'])) {
$query="SELECT * FROM ".$pre."pages WHERE id = '".$_GET['id']."'";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)) {

$fetch = mysql_query("SELECT name,stats FROM ".$pre."content WHERE id = '".$_GET['aid']."'");
$row2 = mysql_fetch_row($fetch);

    $vatep[0] = "{name}";
	$vatep[1] = "{content}";
	$tatep[0] = $row2[0];
	$tatep[1] = stripslashes($row[content]);

if ($row[online] == "No") {
echo "Sorry, but this page is offline!";
} else {
eval (" ?>" . str_replace($vatep, $tatep, $template) . " <?php ");
}
}

$val = $row2[1] + 1;

mysql_query("UPDATE ".$pre."content SET stats = '".$val."' WHERE id = '".$_GET['aid']."'");

$query2="SELECT * FROM ".$pre."pages WHERE url = '".$aid."' AND online = 'Yes'";
$result2=mysql_query($query2);
$num = mysql_num_rows($result2);
$num2 = $num + 1;
echo "<br><br><b>Page 1 of ".$num2."</b><br><a href='index.php?id=".$_GET['aid']."'>1</a>&nbsp;";
while($row2 = mysql_fetch_array($result2)) {

if ($_GET['id'] == $row2[id]) {
echo "<b>$row2[name]</b>&nbsp;";
} else {
echo "<a href='index.php?load=pages&id=".$row2[id]."'>".$row2[name]."</a>&nbsp;";
}
}
}
eval (" ?>" . footera() . " <?php ");
}
?>