\n");
$vect[$k][0]=$input['key'];
$vect[$k][1]=$input['value'];
$k=$k+1;
}
$select_color='select * from IA_color';
$list_color=mysql_query($select_color);
$i=0;
while($row_color=mysql_fetch_array($list_color)){
$color3[$i]=$row_color[color3];
$i=$i+1;
}
if($Submit1!=''){
header("Location: http://".$rep."new_an.php?id_session=".$id_session."");
}
elseif($Submit3!=''){
header("Location: http://".$rep."exit.php?id_session=".$id_session."");
}
elseif($Submit2!=''){
header("Location: http://".$rep."issue2.php?id_session=".$id_session."");
}
elseif($Submit4!=''){
header("Location: http://".$rep."issue4.php?id_session=".$id_session."");
}
elseif($Submit5!=''){
header("Location: http://".$rep."issue3.php?id_session=".$id_session."");
//}elseif($Submit4!=''){
}
else{
//$select_top='select * from IA_result_nodes where ID_session="'.$id_session.'" and couleur!="'.$color3[0].'" ';
$select_top='select * from IA_result_nodes where ID_session="'.$id_session.'"';
//echo $select_top;
$sel_top=mysql_query($select_top);
//$idico=mysql_num_rows($sel_top);
$select_link='select IA_result_nodes.couleur as couleur1,IA_result_nodes.URL_site as URL_site1,IA_result_nodes.label as label1,IA_result_link.ID_site1,IA_result_link.ID_site2, IA_result_nodes1.label as label2,IA_result_nodes1.URL_site as URL_site2, IA_result_nodes1.couleur as couleur2 from (IA_result_nodes inner join IA_result_link on IA_result_nodes.ID_site=IA_result_link.ID_site1) inner join IA_result_nodes as IA_result_nodes1 on IA_result_link.ID_site2=IA_result_nodes1.ID_site where IA_result_nodes.ID_session="'.$id_session.'" group by IA_result_nodes.label, IA_result_nodes1.label';
//echo $select_link;
$list_result_link=mysql_query($select_link);
$j=1;
while($row_link=mysql_fetch_array($list_result_link)){
$link_out_in[$j]=$row_link[label1].';'.$row_link[label2];
$link_out_in_inv[$j]=$row_link[label2].';'.$row_link[label1];
$j=$j+1;
}
//echo '
INV
';
//print_r($link_out_in_inv);
$link_out_in_merge=array_merge($link_out_in,$link_out_in_inv);
//echo '
MERGE
';
//print_r($link_out_in_merge);
$link_out_in_unique=array_unique($link_out_in_merge);
//echo '
UNIQUE
';
//print_r($link_out_in_unique);
reset($link_out_in_unique);
$i=1;
$delete_reseaulu_link='delete from IA_reseaulu_link where ID_session="'.$id_session.'" ';
$del_reseaulu_link=mysql_query($delete_reseaulu_link);
while(list($key,$link_out_in_uniqueT)=each($link_out_in_unique)){
$link_out_in_new[$i]=split(';',$link_out_in_unique[$key]);
if($link_out_in_new[$i][0]!=''){
if($link_out_in_new[$i][1]!=''){
$insert_reseaulu_link='insert IA_reseaulu_link set label1="'.$link_out_in_new[$i][0].'", label2="'.$link_out_in_new[$i][1].'" , ID_session="'.$id_session.'" ';
//echo $insert_reseaulu_link; echo '
';
$ins_result_link=mysql_query($insert_reseaulu_link);
$link_out_in_new_0[$i]=$link_out_in_new[$i][0];
$i=$i+1;
}//end if label2
}//end if label1
}
//echo '
NEW
';
//print_r($link_out_in_new_0);
$link_out_in_freq=array_count_values($link_out_in_new_0);
arsort($link_out_in_freq);
//echo '
FREQ
';
//print_r($link_out_in_freq);
$select_type_size='select * from IA_options where ID_session="'.$id_session.'"';
$sel_type_size=mysql_query($select_type_size);
$row_type_size=mysql_fetch_array($sel_type_size);
if ($row_type_size[sizeby_inlinks ]=='checked'){
//TAIILE PAR INLINKS
$select_inl='select IA_data.URL_site, IA_data.ID_site, IA_data.inlinks, IA_result_nodes.label from IA_data INNER JOIN IA_result_nodes on IA_data.URL_site=IA_result_nodes.URL_site where IA_data.ID_session="'.$id_session.'" group by IA_result_nodes.label order by IA_data.inlinks desc';
// Added by Koen Martens, kmartens@sonologic.nl
$sel_inl=mysql_query($select_inl);
$maxInLinkCount=-1;
while($row_inl=mysql_fetch_array($sel_inl)) {
$j=$row_inl['ID_site'];
$inLinkCount[$j]=countOutlinks($j,$id_session)+countInlinks($j,$id_session);
if($inLinkCount[$j]>$maxInLinkCount) $maxInLinkCount=$inLinkCount[$j];
}
mysql_free_result($sel_inl);
// End added by Koen Martens
$select_inl='select IA_data.URL_site, IA_data.ID_site, IA_data.inlinks, IA_result_nodes.label from IA_data INNER JOIN IA_result_nodes on IA_data.URL_site=IA_result_nodes.URL_site where IA_data.ID_session="'.$id_session.'" group by IA_result_nodes.label order by IA_data.inlinks desc';
$sel_inl=mysql_query($select_inl);
$delete_res='delete from IA_result where ID_session="'.$id_session.'"';
$del_res=mysql_query( $delete_res);
//echo $select_inl;
$row_inl=mysql_fetch_array($sel_inl);
// Changed by Koen Martens
// $taille_max=$row_inl[inlinks];
$taille_max=$maxInLinkCount;
// $razmer=30*(sqrt($row_inl[inlinks]/$taille_max));
$razmer=30*(sqrt($inLinkCount[$row_inl['ID_site']]/$taille_max));
// End of changes by Koen Martens
if($razmer<7){
$razmer=7;
}
$insert_res='insert into IA_result set ID_session="'.$id_session.'", ID_site_new=1, label="'.$row_inl[label].'", taille="'.$razmer.'"';
$ins_res=mysql_query($insert_res);
$j=2;
while($row_inl=mysql_fetch_array($sel_inl)){
// Changed by Koen Martens
// $razmer=30*(sqrt($row_inl[inlinks]/$taille_max));
$razmer=30*(sqrt($inLinkCount[$row_inl['ID_site']]/$taille_max));
// End of changes by Koen Martens
if($razmer<7){
$razmer=7;
}
$insert_res='insert into IA_result set ID_session="'.$id_session.'", ID_site_new='.$j.', label="'.$row_inl[label].'", taille="'.$razmer.'"';
$ins_res=mysql_query($insert_res);
$j=$j+1;
}//end while
}
elseif($row_type_size[sizeby_centrality] =='checked'){
//$select_inl='select IA_data.URL_site, IA_data.inlinks, IA_result_nodes.label from IA_data INNER JOIN IA_result_nodes on IA_data.URL_site=IA_result_nodes.URL_site where IA_data.ID_session="'.$id_session.'" group by IA_result_nodes.label order by IA_data.inlinks desc';
//$sel_inl=mysql_query($select_inl);
$delete_res='delete from IA_result where ID_session="'.$id_session.'"';
$del_res=mysql_query( $delete_res);
//TAILLE PAR CENTRALITY
$i=1;
reset($link_out_in_freq);
while(list($key,$link_out_in_freqTT)=each($link_out_in_freq)){
if($i==1){
$taille_max=$link_out_in_freq[$key];
}
//$razmer=$link_out_in_freq[$key]*100/($taille_max);
$razmer=20*(sqrt($link_out_in_freq[$key]/$taille_max));
//echo 'RAZMER'; echo $razmer;
if($razmer<7){
$razmer=7;
}
$insert_res='insert into IA_result set ID_session="'.$id_session.'", ID_site_new='.$i.', label="'.$key.'", taille="'.$razmer.'"';
//echo $insert_res; echo '
';
$ins_res=mysql_query($insert_res);
$i=$i+1;
}
}//end if sizeby
//retrouver la couleur dans le tableau IA_result_nodes
$select_couleur='select * from IA_result_nodes where ID_session="'.$id_session.'"';
//echo $select_couleur;
$list_couleur=mysql_query($select_couleur);
while($row_couleur=mysql_fetch_array($list_couleur)){
$update_couleur_res='update IA_result set couleur="'.$row_couleur[couleur].'", URL_site="'.$row_couleur[URL_site].'" where ID_session="'.$id_session.'" and label="'.$row_couleur[label].'"';
//echo $update_couleur_res;
$upd_couleur=mysql_query($update_couleur_res);
}
$select_URL_page='select IA_data.URL_page, IA_data.URL_site, IA_result.URL_site, IA_result.label from IA_data inner join IA_result on IA_data.URL_site=IA_result.URL_site where IA_result.ID_session="'.$id_session.'" group by IA_result.label';
$list_URL_page=mysql_query($select_URL_page);
while($row_URL_page=mysql_fetch_array($list_URL_page)){
$update_URL_page='update IA_result set URL_page="'.$row_URL_page[URL_page].'" where ID_session="'.$id_session.'" and label="'.$row_URL_page[label].'"';
//echo $update_URL_page;
$upd_URL_page=mysql_query($update_URL_page);
}
//retrouver les id_new pour les link result
$select_id_new='select * from IA_result where ID_session="'.$id_session.'"';
$sel_id_new=mysql_query($select_id_new);
$idico=mysql_num_rows($sel_id_new);
while($row_id=mysql_fetch_array($sel_id_new)){
//$update_id1_link='update IA_reseaulu_link set ID_new_site1="'.$row_id[ID_site_new].'" ,couleur1="'.$row_id[couleur1].'" where ID_session="'.$id_session.'" and label1="'.$row_id[label].'"';
$update_id1_link='update IA_reseaulu_link set ID_new_site1="'.$row_id[ID_site_new].'" ,couleur1="'.$row_id[couleur].'" where ID_session="'.$id_session.'" and label1="'.$row_id[label].'"';
//echo $update_id1_link;
$upd_id1_link=mysql_query($update_id1_link);
$update_id2_link='update IA_reseaulu_link set ID_new_site2="'.$row_id[ID_site_new].'", couleur2="'.$row_id[couleur].'" where ID_session="'.$id_session.'" and label2="'.$row_id[label].'"';
$upd_id2_link=mysql_query($update_id2_link);
}
//echo $idico;
//$matrix_li=array_fill(1,$idico,0);
//$matrix=array_fill(1,$idico,$matrix_li);
for($i=1;$i<=$idico;$i++){
for ($j=1;$j<=$idico;$j++){
$matrix[$i][$j]=0;
}
}
//echo 'matrix';
$select_result_link='select * from IA_reseaulu_link where ID_session="'.$id_session.'"';
$list_result_link=mysql_query($select_result_link);
while($row_result_link=mysql_fetch_array($list_result_link)){
$matrix[$row_result_link[ID_new_site1]][$row_result_link[ID_new_site2]]=1;
}//end while
$matrix_nex=ReseauluSimple($matrix,$idico);
//print_r($X);
//print_r($Y);
$i=0;
while(list($key,$XT)=each($X)){
$updateXY='update IA_result set X='.$X[$key].', Y='.$Y[$key].' where ID_session="'.$id_session.'" and ID_site_new="'.$key.'"';
//echo $updateXY;
$updXY=mysql_query($updateXY);
//inscrire les coordonn�es dans le tableau RESULT_LINK
$update_link1='update IA_reseaulu_link set X1='.$X[$key].', Y1='.$Y[$key].' where ID_session="'.$id_session.'" and ID_new_site1='.$key.'';
//echo $update_link1; echo '
';
$upd_link1=mysql_query($update_link1);
$update_link2='update IA_reseaulu_link set X2='.$X[$key].', Y2='.$Y[$key].' where ID_session="'.$id_session.'" and ID_new_site2='.$key.'';
$upd_link2=mysql_query($update_link2);
$i=$i+1;
}//end while
//--------------------------------------------------------
//verify if the temporarely data it's still available
//
$check_data = mysql_query("select * from IA_result_nodes");
if(mysql_num_rows($check_data) == 0){
header("Location: ../index.php");
}
//
//--------------------------------------------------------
//header("Location: issue6.php?id_session=".$id_session);
echo '';
echo '