<?php


include 'config.php';

$pr = $_GET['p'];

session_start();
?>
	<!-- CSS -->
<link type="text/css" href="static/css/bootstrap/bootstrap.css" tppabs="http://100vs500.ru/static/css/bootstrap/admin.css" rel="stylesheet" media="all" />
	<link type="text/css" href="static/css/style.css" tppabs="http://100vs500.ru/static/css/style.css" rel="stylesheet" media="all" />
    <link rel="stylesheet" type="text/css" href="cstyle.css">

,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div align="center" class="btn orange"><center><h1>Admin Panel (Vote1 CMS v1.0)</h1></center></div><br />
<hr/>
<?php

if ($_SESSION['x'] == "235789_34d") {
?>
<br/>

<div align="center" id="menu">
	<ul>
	<li><a class="btn large primary" href="/admin.php" >Домои<img src='/icon/home.ico' border=0></a></li> 
	<li><a class="btn large primary" href="/admin.php?p=lista" >Список Битв<img src='/icon/set.ico' border=0></a></li>
    <li><a class="btn large primary" href="http://gmail.com/" >Твои E-mail  <img src='/icon/address.ico' border=0></a></li>
    	<li><a class="btn large primary" target="_black" href="/add" >Добавить Битву<img src='/icon/down.ico' border=0></a></li>
		<li><a  class="btn large primary"  href="/browse" >Exit  <img src='/icon/exit.ico' border=0></a></li>
	</ul>

</div>
<br/><br />

<br /><br /><br />

<?php
    if ($pr == "lista") {
///////////////////////////
?>

.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div align="center" class="btn orange"><h3>Lista sondajelor</h3></div>
<?php
$page = $_GET['page'];
$ar_page = 50;
$q = 1;

if ($page == "") {
$q = 0;
$page = 1;
}

if ($page == 1) {
$q = 0;
} else {
$q = $ar_page * $page - $ar_page;
$ar_page = $q + $ar_page;
}


    $link = mysql_connect($baza['host'], $baza['user'], $baza['pass'])
        or die("Could not connect : " . mysql_error());
    mysql_select_db($baza['nume']) or die("Eroare!, nume baza de date incoreta");
$table = $baza['table'];
$d = mysql_query("SELECT id FROM $table");
$r = mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT $q , $ar_page");
?>
<br /><br /><br />
<center>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div align="center" class="btn green"><h2> Recent Adaugate : </h2></div><br /><br /></center>
<ul class="battle-list">

<?php
$q = 0;
while ($a = mysql_fetch_assoc($r)) {

$intrebare = $a['intrebare'];
$nume = $a['nume'];
$oponent1 = $a['oponent1'];
$oponent2 = $a['oponent2'];
$img1 = $a['img1'];
$img2 = $a['img2'];
$com1 = $a['com1'];
$com2 = $a['com2'];
$email = $a['email'];
$pass = $a['pass'];
$vote1 = $a['votes1'];
$vote2 = $a['votes2'];
$id = $a['id'];
$date = $a['date'];

$stroy = <<<HTML
	
		<li id="battle62" class="clr ">

	<div class="pics">
		<div class="pic1">
			
							<img width='40' height='40' src="$img1" />
						
			<div class="vote-1">
				$vote1			</div>

		</div>
		<div class="vs">
			vs		</div>

		<div class="pic2">
			
							<img width='40' height='40' src="$img2" />
							
			<div class="vote-2">
				$vote2			</div>
		</div>

	</div>
	
	<div class="title">
		<h2>

			<a target="_black" href="/s=$nume">
				$intrebare		</a> 
                
                
		</h2>
		

				<small>$oponent1 vs $oponent2 
                [ <a target="_black" href="/admin.php?id=$id&p=edit"> EDITEAZA </a> | 
                <a target="_black" href="/admin.php?id=$id&p=delete"> STERGE </a> ]
                </small>

			
	</div>
	

<br><br><br>	
</li>

HTML;
echo $stroy;
}
?>
<h4>Pagine: 
<?php
if ($page == "1") { } else {
$prev = $page - 1;
echo "<a href='/admin.php?p=lista&page=$prev'>< Prev</a> ";
}

$x = mysql_num_rows($d) / $ar_page;
$x = number_format ($x, 0);
$x = $x + 1;
$s = $x;
$pg = 1;
while (1 <= $x) {
echo "<a href='/admin.php?p=lista&page=$pg'>$pg</a> ";
$x = $x - 1;
$pg = $pg + 1;
}

if ($page == $s){ } else {
$next = $page + 1;
echo "<a href='/admin.php?p=lista&page=$next'>Next ></a> ";
}
 ?>

</h4>
</ul>
<br /><br /><br />
 <hr />

<?php
}
if ($pr == "delete") {
include 'admin/a-del.php';
}
if ($pr == "edit") {
include 'admin/a-edit.php';
}
if ($pr == "propuneri") {
include 'admin/a-prop.php';
}
if ($pr == "") {
echo '<center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<h3><div align="center" class="btn large primary">Salut! Pentru a continua lucrul cu Admin Panel alegeti o optiune din MENU!</div></h3></center>';
}
///////////////////////////
} else {
$_GET = str_replace($interzis, $replace, $_GET);
$_POST = str_replace($interzis, $replace, $_POST);

$email = $_POST['email'];
$pass = $_POST['pass'];



if ($_POST['send'] == "") {

echo <<<HTML
<br /><br /><br />
<div align="center">
<form action="" method="post">
  <table border="0">
<center><tr>
 <h3>Logare $ip:</h3>

</tr></center>



&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<tr>
<b>E-Mail:<img src='/icon/address.ico' border=0> </b>
<input name="email" value="$email" size="25">
</tr>
</br></br>
<tr>
<b>Password: <img src='/icon/lock.ico' border=0></b>
<input name="pass" value="$pass" size="25">
</tr>

<tr>
 <td><b>&nbsp;</b></td>
 <td>&nbsp;</td>
</tr>
</br></br>
<tr>
<b></b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="btn large primary" type="submit" name="send" value="Login">
</tr>
 </table>
 </form>

 <hr />
HTML;
} else {
if ($pass == $admin['pass'] && $email == $admin['email']) {
    
$_SESSION['x'] = "235789_34d";
echo "обнови Страницу";
    
} else {
    echo "Eroare!";
}

 echo 'sistem login ....ok!';
}
}
?>