<?php
  
include "../../config.php";
  if(
$_GET['view_source']) view_source();
?><html>
<head>
<title>Challenge 7</title>
</head>
<body>
<?php
$go
=$_GET['val'];
if(!
$go) { echo("<meta http-equiv=refresh content=0;url=index.php?val=1>"); }
echo(
"<html><head><title>admin page</title></head><body bgcolor='black'><font size=2 color=gray><b><h3>Admin page</h3></b><p>");
if(
preg_match("/2|-|\+|from|_|=|\\s|\*|\//i",$go)) exit("Access Denied!");
$db dbconnect();
$rand=rand(1,5);
if(
$rand==1){
  
$result=mysqli_query($db,"select lv from chall7 where lv=($go)") or die("nice try!");
}
if(
$rand==2){
  
$result=mysqli_query($db,"select lv from chall7 where lv=(($go))") or die("nice try!");
}
if(
$rand==3){
  
$result=mysqli_query($db,"select lv from chall7 where lv=((($go)))") or die("nice try!");
}
if(
$rand==4){
  
$result=mysqli_query($db,"select lv from chall7 where lv=(((($go))))") or die("nice try!");
}
if(
$rand==5){
  
$result=mysqli_query($db,"select lv from chall7 where lv=((((($go)))))") or die("nice try!");
}
$data=mysqli_fetch_array($result);
if(!
$data[0]) { echo("query error"); exit(); }
if(
$data[0]==1){
  echo(
"<input type=button style=border:0;bgcolor='gray' value='auth' onclick=\"alert('Access_Denied!')\"><p>");
}
elseif(
$data[0]==2){
  echo(
"<input type=button style=border:0;bgcolor='gray' value='auth' onclick=\"alert('Hello admin')\"><p>");
  
solve(7);
}
?>
<a href=./?view_source=1>view-source</a>
</body>
</html>