!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/home/mnnews/public_html/poll/admin/   drwxr-xr-x
Free 3.41 GB of 27.03 GB (12.62%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     setup.php (18.92 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

function setup_check_dbtables() {
  global
$s_dbid, $s_dbname;

  
$tb[0] = "sympoll_data";
  
$tb_act[0] = @mysql_list_fields($s_dbname, "sympoll_data", $s_dbid);
  
$tb_col[0] = array("pid", "cid", "choice", "votes");
  
$tb_len[0] = array(0, 0, 250, 0);
  
$tb_flg[0] = array("multiple_key", "", "", "");

  
$tb[1] = "sympoll_list";
  
$tb_act[1] = @mysql_list_fields($s_dbname, "sympoll_list", $s_dbid);
  
$tb_col[1] = array("pid", "identifier", "nextcid", "question", "timeStamp", "status");
  
$tb_len[1] = array(0, 50, 0, 250, 0, 0);
  
$tb_flg[1] = array("primary_key", "", "", "", "", "");

  
$tb[2] = "sympoll_auth";
  
$tb_act[2] = @mysql_list_fields($s_dbname, "sympoll_auth", $s_dbid);
  
$tb_col[2] = array("uid", "user", "pass", "access", "secret");
  
$tb_len[2] = array(0, 32, 32, 0, 32);
  
$tb_flg[2] = array("primary_key", "", "", "", "");

  
$tb[3] = "sympoll_iplog";
  
$tb_act[3] = @mysql_list_fields($s_dbname, "sympoll_iplog", $s_dbid);
  
$tb_col[3] = array("ip", "pid", "voted");
  
$tb_len[3] = array(15, 0, 0);
  
$tb_flg[3] = array("primary_key", "primary_key", "");

  while(
is_array($tb) && list($k,$v) = each($tb)) {
    if(!
$tb_act[$k]) {
      
$tbc[$k] = $v;
      continue;
    }

    
$col = $tb_col[$k];   
    
$len = $tb_len[$k];   
    
$flg = $tb_flg[$k];   
    
$act_col = array();
    
$act_len = array();
    
$act_flg = array();
    for(
$dsr = 0; $dsr < mysql_num_fields($tb_act[$k]); $dsr++) {
      
$act_col[$dsr] = mysql_field_name($tb_act[$k], $dsr);
      
$act_len[$dsr] = mysql_field_len($tb_act[$k], $dsr);
      
$act_flg[$dsr] = mysql_field_flags($tb_act[$k], $dsr);
    }
    if(
sizeof($act_col) != sizeof($col)) {
      
$tbu[$k] = $v;
      continue;
    }

    for(
$dsr = 0; $dsr < sizeof($col); $dsr++) {
      
$index = -1;
      while(
is_array($act_col) && list($k2,$v2) = each($act_col)) {
        if(
strcmp($v2, $col[$dsr]) == 0) {
          
$index = $k2;
          break;
        }
      }
reset($act_col);
      if(
$index == -1 ||
          (
$len[$dsr] != 0 && $len[$dsr] != $act_len[$index]) ||
          (
$flg[$dsr] != "" && !eregi($flg[$dsr], $act_flg[$index])) ) {
        
$tbu[$k] = $v;
        continue
2;
      }
    }
  }
  if(isset(
$tbc) && is_array($tbc) && sizeof($tbc) > 0) {
    global
$action, $tbc_string;
    if(
$action == 'setup_p_dbtables') {
      
setup_process_dbtables($tbc_string);
    } else {
      
setup_display_dbtables($tbc);
    }
  } else if(isset(
$tbu) && is_array($tbu) && sizeof($tbu) > 0) {
    global
$action, $gen;
    if(
$action == 'upgrade_p_dbtables') {
      
upgrade_process_dbtables(intval($gen));
    } else {
      
upgrade_display_dbtables($tbu);
    }
  }

  
# check if superadmin exists
  
$q1 = "SELECT uid FROM sympoll_auth WHERE access='0'";
  
$r1 = mysql_query($q1, $s_dbid);
  if(
mysql_numrows($r1) <= 0) {
    
display_adduser(TRUE);
  }
}


function
setup_display_config() {
  global
$g_message, $SYMP_URL, $ext;
  global
$ndbhost, $ndbuser, $ndbname, $ndirurl;

  if(!isset(
$ndbhost) || $ndbhost == "")
    {
$ndbhost = "localhost"; }
  if(!isset(
$ndbname) || $ndbname == "")
    {
$ndbname = "sympoll"; }
  if(!isset(
$ndirurl) || $ndirurl == "") {
    if(isset(
$SYMP_URL) && $SYMP_URL != "") {
      
$urlarr = parse_url($SYMP_URL);
      if(isset(
$urlarr['path']) && $urlarr['path'] != "") {
        
$foo = substr($urlarr['path'], 0, strrpos($urlarr['path'], "/"));
        
$foo = substr($foo, 0, strrpos($foo, "/") + 1);
      } else  {
        
$foo = "/";
      }
      
$ndirurl = "$urlarr[scheme]"."://"."$urlarr[host]"."$foo";
    } else {
      
$ndirurl = "http://";
    }
  }
  if(
ereg("[^/]$", $ndirurl))
    {
$ndirurl = "$ndirurl"."/"; }

  
$ndbhost = htmlspecialchars($ndbhost);
  
$ndbuser = htmlspecialchars($ndbuser);
  
$ndbname = htmlspecialchars($ndbname);
  
$ndirurl = htmlspecialchars($ndirurl);

  
spit_header(FALSE); ?>
  <DIV ALIGN="center"><FONT SIZE="6" COLOR="#000066">
  <B>Sympoll Setup</B></FONT><BR>
  <FONT SIZE="5" COLOR="#000066">Configuration</FONT>
  <HR SIZE="1" WIDTH="50%"><BR></DIV>
  <FORM ACTION="index.<?php echo $ext; ?>" METHOD="post">
  <INPUT TYPE="hidden" NAME="action" VALUE="setup_p_config">
  <TABLE BORDER="0" ALIGN="center">

  <TR><TD COLSPAN="2">
  This information is required to continue and
  the database connection must be currently active.
  Some default values are provided, although you may need to change them.<BR><BR>
  <?php if(isset($g_message) && $g_message != "") {
    echo
"<BR><I><BIG>"."$g_message"."</I></BIG><BR>";
  }
?>
  <BR></TD></TR>

  <TR><TD COLSPAN="2"><B>Database Connection Information</B><BR><BR></TD></TR>
  <TR><TD>Database Server:&nbsp;</TD><TD>
  <INPUT TYPE="text" MAXLENGTH="50" SIZE="20" NAME="ndbhost" VALUE="<?php echo $ndbhost ?>">
  </TD></TR><TR><TD>Database Username:&nbsp;</TD><TD>
  <INPUT TYPE="text" MAXLENGTH="50" SIZE="20" NAME="ndbuser" VALUE="<?php echo $ndbuser ?>">
  </TD></TR><TR><TD>Database Password:&nbsp;</TD><TD>
  <INPUT TYPE="password" MAXLENGTH="50" SIZE="20" NAME="ndbpass1">
  </TD></TR><TR><TD>Database Password (verify):&nbsp;</TD><TD>
  <INPUT TYPE="password" MAXLENGTH="50" SIZE="20" NAME="ndbpass2">
  </TD></TR><TR><TD>Database:&nbsp;</TD><TD>
  <INPUT TYPE="text" MAXLENGTH="50" SIZE="20" NAME="ndbname" VALUE="<?php echo $ndbname ?>">
  </TD></TR><TR><TD COLSPAN="2"><BR><BR><B>Full URL to your Sympoll directory</B><BR><BR>
  </TD></TR><TR><TD>Sympoll URL:</TD><TD>
  <INPUT TYPE="text" MAXLENGTH="80" SIZE="40" NAME="ndirurl" VALUE="<?php echo $ndirurl ?>">
  </TD></TR><TR><TD COLSPAN="2">
  <BR><BR><INPUT TYPE="submit" VALUE="Save">
  <INPUT TYPE="reset" VALUE="Undo Changes">
  </TD></TR></TABLE></FORM>
  <?php spit_footer(FALSE);
}


function
setup_process_config() {
  global
$ndbhost, $ndbuser, $ndbpass1, $ndbpass2, $ndbname, $ndirurl;
  global
$s_dbhost, $s_dbuser, $s_dbpass, $s_dbname, $s_dirurl;
  global
$s_tx, $s_bg, $s_bord, $s_iplog, $s_cookielog;
  global
$s_qtx, $s_qbg, $s_optsize, $s_txtsize, $s_txtface;
  global
$s_width, $s_barimg, $s_barhite, $s_maxopts;
  global
$s_blength, $s_refer, $s_polllist, $s_resultnums, $s_showtotal;
  global
$g_message, $ext;

  
$error = "Setup Failed: ";
  if(
$ndbhost == "" || ereg("[\"']", $ndbhost)) {
    
$g_message = "$error"."invalid database server";
    
setup_display_config();
  }
  if(
$ndbuser == "" || ereg("[\"']", $ndbuser)) {
    
$g_message = "$error"."invalid database username";
    
setup_display_config();
  }
  if(
ereg("[\"']", $ndbpass1)) {
    
$g_message = "$error"."invalid database password";
    
setup_display_config();
  }
  if(
strcmp($ndbpass1, $ndbpass2) != 0) {
    
$g_message = "$error"."database passwords do not match";
    
setup_display_config();
  }
  if(
$ndbname == "" || ereg("[\"']", $ndbname)) {
    
$g_message = "$error"."invalid database";
    
setup_display_config();
  }
  if(
$ndirurl == "" || ereg("[\"']",$ndirurl)) {
    
$g_message = "$error"."invalid sympoll url";
    
setup_display_config();
  }

  
$link = @mysql_connect($ndbhost,$ndbuser,$ndbpass1);
  if(!
$link) {
    
$g_message = "$error"."unable to connect to specified server";
    
setup_display_config();
  }
  if(!@
mysql_select_db($ndbname, $link)) {
    @
mysql_close($link);
    
$g_message = "$error"."connected but unable to access <U>"."$ndbname"."</U>";
    
setup_display_config();
  }
  @
mysql_close($link);

  
$s_dbhost = $ndbhost;
  
$s_dbuser = $ndbuser;
  
$s_dbpass = $ndbpass1;
  
$s_dbname = $ndbname;
  
$s_dirurl = $ndirurl;
  
$s_tx = 'white';
  
$s_bg = 'darkblue';
  
$s_bord = 'darkblue';
  
$s_qtx = 'white';
  
$s_qbg = 'black';
  
$s_optsize = '1';
  
$s_txtsize = '2';
  
$s_txtface = 'Verdana,Geneva,Georgia,Arial';
  
$s_width = '150';
  
$s_barimg = 'images/blue.jpg';
  
$s_barhite = '12';
  
$s_maxopts = '15';
  
$s_blength = '180';
  
$s_iplog = '0';
  
$s_cookielog = '1';
  
$s_polllist = '1';
  
$s_resultnums = '1';
  
$s_showtotal = '1';
  
$s_refer = '1';

  if(
config_write() == FALSE) {
    
$g_message = "$error"."$g_message";
    
setup_display_config();
  }

  
spit_header(FALSE); ?>
  <DIV ALIGN="center"><FONT SIZE="6" COLOR="#000066">
  <B>Sympoll Setup</B></FONT><BR>
  <FONT SIZE="5" COLOR="#000066">Configuration</FONT>
  <HR SIZE="1" WIDTH="50%"><BR>
  <BR><BR><BR>Primary Configuration Complete!
  <FONT SIZE="+1"><A HREF="index.<?php echo $ext; ?>">Continue</A>
  </FONT></DIV>
  <?php spit_footer(FALSE);
}


function
setup_display_dbtables($tbc) {
  global
$ext;

  
spit_header(FALSE); ?>
  <DIV ALIGN="center"><FONT SIZE="6" COLOR="#000066">
  <B>Sympoll Setup</B></FONT><BR>
  <FONT SIZE="5" COLOR="#000066">Database Tables</FONT>
  <HR SIZE="1" WIDTH="50%"><BR></DIV>
  <FORM ACTION="index.<?php echo $ext; ?>" METHOD="post">
  <INPUT TYPE="hidden" NAME="action" VALUE="setup_p_dbtables">

  <TABLE ALIGN="center" WIDTH="80%"><TR><TD>
  It appears that you need to install one or more MySQL tables that Sympoll
  will use to store its data.  In order for Sympoll to install and
  operate properly, your MySQL user must have at least these privileges:
  <TT>SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP</TT>
  <BR><BR><BR>
  The following tables must be created: <UL>
  <?php while(is_array($tbc) && list($k,$v) = each($tbc)) {
    echo
"<LI>"."$v"."</LI>";
    if(isset(
$once) && $once != "") {
      
$tbc_string = "$tbc_string".";"."$v";
    } else {
      
$tbc_string = "$v";
    }
    
$once = TRUE;
  }
?>
  </UL>
  <INPUT TYPE="hidden" NAME="tbc_string" VALUE="<?php echo $tbc_string; ?>">
  <INPUT TYPE="submit" VALUE="Create Tables"><BR>
  </TD></TR></TABLE></FORM>
  <?php spit_footer(FALSE);
}


function
setup_process_dbtables($tbc_string) {
  global
$ext, $s_dbid;

  
spit_header(FALSE); ?>
  <DIV ALIGN="center"><FONT SIZE="6" COLOR="#000066">
  <B>Sympoll Setup</B></FONT><BR>
  <FONT SIZE="5" COLOR="#000066">Database Tables</FONT>
  <HR SIZE="1" WIDTH="50%"><BR></DIV>
  <FONT FACE="Geneva, Georgia, Verdana">

  <?php $boohoo = 0;
  if(
ereg("sympoll_data", $tbc_string)) {
    
$db[$boohoo] = "sympoll_data";
    
$q[$boohoo]  = "CREATE TABLE $db[$boohoo] (pid INT NOT NULL, ";
    
$q[$boohoo] .= "cid INT NOT NULL, choice VARCHAR(250) NOT NULL, ";
    
$q[$boohoo] .= "votes INT DEFAULT '0' NOT NULL, INDEX(pid))";
    
$boohoo++;
  }
  if(
ereg("sympoll_list", $tbc_string)) {
    
$db[$boohoo] = "sympoll_list";
    
$q[$boohoo]  = "CREATE TABLE $db[$boohoo] (pid INT NOT NULL AUTO_INCREMENT, ";
    
$q[$boohoo] .= "identifier VARCHAR(50) NOT NULL, nextcid INT UNSIGNED ";
    
$q[$boohoo] .= "DEFAULT '0' NOT NULL, question VARCHAR(250) NOT NULL, ";
    
$q[$boohoo] .= "timeStamp INT NOT NULL, status INT DEFAULT '0' NOT NULL, ";
    
$q[$boohoo] .= "PRIMARY KEY (pid))";
    
$boohoo++;
  }
  if(
ereg("sympoll_auth", $tbc_string)) {
    
$db[$boohoo] = "sympoll_auth";
    
$q[$boohoo]  = "CREATE TABLE $db[$boohoo] (uid INT NOT NULL AUTO_INCREMENT, ";
    
$q[$boohoo] .= "user VARCHAR(32) DEFAULT '' NOT NULL, pass VARCHAR(32) ";
    
$q[$boohoo] .= "DEFAULT '' NOT NULL, access INT UNSIGNED DEFAULT '1', ";
    
$q[$boohoo] .= "secret VARCHAR(32), PRIMARY KEY (uid))";
    
$boohoo++;
  }
  if(
ereg("sympoll_iplog", $tbc_string)) {
    
$db[$boohoo] = "sympoll_iplog";
    
$q[$boohoo]  = "CREATE TABLE $db[$boohoo] (ip VARCHAR(15) NOT NULL, ";
    
$q[$boohoo] .= " pid INT NOT NULL, voted INT NOT NULL, ";
    
$q[$boohoo] .= "PRIMARY KEY (ip, pid))";
    
$boohoo++;
  }

  while(
is_array($db) && list($k,$v) = each($db)) {
    echo
"Creating table: $v ...";
    
$r = mysql_query($q[$k], $s_dbid);
    if(!
$r) { ?>
      <B>FAILED!</B> (lacking create permissions?)<BR><BR><BR>
      A database table creation has failed.  You may manually create the
      table described below, or you may attempt to fix your MySQL
      privileges problem and try again. The problem may be due to your
      MySQL user lacking the CREATE privilege.
      <BR><BR><BR><PRE><?php echo "$q[$k]"; ?>;</PRE><BR></FONT>
      <?php spit_footer(FALSE);
    }
?>
    <B>done!</B><BR>
  <?php } ?>
  <BR><BR>Database Installation Complete!<BR>
  <A HREF="index.<?php echo $ext; ?>">Continue</A></FONT>
  <?php spit_footer(FALSE);
}


function
upgrade_display_dbtables($tbu) {
  global
$ext;

  
spit_header(FALSE); ?>
  <DIV ALIGN="center"><FONT SIZE="6" COLOR="#000066">
  <B>Sympoll Setup</B></FONT><BR>
  <FONT SIZE="5" COLOR="#000066">Database Tables</FONT>
  <HR SIZE="1" WIDTH="50%"><BR></DIV>
  <FORM ACTION="index.<?php echo $ext; ?>" METHOD="post">
  <INPUT TYPE="hidden" NAME="action" VALUE="upgrade_p_dbtables">

  <TABLE ALIGN="center" WIDTH="80%"><TR><TD>
  It appears that you have recently upgraded Sympoll.  This message
  appears because the description of your database tables does not
  match the description that this version of Sympoll uses.  Therefore,
  you must upgrade your database tables.  This should be easy and painless,
  and no data should be lost unless noted in the UPGRADE file.  A file
  named UPGRADE should have come with your Sympoll package.  Please read
  that file before proceeding.  In order for Sympoll to upgrade and operate
  properly, your MySQL user must have at least these privileges:
  <TT>SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP</TT>
  <BR><BR><BR>
  The following tables must be upgraded: <UL>
  <?php while(is_array($tbu) && list($k,$v) = each($tbu)) {
    echo
"<LI>"."$v"."</LI>";
  }
?>
  </UL><BR><BR>Upgrading FROM Version: <SELECT NAME="gen">
  <OPTION VALUE="0">0.1.97 - 0.1.99</OPTION>
  <OPTION VALUE="1">0.2.0 - 0.2.1</OPTION>
  <OPTION VALUE="2">0.2.2 - 0.2.3</OPTION>
  <OPTION VALUE="3">0.3.0 - 0.3.8</OPTION>
  </SELECT>&nbsp;&nbsp;&nbsp;<INPUT TYPE="submit" VALUE="Upgrade Tables"><BR>
  </TD></TR></TABLE></FORM>
  <?php spit_footer(FALSE);
}


function
upgrade_process_dbtables($gen) {
  global
$ext;

  
spit_header(FALSE); ?>
  <DIV ALIGN="center"><FONT SIZE="6" COLOR="#000066">
  <B>Sympoll Setup</B></FONT><BR>
  <FONT SIZE="5" COLOR="#000066">Database Tables</FONT>
  <HR SIZE="1" WIDTH="50%"><BR></DIV>

  <?php switch($gen) {
    case
0:
      
addc_access_sympauth();
    case
1:
      
upgrade_rename_col("sympoll_list", "pollID", "pid", "INT NOT NULL AUTO_INCREMENT");
      
upgrade_rename_col("sympoll_data", "pollID", "pid", "INT NOT NULL");
      
upgrade_rename_col("sympoll_data", "choiceID", "cid", "INT NOT NULL");
      
upgrade_rename_col("sympoll_auth", "id", "uid", "INT NOT NULL AUTO_INCREMENT");
      
addc_nextcid_symplist();
    case
2:
      
upgrade_rename_col("sympoll_auth", "user", "user", "VARCHAR(32) DEFAULT '' NOT NULL");
      
upgrade_rename_col("sympoll_auth", "pass", "pass", "VARCHAR(32) DEFAULT '' NOT NULL");
      
upgrade_purge_table("sympoll_auth");
    case
3:
      
upgrade_add_index("sympoll_data", "pid");
      break;  
/* move this break when we add cases below! */
  
} ?>

  <BR><BR>Database Upgrade Complete!<BR>
  <FONT SIZE="+1"><A HREF="index.<?php echo $ext; ?>">Continue</A></FONT>
  <?php spit_footer(FALSE);
}


function
addc_access_sympauth() {
  global
$s_dbid, $s_dbname;

  
# make sure col doesn't exist
  
$fields = mysql_list_fields($s_dbname, "sympoll_auth", $s_dbid);
  for (
$i = 0; $i < mysql_num_fields($fields); $i++) {
    if(
mysql_field_name($fields, $i) == "access")
      { return; }
  }
?>

  Altering sympoll_auth in <?php echo $s_dbname; ?>: adding 'access' column...
  <?php $q1 = "ALTER TABLE sympoll_auth ADD access INT UNSIGNED DEFAULT '1' AFTER pass";
  
$q2 = "UPDATE sympoll_auth SET access='1'";
  
$q3 = "UPDATE sympoll_auth SET access='0' WHERE id='1'";
  
$r1 = mysql_query($q1, $s_dbid) or die("<B>FAILED!</B> (lacking alter permissions?)<BR>");
  
$r2 = mysql_query($q2, $s_dbid);
  
$r3 = mysql_query($q3, $s_dbid);
  
# if update fails revert back
  
if(!$r2 || !$r3) {
    
$q4 = "ALTER TABLE sympoll_auth DROP access";
    
$r4 = mysql_query($q4, $s_dbid);
    die(
"<B>FAILED!</B> (lacking update permissions?)<BR>");
  }
?>
  <B>done!</B><BR>
<?php }


function
addc_nextcid_symplist() {
  global
$s_dbid, $s_dbname;

  
# make sure col doesn't exist
  
$fields = mysql_list_fields($s_dbname, "sympoll_list", $s_dbid);
  for (
$i = 0; $i < mysql_num_fields($fields); $i++) {
    if(
mysql_field_name($fields, $i) == "nextcid")
      { return; }
  }
?>

  Altering sympoll_list in <?php echo $s_dbname; ?>: adding 'nextcid' column...
  <?php $q1 = "ALTER TABLE sympoll_list ADD nextcid INT UNSIGNED DEFAULT '0' NOT NULL AFTER identifier";
  
$q2 = "SELECT pid FROM sympoll_list";
  
$r1 = mysql_query($q1, $s_dbid) or die("<B>FAILED!</B> (lacking alter permissions?)<BR>");
  
$r2 = mysql_query($q2, $s_dbid);
  for(
$dsr = 0; $dsr < mysql_numrows($r2); $dsr++) {
    
$a2 = mysql_fetch_array($r2);
    
$q3 = "SELECT MAX(cid)+1 AS nextc FROM sympoll_data WHERE pid='$a2[pid]'";
    
$r3 = mysql_query($q3, $s_dbid);
    
# if update fails revert back
    
if(!$r3) {
      
$q4 = "ALTER TABLE sympoll_list DROP nextcid";
      
$r4 = mysql_query($q4, $s_dbid);
      die(
"<B>FAILED!</B> (unable to calculate nextcid?)<BR>");
    }
    
$a3 = mysql_fetch_array($r3);
    
$q5 = "UPDATE sympoll_list SET nextcid='$a3[nextc]' WHERE pid='$a2[pid]'";
    
$r5 = mysql_query($q5, $s_dbid);
    
# if update fails revert back
    
if(!$r5) {
      
$q6 = "ALTER TABLE sympoll_list DROP nextcid";
      
$r6 = mysql_query($q6, $s_dbid);
      die(
"<B>FAILED!</B> (lacking update permissions?)<BR>");
    }
  }
?>
  <B>done!</B><BR>
<?php }


function
upgrade_rename_col($tbl, $old, $new, $desc) {
  global
$s_dbid, $s_dbname;

  
$fields = mysql_list_fields($s_dbname, $tbl, $s_dbid);
  
$has_old = FALSE; $has_new = FALSE;
  for(
$dsr = 0; $dsr < mysql_num_fields($fields); $dsr++) {
    
$current = mysql_field_name($fields, $dsr);
    if(
strcmp($current, $old) == 0) {
      
$has_old = TRUE;
    } elseif(
strcmp($current, $new) == 0) {
      
$has_new = TRUE;
    }
  }
  
# rename already done?
  
if(!$has_old && $new_new)
    { return; }
?>

  Changing <?php echo $tbl; ?> in <?php echo $s_dbname; ?>: <?php echo $old; ?> column...
  <?php # check for problems
  
if(!$has_old)
    { die(
"<B>FAILED!</B> ("."$old"." does not exist?)<BR>"); }
  
# do rename
  
$q1 = "ALTER TABLE $tbl CHANGE $old $new $desc";
  
$r1 = mysql_query($q1, $s_dbid) or die("<B>FAILED!</B> (lacking alter permissions?)<BR>"); ?>
  <B>done!</B><BR>
<?php }


function
upgrade_purge_table($tbl) {
  global
$s_dbid, $s_dbname; ?>

  Deleting from <?php echo $tbl; ?> in <?php echo $s_dbname; ?>: purging table...
  <?php $q1 = "DELETE FROM $tbl";
  
$r1 = mysql_query($q1, $s_dbid) or die("<B>FAILED!</B> (lacking delete permissions?)<BR>"); ?>
  <B>done!</B><BR>
<?php }


function
upgrade_add_index($tbl, $col) {
  global
$s_dbid, $s_dbname; ?>

  Indexing <?php echo $tbl; ?> in <?php echo $s_dbname; ?>: <?php echo $col; ?> column...
  <?php $q1 = "ALTER TABLE $tbl ADD INDEX($col)";
  
$r1 = mysql_query($q1, $s_dbid) or die("<B>FAILED!</B> (lacking alter permissions?)<BR>"); ?>
  <B>done!</B><BR>
<?php }

?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0047 ]--