PHP Classes
elePHPant
Icontem

File: Clswssqqpp.php

Recommend this page to a friend!
  Classes of Damir  >  PHP Even Swaps  >  Clswssqqpp.php  >  Download  
File: Clswssqqpp.php
Role: Example script
Content type: text/plain
Description: application logic
Class: PHP Even Swaps
Implement decision methods using Even Swaps
Author: By
Last change: New version
Date: 4 years ago
Size: 2,856 bytes
 

 

Contents

Class file image Download
<?php

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');
require_once(
'Clwsinc.php');

 
 
$projid=$_SESSION['prid'];
$jk= new DB();
if(isset(
$_POST['sdossqqssqqssqqp']) && $_POST['sdossqqssqqssqqp']=="ss_Ssssi8sd6djhgvsou566767ss__Ss_SS_ssshs800t678gsuiw")$varr="sol";
else
$varr="atrib";
$cnt_zad=count($_SESSION['dir_sit']);
$zadnji=$_SESSION['dir_sit'][$cnt_zad-1];

$polje=$zadnji->polje;
$brbud=$zadnji->broj;
$dojob= new doES();
            
                        
if(
$varr=="atrib"){

$atrib1=escapee($_POST['sdoekdq2q2']);
$atrib2=escapee($_POST['sdossqqssqqssqqp']);

$sel=" select distinct iznos from matrica, atribut a, atribut s where a.id=atribid1 and s.id=atribid2 and s.ime='".$atrib1."' and a.ime='".$atrib2."' ";
 
$skir=$jk->DBquery($sel);
      if (!
$skir){
      exit(
4);
      }
 
$atrib_iznos=$jk->DBres2arr1($skir);
 
$saES=new solatribES($polje, $atrib1, $atrib2, $atrib_iznos);
$new_sol_atrib=$saES->new_sol_atrib;
$new_sol_atribb=$saES->new_sol_atribb;

 
$dojob->sveodjednom( $new_sol_atrib, $new_sol_atribb, true, $atrib1);

$van=$dojob->mhoriz($new_sol_atribb);

 if(
count($van)>0){
 
    for(
$i=0;$i<count($van);$i++){
   
$tmparr=$new_sol_atribb;
   
array_splice($new_sol_atribb, $van[$i], 1);
   
$dojob->sveodjednom($tmparr, $new_sol_atribb, true, $tmparr[$van[$i]][0]['ATRIBIME']);
   
            for(
$iq=0;$iq<count($van);$iq++)
       
$van[$iq]-=1;
    }
 }
 
 
$rearr=array();

foreach(
$new_sol_atribb as $kar2=>$var2)
  foreach(
$var2 as $kar1=>$var1)
                  
$rearr[]=$var1;
                  
 
$polje1=new Baza($rearr, ++$brbud, $new_sol_atribb);
$_SESSION['dir_sit'][]=$polje1;

echo
"XXXX11YYYY11XXXX".$brbud;
//
}
else if(
$varr="sol"){


$sol=escapee($_POST['sdoekdq2q2']);

$kso=$dojob->sol_raspored($polje, $sol, true);

$dojob->sveodjednom($dojob->sol_raspored($polje, $sol, false),$kso, false);

$van=$dojob->mhoriz($kso);

 if(
count($van)>0){
 
    for(
$i=0;$i<count($van);$i++){
   
$tmparr=$kso;
   
array_splice($kso, $van[$i], 1);
   
$dojob->sveodjednom($tmparr, $kso, true, $tmparr[$van[$i]][0]['ATRIBIME']);

   
        for(
$iq=0;$iq<count($van);$iq++){
       
$van[$iq]-=1;
        }
    }
 }
 
$rearr=array();
foreach(
$kso as $kar2=>$var2)
  foreach(
$var2 as $kar1=>$var1)
                  
$rearr[]=$var1;
                  
 
$polje1=new Baza($rearr, ++$brbud, $kso );

$_SESSION['dir_sit'][]= $polje1;

echo
"XXXX11YYYY11XXXX".$brbud;
}
 
  
  



?>