| Current Path : /var/www/html/rkala/data/ |
| Current File : /var/www/html/rkala/data/got.php |
<?php
$host = '127.0.0.1';
$user = 'root';
$pass = 'cobolt@112358';
$db = 'proto_type';
function test_input($data) {
$data = strip_tags($data);
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
$data = str_replace("\n","",$data);
return $data;
}
function check($con){
if (@$con->connect_errno){
echo "<script> alert('Server is Offline. Please try again later.'); window.location.href = 'logon.php';</script>";
die();
return false;
}
return true;
}
?>
<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: #eee;
color:white !important;
text-align: right;
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>
<!-- Heading -->
<h1 align="center">
Evaluation Board
</h1>
<h3 align="center">
<!-- Creating connection and checking the connection -->
<?php
$con = mysqli_connect($host, $user, $pass, $db);
check($con);
?>
<!-- Starting the connection and getting the image -->
<?php
$bool = 1;
$query = "Select a_id, image from answer where a_id in (3000, 3001, 3002, 3003, 3004)";
$res = mysqli_query($con, $query) or die(mysqli_error());
while($roe = mysqli_fetch_array($res)){
//echo $roe['a_id'] . "<br>";
$bool += 1;
if($bool % 3 == 0){
//echo '<img id="myImg" data-toggle="modal" data-target="#myModal" alt="Trolltunga, Norway" src="data:image/jpeg;base64,'.base64_encode( $roe['image'] ).'"/>';
}else{
//echo '<img id="myImg" data-toggle="modal" data-target="#myModal" alt="Trolltunga, Norway" src="data:image/jpeg;base64,'.base64_encode( $roe['image'] ).'"/>';
}
$file = '/home/shubham/backup/'. $roe['a_id'] . ".jpg";
echo $file . "<br>";
//$success = file_put_contents($file, file_get_contents($roe['image']));
/* $file = fopen($file,"w");
//echo "File name: ".$path."$name\n";
fwrite($file, base64_decode($roe['image']));
fclose($file);*/
//echo $success;
imagejpg( imagecreatefromstring( $roe['image']), $file);
}
mysqli_close($con);
?>
</h3>
</body>
</html>