-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdelete_node.php
88 lines (75 loc) · 3.12 KB
/
delete_node.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
$node=$_GET['nodeID'];
$sessionID = $_GET['sessionID'];
$timestep = $_GET['timestep'];
$timestep2 = $timestep+1;
# echo $node;
include 'settings.php';
$link = mysqli_connect($dbHost,$dbUser,$dbPass, $dbName);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if(substr($_GET['nodeID'],0,4) == 'fact'){
//Do something
# echo "id is ".substr($_GET['nodeID'],4);
$sql="call copy_trust('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
# if( !$result )
# echo mysqli_error($link);
# mysqli_free_result($result);
$sql="call copy_beliefs('".$sessionID."',".$timestep.",".$timestep2.",".substr($_GET['nodeID'],4).",-1);";
# echo $sql;
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
/*
$sql="call copy_fact('".$sessionID."',".$timestep.",".$timestep2.",".substr($_GET['nodeID'],4).");";
// $sql="call copy_fact('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
// print_r($result);
# mysqli_free_result($result);
$sql="call copy_rules('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
*/
$sql="call copy_question('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
mysqli_close($link);
if(!array_key_exists('headless', $_GET)){
header( 'Location: index.php?sessionID='.$sessionID.'×tep='.$timestep2 );
}
}else if(substr($_GET['nodeID'],0,5) == 'agent'){
# echo "" .substr($_GET['nodeID'],5);
$sql="call copy_trust('".$sessionID."',".$timestep.",".$timestep2.",".substr($_GET['nodeID'],5).");";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
$sql="call copy_beliefs('".$sessionID."',".$timestep.",".$timestep2.",-1,".substr($_GET['nodeID'],5).");";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
$sql="call copy_question('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
mysqli_close($link);
if(!array_key_exists('headless', $_GET)){
header( 'Location: index.php?sessionID='.$sessionID.'×tep='.$timestep2 );
}
}else if(substr($_GET['nodeID'],0,4) == 'rule'){
# echo "" .substr($_GET['nodeID'],5);
$sql="call copy_trust('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
$sql="call copy_beliefs('".$sessionID."',".$timestep.",".$timestep2.",".substr($_GET['nodeID'],4).",-1);";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
$sql="call copy_question('".$sessionID."',".$timestep.",".$timestep2.",-1);";
$result=mysqli_query($link,$sql);
# mysqli_free_result($result);
mysqli_close($link);
if(!array_key_exists('headless', $_GET)){
header( 'Location: index.php?sessionID='.$sessionID.'×tep='.$timestep2 );
}
}else{
mysqli_close($link);
header( 'Location: index.php?sessionID='.$sessionID.'×tep='.$timestep );
}
?>