PHP Classes
elePHPant
Icontem

File: xcoxco.php

Recommend this page to a friend!
  Classes of Damir  >  PHP Even Swaps  >  xcoxco.php  >  Download  
File: xcoxco.php
Role: Example script
Content type: text/plain
Description: Using defined problem
Class: PHP Even Swaps
Implement decision methods using Even Swaps
Author: By
Last change: Fixing multiple page back
Date: 1 year ago
Size: 19,112 bytes
 

 

Contents

Class file image Download
<?
class Baza {
var $broj;
var $polje;
var $zapolje;
   
   function __construct($polje=NULL, $broj=NULL,  $zapolje=NULL) {
       $this->broj=$broj;
       $this->polje=$polje;
       $this->zapolje=$zapolje;
   }
}

session_start();
error_reporting(0);
require_once('instfile.php');
date_default_timezone_set('Europe/Zagreb');

if(isset($_GET['dSsSsSslsksls989___Ss']))$_SESSION['prid']=$_GET['dSsSsSslsksls989___Ss']; 
if(isset($_GET['aooaaooaoaoppa']))$_SESSION['prime']=$_GET['aooaaooaoaoppa']; 
                            
if(isset($_GET['dhujhduhuuu'])  && $_GET['dhujhduhuuu']=='e666e6etz') {
 $projid=$_SESSION['prid'];
 $prime=$_SESSION['prime'];
 
 session_unset();
 session_destroy();
 session_write_close();
       
         unset($_SESSION);  
         $_SESSION=array(); 
    
        
    //setcookie(session_name(),'',0,'/');
    
      if(isset($_GET['RrrrRrrrRkkokoRr'])  && $_GET['RrrrRrrrRkkokoRr']=='8rir9r8rir9r8r') {
      header('Location: index.php');
      exit(4);
       } 
       
       session_start();
     $_SESSION['prid']=$projid; 
     $_SESSION['prime']=$prime;   
}
$projid=$_SESSION['prid'];          


function transpose($array) {
    array_unshift($array, null);
    return call_user_func_array('array_map', $array);
}

$jk= new DB();


  if(!isset($_SESSION['sol_atrib']) ){
$sel="SELECT atribut.ime AS ATRIBIME, atribid, solid, solucije.ime AS SOLIME, iznos
FROM atribut, sol_tab, solucije
WHERE prid ='".$projid."' 
AND atribid = atribut.id
AND solid = solucije.id
ORDER BY atribid ASC , solid ASC";
  $skir=$jk->DBquery($sel);
      if (!$skir){
      exit(4);
      }   
      
      

       $sol_atrib=$jk->DBres2arrN($skir); 
 $_SESSION['sol_atrib']= $sol_atrib;   
 $polje1=new Baza($sol_atrib, 0, $sol_atrib);
$_SESSION['dir_sit'][0]=$polje1; 
                
                                    
       }
      
      
      
      
      if(isset($_GET['kskssk'])){
      
      $kkllkkll=$_GET['kskssk'];
      
       $zadnji=$_SESSION['dir_sit'][$kkllkkll]; 
       $sol_atriba=$zadnji->zapolje;
       $sol_atrib=$zadnji->polje;
               
       while(isset($_SESSION['dir_sit'][++$kkllkkll]))
          unset($_SESSION['dir_sit'][$kkllkkll]);
               
         for($i=0;$i<count($sol_atriba);$i++){
         if(isset($sol_atriba[$i][0]['atribid']))
         $atribi[$i]=$sol_atriba[$i][0]['atribid'];  
                                           }
                                         
         $atribnum=count($atribi);
         
          for($i=0;$i<count($sol_atriba[0]);$i++){
          $solibi[$i]['ime']=$sol_atriba[0][$i]['SOLIME'];
          $solibi[$i][1]=$sol_atriba[0][$i]['SOLIME'];
          $solibi[$i]['id']=$sol_atriba[0][$i]['solid']; 
          $solibi[$i][0]=$sol_atriba[0][$i]['solid'];          
                                            } 
                                            
          $solnum=count($solibi);    
          
      } 
      else{
             $sel="Select atribut.id  from  atribut  where prid='".$projid."' order by atribut.id  asc ";
  $skir=$jk->DBquery($sel);
      if (!$skir){
      exit(4);
      }   
 $atribi=$jk->DBres2arrN($skir); 
 $atribnum=count($atribi);
 
 
 
          $sel="Select distinct solucije.id, solucije.ime from solucije, sol_tab where solucije.id=solid and atribid in(Select id from atribut where prid='".$projid."') order by solid asc ";
  $skir=$jk->DBquery($sel);
      if (!$skir){
      exit(4);
      }   
  $solibi=$jk->DBres2arrN($skir); 
 $solnum=count($solibi);
         $atribnum1= $atribnum; 
         $_SESSION['atribnum1']= $atribnum1-1;               
      
      } 
