Demo entry 6361403

php´╝îhtml

   

Submitted by cfz on May 04, 2017 at 08:29
Language: HTML+PHP. Code size: 3.9 kB.

<?php
/*$body =session_id($_COOKIE['session_id']);
*print_r($body);*/
/*print_r($_COOKIE['session_id']);
session_start();*/
/*var_dump($body);
*/
/*$sid= session_id();
print_r($sid);
*/$sid=$_COOKIE[$_COOKIE['user']];
if(!empty($sid)){
$mysqli=new mysqli("localhost","root","163702","FRB");
$sql="select token from online where user='".$_COOKIE['user']."'";
$res=$mysqli->query($sql);
$tok = mysqli_fetch_array($res);}
if($sid==$tok[0]){
$username=$_COOKIE['user'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><script src="./jscode/jquery-3.2.0.min.js"></script>
<meta http-equiv="refresh" content="10800">
<title>FRB Viewer</title>
<script src="./jscode/jquery.cookie.js"></script>
<link rel="stylesheet" type="text/css" href="./css/rset.css">
<link rel="stylesheet" type="text/css" href="./css/candviewer.css">
<body>
<div id ="container"align="center"class="STYLE0">
<div class="STYLE1">
  <p>FRB candidate viewer</p>
  <hr/>
  <p>Index 2073 </p> 
</div>
<div>
<table width="90%" height="90%" border="1" cellpadding="0" cellspacing="2" bordercolor="#00CC00">
    <tr>
      <td width="80%"><img id ="png" src="" width="100%" height="65%"/></td>
      <td width="1%"><table id="tb2" width="100%" height="400px" cellspacing="0" bordercolor:"#00FF00"; >
       
        <tr>
          <td><button class="btn1 bgc1" value =10 onclick="score();">10</button></td>
        </tr>
        <tr>
          <td><button class="btn1 bgc2" value =8 onclick="score();">8</button></td>
        </tr>
        <tr>
          <td><button class="btn1 bgc3" value =6 onclick="score();">6</button></td>
        </tr>
        <tr>
          <td><button class="btn1 bgc4" value =5 onclick="score();">5</button></td>
        </tr>



</td></table></table>      

<button id="get" class="btn2">Get</button>
<button id="out" class="btn2" onclick="out();">Logout</button>
<button class="btn2" onclick="prev();">< prev</button>

<button class="btn2" onclick="next();">next ></button>
</div>
</div>
</body>




<script>
var i=0
var dat
var url="./getimage.php"
var username="<?php echo $username ?>"
var url_user=url+"?username="+username

$(document).ready(function(){
	$("#get").click(function(){
		$.get(url_user,function(data,status){
				dat=JSON.parse(data)
				alert("100 more new sources!")
				var png=trims("./png_frb/"+dat[0].Image)
				document.getElementById("png").src=png
		});
	});
});


		


	function out(){
var keys=document.cookie.match(/[^ =;]+(?=\=)/g);
alert("GoodBye!")
    if (keys) {
        for (var j =  keys.length; j--;){
            document.cookie=keys[j]+'=0';
   }
		location.href="./login.html";
 }    
}





	function trims(str){  
	    return str.replace(/[ ]/g,"");   
} 



	function prev(){
	if(i==0){i=0}
	else{i=i-1}

		var png=trims("./png_frb/"+dat[i].Image)
			document.getElementById("png").src=png
}

	function next(){
	i=i+1
		var png=trims("./png_frb/"+dat[i].Image)
		document.getElementById("png").src=png
}



	function score(){
document.getElementById("tb2").onclick=function(ev) {
	scor = ev.target.value;
	if(scor){
var username="<?php echo $username ?>";
var tid=dat[i-1].ID;
url=url+"?username="+username
url=url+"&tid="+tid
url_score=url+"&score="+scor


$(document).ready(function(){
		$.get(url_score,function(data,status){
	//alert(status+"ful!")
		});
});



	}
}
next()
}

<?php 
} else{setcookie('user','');
setcookie('session_id','');
setcookie($_COOKIE['user'],'');
echo "<script>alert('Your account had been online on another device,try again!')</script>";
header("Refresh:1;url=./login.html");
}
?>
</script>
</html>

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).