//=====================Ini part for each page======================//
ob_start();
session_start();
//-------------------------------
//---------include head----------
//-------------------------------
$_SESSION['click_menu'] = 3;
if(!isset($_SESSION['click_menu'])){
$num = 0;
}
else{
$num =$_SESSION['click_menu'];
}
$box = "#ac-".$num;
include("../head.php");
$name = "Jet Processor Modify Tables";
echo "
";
$_SESSION['Dt_name']="ModifyJPRTables";
//start the document
//---------------------Includes-----------------------------------------------//
require_once("../php_PPr/connect_mysql.php");
require_once("../php_common/common_functions.inc");
$Table = get_request('table','A-Za-z0-9');
$table = get_request('table','A-Za-z0-9');
if($action=="submit"){
$col = array();
$col = get_fields_from_table($table);
$field_string ="";
for ($i=0; $i
alert('Please enter a Name.'); window.back();");
}
if($typecol == "--Type--"){
die("");
}
$safename = preg_replace('/[^a-zA-Z0-9]/i', '', $namecol);
$safetable= preg_replace('/[^a-zA-Z0-9]/i', '', $table);
//echo "safename: $safename";
$fields = get_fields_from_table($safetable);
$after = $fields[sizeof($fields)-4]; //before comment
$query="ALTER TABLE PPrDB_Development.$safetable ADD `".$safename."` ".$typecol." NULL AFTER `".$after."` ";
$result=mysql_call($query);
$safehistory =$safetable."Newhistory";
$query="ALTER TABLE PPrDB_Development.$safehistory ADD `".$safename."` ".$typecol." NULL AFTER `".$after."` ";
$result=mysql_call($query);
header("Location: modify_page.php?table=$table");
}
else{
show_menu_ROD();
display_table();
add_field_menu();
}
function show_menu_ROD(){
echo "
";
//echo "
Change your password
";
echo "
";
echo "
";
}
function display_table(){
$table = get_table();
//echo "t: $table";
echo "
";
//echo "
Change your password
";
echo "
";
echo "
";
}
function add_field_menu(){
$table=get_table();
echo "
";
//echo "
Change your password
";
echo "
";
echo "
";
}
function get_fields_only(){
$table = get_table();
$columns = mysql_query("SHOW COLUMNS from $table") or die ("Could not get COLUMNS");
$numcolumns = mysql_num_rows($columns);
$x = 0;
while( $x < $numcolumns){
$colname = mysql_fetch_row($columns);
$col[$x] = $colname[0];
$x++;
}
return $col;
}
function get_fields_from_table($table){
$columns = mysql_query("SHOW COLUMNS from $table") or die ("Could not get COLUMNS2");
$numcolumns = mysql_num_rows($columns);
$x = 0;
while( $x < $numcolumns){
$colname = mysql_fetch_row($columns);
$col[$x] = $colname[0];
$x++;
}
return $col;
}
function get_fields(){
$table = get_table();
$columns = mysql_query("SHOW COLUMNS from $table") or die ("Could not get COLUMNS");
$numcolumns = mysql_num_rows($columns);
$x = 0;
while( $x < $numcolumns){
$colname = mysql_fetch_row($columns);
$col[$x] = $colname[0];
$x++;
}
for ($i=0; $i $col[$i]
";
}
else{
echo " $col[$i]
";
}
}
else{
if($val == "Log File" || $val == "Root File" || $val == "Document"){
echo " $col[$i]
";
}
else{
echo " $col[$i]
";
}
}
}
}
function get_table(){
$action = get_request('table','A-Za-z0-9');
//echo "a: $action";
if ($action == "JEMCrate"){$table = "JEMCrate";}
elseif ($action == "JEMPSU"){$table = "JEMPSU";}
elseif ($action == "JEModule"){$table = "JEModule";}
elseif ($action == "JEMInput"){$table = "JEMInput";}
elseif ($action == "JEMControl"){$table = "JEMControl";}
elseif ($action == "JEMGlink"){$table = "JEMGlink";}
else{ $table = "JEMCrate";}//default
return $table;
}
echo "