| 
<?php
include_once("config.inc.php");
 include_once(INCLUDE_PATH."cls_fast_template.php");
 include_once(INCLUDE_PATH."cls_string.php");
 session_start();
 $stringutil = new String("");
 $all_url_vars=array();
 $all_url_vars=$stringutil->parse_all();
 if($all_url_vars["action"]!= "add")
 {
 $ft = new FastTemplate(TEMPLATE_PATH);
 $ft->define(array("main"=>"template_body.html", "content"=>"template_generate.html"));
 $ft->parse("BODY", array("content","main"));
 print $ft->fetch("BODY");
 }
 else if ($all_url_vars["action"] == "add")
 {
 $ft = new FastTemplate(TEMPLATE_PATH);
 $ft->define(array("main"=>"template_body.html", "content"=>"template_generate.html"));
 $position=strpos($_SESSION['dbuffer'],";");
 $firstfield=substr($_SESSION['dbuffer'],0,$position);
 if($all_url_vars["fields"]!=$firstfield){
 $goodbuffer=$all_url_vars["fields"];
 $goodbuffer.=";";
 $tok=explode(";",$_SESSION['dbuffer']);
 $toknr=sizeof($tok);
 for($i=0;$i<$toknr;$i++)
 {
 if(!empty($tok[$i]))
 if($tok[$i]==$all_url_vars["fields"])
 {
 $goodbuffer.="";
 }
 else if($tok[$i]!=$all_url_vars["fields"])
 {
 $goodbuffer.=$tok[$i];
 $goodbuffer.=";";
 }
 
 }
 }
 else if($all_url_vars["fields"]==$firstfield)
 {
 $goodbuffer=$_SESSION['dbuffer'];
 }
 
 $_SESSION['dbfields']=$goodbuffer;
 $ft->assign("TABLE",$_SESSION['table']);
 $ft->assign("DBFIELDS",$goodbuffer);
 $tokexample=explode(";",$goodbuffer);
 $tokenr=sizeof($tokexample);
 $example="";
 for($i=0;$i<$tokenr-1;$i++)
 {
 $example.=ucwords($tokexample[$i]);
 $example.=";";
 }
 $ft->assign("EXAMPLE",$example);
 $ft->parse("BODY", array("content","main"));
 print $ft->fetch("BODY");
 }
 ?>
 |