$atribnum1=$_SESSION['atribnum1'];

//            
 
   

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<title>Even Swaps</title>
<link href="stilovi.css" rel="stylesheet" type="text/css">
<script src="RICO/src/prototype.js" type="text/javascript"></script>
<script src="RICO/src/rico.js" type="text/javascript"></script>
<script src="RICO/src/ricoAjaxEngine.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {margin:0px; padding:0px; background-color:transparent; height: 100%;color: black}
table {table-layout: fixed; white-space: nowrap;}
.tddd{  
width:auto;
margin:0px;
padding-bottom:3px; 
padding-top:4px;
font-family:"Trebuchet MS", Helvetica, sans-serif ;
cursor:pointer;
    overflow: hidden;
    font-size: 12px; 
    font-size: 0.7vw;
    white-space:nowrap;
}
.zalba{  
margin-top:50px; padding-bottom:3px; font-family:"Trebuchet MS", Helvetica, sans-serif ; font-size:22px; font-weight:bolder; text-align:center;  
background-color:Orange;
border:1px inset #DCDCDC;border-radius:20px;padding: 5px 8px;color: #333;
  box-shadow: 
    inset 0 2px 0 rgba(0,0,0,.2), 
    0 0 4px rgba(0,0,0,0.1); 
        height:auto !important; /* real browsers */
    min-width: 0px;
    display: table;
clear: right;
vertical-align:middle;
    margin-left: auto;
    margin-right: auto;
}
.zalba:hover{  
 background-color: #398525; 
}

