id] = $cond->friendlyname; } $ret = "IF "; $conds = explode(";",$str); $conds = array_slice($conds, 0, count($conds)-1); foreach($conds as $cond) { $tk = explode(",",$cond); if(count($tk) > 3) { for($i = 0; $i < intval($tk[0]); $i++) $ret .= "("; if($tk[1] == "1") $ret .= "not "; $ret .= "". $condtypes[intval($tk[2])] ." ". $tk[3]; for($i = 0; $i < intval($tk[4]); $i++) $ret .= ")"; $ret .= " "; } else { if($tk[0] == 0) $ret .= "AND "; else if($tk[0] == 1) $ret .= "OR "; } } $ret .= "THEN ". strtolower($resptype) .""; return $ret; } if($_GET['del']) { mysql_query("DELETE FROM `responses` WHERE `id`=".$_GET['del']); header("Location: resp.php"); } if($_POST["editId"]) { $c = ""; for($i=1;;$i++) { if(!isset($_POST["if". $i ."param"])) break; $c .= $_POST['if'.$i.'lpar'].",".$_POST['if'.$i.'not'].",".$_POST['if'.$i.'cond'].",".$_POST['if'.$i.'param'].",".$_POST['if'.$i.'rpar'].";"; if(isset($_POST["op".$i])) $c .= $_POST["op".$i] .";"; } mysql_query("UPDATE `responses` SET `conditions`='". mysql_real_escape_string($c) ."', `respid`=". $_POST['resptype'] .", `parameters`='". mysql_real_escape_string($_POST['parameters']) ."', `cooldown`=". (($_POST['cdd']==0)?-1:$_POST['cooldown']) ." WHERE `id`=". $_POST['editId']) or die(mysql_error()); header("Location: resp.php"); } if($_POST["resptype"] && !$_POST["editId"]) { $c = ""; for($i=1;;$i++) { if(!isset($_POST["if". $i ."param"])) break; $c .= $_POST['if'.$i.'lpar'].",".$_POST['if'.$i.'not'].",".$_POST['if'.$i.'cond'].",".$_POST['if'.$i.'param'].",".$_POST['if'.$i.'rpar'].";"; if(isset($_POST["op".$i])) $c .= $_POST["op".$i] .";"; } mysql_query("INSERT INTO `responses` (`conditions`,`respid`,`parameters`,`cooldown`) VALUES ('". mysql_real_escape_string($c) ."',". $_POST['resptype'] .",'". mysql_real_escape_string($_POST['parameters']) ."',". (($_POST['ccd']==0)?-1:$_POST['cooldown']) .")") or die(mysql_error()); header("Location: resp.php"); } include("header.php"); ?>
Response List

New Response

  ". parseConditionString($resp->conditions, mysql_fetch_object(mysql_query("SELECT * FROM `resptypes` WHERE `id`=". $resp->respid))->friendlyname) ." "; } ?>
Create New Response

If Add Condition

then ". $desc ."

"; $i++; } ?>

Parameters:

Cooldown: seconds

    

Edit Response

If conditions; $conds = explode(";",$conds); $conds = array_slice($conds, 0, count($conds)-1); $on = 1; foreach($conds as $cond) { $tk = explode(",",$cond); if(count($tk) > 3) { ?> Add Condition

then ". $desc ."

"; $i++; } ?>

respid))->description; ?> Parameters:

Cooldown: cooldown == -1) { ?> disabled="disabled" /> seconds