| Current Path : /var/www/html/rkala/data/ |
| Current File : /var/www/html/rkala/data/ade17cf367881f2dc37c613d6.php |
<?php
include 'credential.php';
?>
<html>
<head>
<style>
#myImg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
#myImg:hover {opacity: 0.7;}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
/* Modal Content (image) */
.modal-content {
margin: auto;
display: block;
width: 200%;
max-width:700px;
}
/* Caption of Modal Image */
#caption {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
text-align: center;
color: #ccc;
padding: 10px 0;
height: 150px;
}
/* Add Animation */
.modal-content, #caption {
-webkit-animation-name: zoom;
-webkit-animation-duration: 0.6s;
animation-name: zoom;
animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
from {-webkit-transform:scale(0)}
to {-webkit-transform:scale(1)}
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
.rotate90 {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
/* The Close Button */
.close {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
}
.close:hover,
.close:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
/* 100% Image Width on Smaller Screens */
@media only screen and (max-width: 700px){
.modal-content {
width: 100%;
}
}
</style>
<script src="js/jquery-2.1.3.js"></script>
<script src="js/bootstrap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<style>
table, th, td {
padding: 50px;
border: 0px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: center;
}
table#t02 {
border: 2px solid black;
}
table#t02 th {
background-color: black;
color: white;
}
table#t01 tr:nth-child(even) {
background-color: #ded;
}
table#t01 tr:nth-child(odd) {
background-color:#fff;
}
table#t01 th {
background-color: black;
color: white;
}
.modal-header, h4, .close {
background-color: #5cb85c;
color:white !important;
text-align: center;
font-size: 30px;
}
h2{
background-color: #bbb;
color:white !important;
text-align: center;
padding-right : 50px;
font-size: 20px;
}
.modal-footer {
background-color: #f9f9f9;
}
</style>
<script type='text/javascript'>
$(document).ready(function () {
$('img').on('click', function () {
var image = $(this).attr('src');
$('#myModal').on('show.bs.modal', function () {
$('.img-responsive').attr('src', image);
});
});
$('[id^=input_form_2]').on('submit',(function(e) {
e.preventDefault();
$.ajax({
url: 'tester/sam7.php',
type: 'POST',
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
timeout:15000,
beforeSend: function()
{
$('#status').attr('src', 'img/wait.png');
},
success: function(data)
{
$('#status').attr('src', 'img/tick.png');
$('#status').show();
},
error: function()
{
$('#status').attr('src', 'img/cross.png');
$('#status').show();
}
});
}));
});
</script>
</head>
<body>
<h1 align="center">
Query Board
</h1>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body" >
<img class="img-responsive" src="img/schema.png"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<h2>
<form action="ade17cf367881f2dc37c613d6.php" method="post">
<table align="center"><tr><td>
Input Query::</td><td>
<textarea name="query" rows="4" cols="80" placeholder="SQL Query. e.g.: Select a_id, image from answer where a_id=1400"></textarea><td>
<td rowspan="2"><img id="myImg" data-toggle="modal" data-target="#myModal" width="400" height="250"
<?php
$con = mysqli_connect($host, $user, $pass, $db);
check($con);
$query = "Select image from answer where a_id=1300";
$res = mysqli_query($con, $query) or die(mysqli_error());
while ($row = mysqli_fetch_assoc($res)){
foreach($row as $value) {
echo 'src="data:image/png;base64,'.base64_encode( $value ).'"';
}
}
mysqli_close($con);
?>
/></td>
</tr><tr><td>
Image Column no.::</td><td>
<textarea name="image" rows="1" cols="80" placeholder="column number starting from 1, e.g. 2"></textarea></td></tr>
</table><br>
<input style="background-color: #5cb85c;"type="submit" name="submit" value="Submit" /></form>
</h2>
<h3 align="center">
<?php
if (isset($_POST['query']) && $_POST['query'] != ""){
$con = mysqli_connect($host, $user, $pass, $db);
check($con);
$query = "Select a_id, image from answer where a_id=1400";
$chk = 2;
$query = $_POST['query'];
$chk = $_POST['image'];
echo $query . "\n";
$res = mysqli_query($con, $query) or die(mysqli_error());
echo '<table>';
while ($row = mysqli_fetch_assoc($res)){
echo '<tr>';
$i = 1;
foreach($row as $value) {
if($i == $chk){
echo '<td><img id="myImg" data-toggle="modal" data-target="#myModal" alt="Trolltunga, Norway" src="data:image/jpeg;base64,'.base64_encode( $value ).'"/></td>';
}else{
echo "<td>$value</td> ";
}
$i += 1;
}
echo ' </tr>';
}
mysqli_close($con);
echo '</table>';
}
?>
</h3>
</body>
</html>