.tdddaaa{  width:auto;margin:0px; padding-bottom:3px; padding-top:4px; border:0px;}
.tdddff{ border:1px solid gray; width:auto;margin:0px; padding-bottom:3px; padding-top:4px;font-family:"Trebuchet MS", Helvetica, sans-serif ;text-decoration: line-through;background-color:Silver;}
.tdddbrd{ border:1px solid black; width:auto;margin:0px; padding-bottom:3px; padding-top:4px;}
.tdddbb{ border-bottom:0px; width:auto;margin:0px; padding-bottom:3px; padding-top:4px;background-color:#abcdef; }
.tdddgg{ border:1px solid gray; width:auto;margin:0px; padding-bottom:3px; padding-top:4px;background-color:AliceBlue; }
.razmak{  width:auto;margin:0px; padding-bottom:13px; padding-top:13px;padding-left:24px; padding-right:24px;background-color:AliceBlue; display:table; vertical-align:middle; }
.razmakp{  width:auto;margin:0px; padding-bottom:13px; padding-top:13px;padding-left:24px; padding-right:24px;background-color:AliceBlue; display:table-cell; vertical-align:middle; }
.kdod{ background-color:transparent;white-space:nowrap; border:0px; font-size:12px;text-align:center; text-transform: uppercase;}
.kdodd{ background-color:transparent; text-align:center;border:0px;font-size:12px; text-transform: uppercase; padding-left:2px;}
td {padding:0px; border:0px; border:1px solid black; background-color:transparent; text-align:center; font-size:16px; font-weight:bold;}
.tbl{   font-size:14px; font-family:  Tahoma, Geneva, sans-serif;}
.txshd{color: white;text-shadow: 2px 2px 4px #000000;}
.cop{padding:5px;  text-align:left; border:1px Solid Gray; color:White; font-family:verdana; font-size:13px;}
.impresije{ border:0px; color:White;  display:block; padding:0px; margin:0px; width:100%; height:100%; display:block;}
.copyras{ text-align:center; font-family:courier; font-size:9px;  }
.domio{ text-align:center; font-family:courier; font-size:11px; display:table-row; clear:right; width:auto; vertical-align:middle;}
.domiocell{ text-align:center; font-family:courier; font-size:11px; display:table-cell;vertical-align:middle; max-width:100px; }
.dodDodDop2{   width:50px;
margin-bottom:3px;
margin-top:3px;
  border:1px inset #DCDCDC;
  border-radius: 20px;
  padding: 5px 8px;
  color: #333;
   text-shadow: 0px 2px 4px rgba(255, 255, 255, 0.4); 
  box-shadow: 
    inset 0 2px 0 rgba(0,0,0,.2), 
    0 0 4px rgba(0,0,0,0.1);}

input[type=submit]:hover, input[type="button"]:hover {
    border: 1px solid #999;color:#000;
}
input[type="submit"], input[type="button"] {
background: #398525; /* old browsers */
background: -moz-linear-gradient(top, #8DD297 0%, #398525 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#8DD297), color-stop(100%,#398525)); /* webkit */
display: table-cell; width: 150px; height: 30px; padding: 0px; margin: 0 auto;
box-shadow: inset 0px 0px 6px #fff;
-webkit-box-shadow: inset 0px 0px 6px #fff;
border: 1px solid #5ea617;
border-radius: 10px;
font-size:12px;
vertical-align:middle; 

}
#evome
{
 
  background-color: #F07575; /* fallback color if gradients are not supported */
  background-image: -webkit-linear-gradient(top, hsl(0, 80%, 70%), #bada55); /* For Chrome 25 and Safari 6, iOS 6.1, Android 4.3 */
  background-image:    -moz-linear-gradient(top, hsl(0, 80%, 70%), #bada55); /* For Firefox (3.6 to 15) */
  background-image:      -o-linear-gradient(top, hsl(0, 80%, 70%), #bada55); /* For old Opera (11.1 to 12.0) */ 
  background-image:         linear-gradient(to bottom, hsl(0, 80%, 70%), #bada55); /* Standard syntax; must be last */


border:1px inset #DCDCDC;border-radius:20px;padding: 5px 8px;color: #333;
  box-shadow: 
    inset 0 2px 0 rgba(0,0,0,.2), 
    0 0 4px rgba(0,0,0,0.1); 

display:block;
text-align:center; font-weight:bold; cursor:pointer;
position:relative; margin-left:15px;margin-right:15px; vertical-align:middle;    
} 
#grad
{
background: -webkit-linear-gradient(left,Gray  ,AliceBlue  ); /*Safari 5.1-6*/
background: -o-linear-gradient(right,Gray  ,AliceBlue  ); /*Opera 11.1-12*/
background: -moz-linear-gradient(right,Gray  ,AliceBlue  ); /*Fx 3.6-15*/
background: linear-gradient(to right, Gray  , AliceBlue  ); /*Standard*/

border:1px inset #DCDCDC;border-radius:20px;padding: 5px 8px;color: #333;
  box-shadow: 
    inset 0 2px 0 rgba(0,0,0,.2), 
    0 0 4px rgba(0,0,0,0.1); 

height:22px; width:182px; display:inline;
text-align:center; font-weight:bold; cursor:pointer;
position:relative; margin-left:15px;margin-right:15px; vertical-align:middle;    
} 
#grad:hover
{
background: -webkit-linear-gradient(left,AliceBlue,Gray); /*Safari 5.1-6*/
background: -o-linear-gradient(right,AliceBlue,Gray); /*Opera 11.1-12*/
background: -moz-linear-gradient(right,AliceBlue,Gray); /*Fx 3.6-15*/
background: linear-gradient(to right, AliceBlue, Gray); /*Standard*/

border:1px inset #DCDCDC;border-radius:20px;padding: 5px 8px;color: #333;
  box-shadow: 
    inset 0 2px 0 rgba(0,0,0,.2), 
    0 0 4px rgba(0,0,0,0.1);
}
#dolje {
width: 95%;
clear: left; margin-bottom:3px; /* stick to bottom */
padding-top: 6px;
margin-top:15px;
    margin-left: auto;
    margin-right: auto;
border:1px outset #DCDCDC;border-radius:30px;padding: 5px 8px;color: #333;
min-height:200px;
    background: -webkit-linear-gradient(white, WhiteSmoke ); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(white, WhiteSmoke ); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(white, WhiteSmoke ); /* For Firefox 3.6 to 15 */
    background: linear-gradient(white, WhiteSmoke ); /* Standard syntax (must be last) */
}
#gore{
width: 95%;
text-align: left;
    height:auto !important; /* real browsers */
    min-width: 0px;
    display: table;
clear: right;
padding-top: 6px;
margin-top:15px;
vertical-align:middle;
    margin-left: auto;
    margin-right: auto;
    border:1px inset #DCDCDC;border-radius:30px;padding: 5px 8px;color: #333;
    background: -webkit-linear-gradient(WhiteSmoke,white  ); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(WhiteSmoke,white  ); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(WhiteSmoke,white  ); /* For Firefox 3.6 to 15 */
    background: linear-gradient(WhiteSmoke,white  ); /* Standard syntax (must be last) */
}

.box
{
	position: relative;
	width: 990px;
	padding: 50px;
	margin: 0 auto;
	background-color: #fff;
	-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
	-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
}

.box:before, .box:after
{
	position: absolute;
	width: 40%;
	height: 10px;
	content: ' ';
	left: 12px;
	bottom: 12px;
	background: transparent;
	-webkit-transform: skew(-5deg) rotate(-5deg);
	-moz-transform: skew(-5deg) rotate(-5deg);
	-ms-transform: skew(-5deg) rotate(-5deg);
	-o-transform: skew(-5deg) rotate(-5deg);
	transform: skew(-5deg) rotate(-5deg);
	-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
	-moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
	z-index: -1;
} 

.box:after
{
	left: auto;
	right: 12px;
	-webkit-transform: skew(5deg) rotate(5deg);
	-moz-transform: skew(5deg) rotate(5deg);
	-ms-transform: skew(5deg) rotate(5deg);
	-o-transform: skew(5deg) rotate(5deg);
	transform: skew(5deg) rotate(5deg);
}
 -->
 </style>

 <script type="text/javascript">
var rr=false;
var rrsto="";
var rrstoo=false;
var tz=false;
var tzsto="";
var solnum=<?echo $atribnum1; ?>;
var solnum2=<?if($kkllkkl_l==($atribnum1))echo $atribnum1; else echo "0";?>;

var trrttrrt="<?if(isset($_GET['kskssk']))for($i=0;$i<$_GET['kskssk'];$i++)echo "<a href='xcoxco.php?kskssk=".($i+1)."'>".($i+1)." </a>&nbsp;&nbsp;&nbsp;&nbsp; ";?>";

  function djk(i){

  if(solnum==1 || ( solnum==solnum2)){
      console.log("solnum=1 -- exit"+solnum2);
      hajdemoca=confirm("There is no more solutions!");
      return false;
      }

console.log("atribut:"+i.cells[0].innerHTML);
if(rrstoo){
idi_atrib(rrsto,i.cells[0].innerHTML);
rrstoo=false; rrsto=false;rr=false; document.getElementById('sksosk').disabled=true;
return false;
}

if(!rr){rr=true;i.style.backgroundColor="#abcdef";
var tb=document.getElementById('sksosk'); 
tb.disabled=false;
rrsto=i.cells[0].innerHTML;
}
else{
    rr=false;
i.style.backgroundColor="";
var tb=document.getElementById('sksosk');
tb.disabled=true; 
rrsto="";    
    }
                 }
                 
                 
    function Dsd(i){
console.log("solucija:"+i.innerHTML);
if(!tz){tz=true;i.style.backgroundColor="#fedcba";
var tb=document.getElementById('sksoska'); 
tb.disabled=false;
tzsto=i.innerHTML;
}
else{
    tz=false;
i.style.backgroundColor="";
var tb=document.getElementById('sksoska');
tb.disabled=true;
tzsto="";     
    }
                 }  
                 
 function hajdemo(){
 var hajdemoca=false;

   if(rr && rrsto!="")hajdemoca=confirm("Would you like to make attribute:"+rrsto+" irrelevant?");
   if(hajdemoca){
    rrstoo=true;
    document.getElementById('kokokllo').innerHTML="Select compensatory attribute!";
    return false;
   }
  
 } 
 
  function hajdemoo(){
 var hajdemoca=false;
 
    if(tz && tzsto!="")hajdemoca=confirm("Do you want to make a solution:"+tzsto+" dominated?");
     if(hajdemoca){
      rt=false;
      var tb=document.getElementById('sksoska');
tb.disabled=true;
     idi_sol(tzsto);
     }
   
 }
 
   function hajdemooaa(){
 var hajdemoca=false;
 
    hajdemoca=confirm("Do you want to go back on the choice / generate new problems?");
     if(hajdemoca){
document.location='xcoxco.php?dhujhduhuuu=e666e6etz&RrrrRrrrRkkokoRr=8rir9r8rir9r8r'; 
     }
   
 } 
 
 function idi_sol(aa){
  swapaj(aa,"ss_Ssssi8sd6djhgvsou566767ss__Ss_SS_ssshs800t678gsuiw");
  document.getElementById('kokokllo').innerHTML="Selection of dominated solutions!";
 }
 
 
 function idi_atrib(aa,xx){
 swapaj(aa,xx);
 document.getElementById('kokokllo').innerHTML="Selection of irrelevant attributes!";
 } 
 
 function swapaj(ea,ae){
console.log(ea+" "+ae); 
var paramString ="sdoekdq2q2="+ea+"&sdossqqssqqssqqp="+ae+" ";


new Ajax.Request('Clswssqqpp.php',
  {
    method:'post',
    onSuccess: function (rr){
    var res = rr.responseText.split("XXXX11YYYY11XXXX"); 
    $('jd7d6ebnsvxz6d64hgd').innerHTML=res[0];
    azur(res[1]);
    },
    parameters: paramString,
    onFailure: function(){
    alert("Problem sa ajaxom");
    return false;}
  });                  
                         } 
                         

function azur(kk){ 
kk=parseInt(kk,10); 
var trr="";
solnum2=kk;

for(var i=0;i<kk;i++)trr+="<a href='xcoxco.php?kskssk="+(i+1)+"'>"+(i+1)+" </a>&nbsp;&nbsp;&nbsp;&nbsp; " ;

$('dodwS_2_w').innerHTML=trr; 
 
 } 

                         
function hajaaa(){  

document.location='xcoxco.php?dhujhduhuuu=e666e6etz'; 
 
 }  
 


function trag(rrrrrr){  

$('dodwS_2_w').innerHTML=rrrrrr; 
 
 }                                                                                       
 </script>
</head >

<body <? if(isset($_GET['kskssk']))echo "OnLoad='trag(trrttrrt);'" ?> >
<div class="MainContent">

<div id="gore">
<form action="qjokoko.php" method="post"  id="formica" accept-charset="utf-8"> 

    <div align="center" id="jd7d6ebnsvxz6d64hgd" style=" margin-top:15px;padding-bottom:35px; padding-left:16px; font-size:24px;clear:both; font-weight:bolder; display:block;">   
    <table align="center" cellSpacing="2" cellPadding="2"  class="box"  >  
    <tr><td style="border:0px; color:white;padding-left:177px;"><p>&nbsp;xxxxx/p></td>
  <?
for($i=0;$i<count($solibi);$i++)echo"  <td OnClick=\"Dsd(this)\" class=\"kdod\">".$solibi[$i][1]."</td>";
?>
</tr>                                              
 <? 
 $ix=0; $pl=0;
 while($ix<$atribnum*$solnum){
if($pl==0){ echo"<tr OnClick=\"djk(this)\"> <td class=\"kdodd\">".$sol_atrib[$ix]['ATRIBIME']."</td>"; }
echo" <td class=\"tddd\">".number_format($sol_atrib[$ix]['iznos'],2)."</td>";
$ix++;
$pl++;
 if($pl==($solnum)){echo"</tr> "; $pl=0;}
}
  ?>                                                                                                                     
 
</table>
       </div> 

</div>



<div id="dolje">
<div align="center"  style="color:#398525;text-shadow: 2px 2px 4px #000000;line-height:24px;text-transform:uppercase;vertical-align:middle;font-size:40px;">
<?if(isset($_SESSION['prime']))echo $_SESSION['prime'];?>
</div>
   <div class="zalba" align="center" id="kokokllo"> </div> 
  <div align="center" style="margin-top:42px;margin-left:auto;margin-right:auto;" id="dodDSSwwS_2_w">
  <input type="button" value="Irrelevant attributes"  id="sksosk" OnClick="hajdemo();" disabled >&nbsp;&nbsp;&nbsp;     
  <input type="button" value="Dominance"  id="sksoska" OnClick="hajdemoo();" disabled >&nbsp;&nbsp;&nbsp;
  <input type="button" value="New problem"  id="sksoskaaa" OnClick="hajdemooaa();" >&nbsp;&nbsp;&nbsp;  
  <input type="button" value="Reset"  id="sksoska" OnClick="hajaaa();"  >
   </div>
   <div align="center" style="display:block; text-align:center;width:auto;margin-top:10px;padding-top:22px;" id="dodwS_2_w">
   </div>
 </form>

</div>
 
    <div class="copyras" align="center" >Even Swaps - 2015. </div> 
    <br> 

</div> 
</body>
</html>
<?