Please log in to your MySQL database'; if (!empty($submit)) {echo '

Sorry - login failed - please try again

'."\n";} echo '
Hostname:
Username:
Password:

'."\n"; } else { if (!isset($db)) { $dbs = mysql_list_dbs($dbl); $num_dbs = mysql_numrows($dbs); echo '

Please choose a database

'."\n"; for ($i=0; $i<$num_dbs; $i++) { $db = mysql_dbname($dbs, $i); if ($i==0) { echo ' '."\n"; } else { echo ' '."\n"; } } echo '
'.$db.'
'.$db.'

'."\n"; } else { if (!isset($tb)) { echo '

Please choose a table from database: '.$db.'

'."\n"; $tbs = mysql_list_tables($db,$dbl); $num_tbs = @mysql_num_rows($tbs); for ($j=0; $j<$num_tbs; $j++) { $tb = mysql_tablename($tbs, $j); if ($j == 0) { echo ' '."\n"; } else { echo ' '."\n"; } } echo '
'.$tb.'
'.$tb.'

'."\n"; } else { if (!isset($id)) { echo '

Please choose an identifier from table: '.$tb.'

This field will be used in Changes or Deletes.

It must be numeric and must uniquely identify a record.
If you haven\'t got a suitable field select None.

'."\n"; echo "describe $tb
\n"; mysql_select_db($db); $tb_desc = mysql_query("describe $tb"); $fds = mysql_list_fields($db,$tb,$dbl); $j = 0; while (1) { $fd = @mysql_field_name($fds, $j); if ($fd == "") { break; } $ff = mysql_field_flags($fds, $j); echo ' '; $r = mysql_fetch_array($tb_desc,$j); /* echo "\n"; echo "\n"; */ ++$j; } echo '
NoneNo id field required
'.$fd.''.$ff.'
";
print_r($r);
echo "

Page Title:
Base Filename:
'."\n"; } else { echo '

Here is your phpMyEdit calling program

'."\n"; echo '

You may now copy and paste it into your PHP editor

'."\n"; //echo '
'."\n";
        echo_buffer('

trimlen, display substr($value,0,trimlen-3).'...' ['width'] is an optional display width specification for the column, e.g. ['width'] = '100px'; or \$fdd['colname']['width'] = (\$fdd['colname']['trimlen'] * 8).'px'; ['nowrap'] true or false. whether this field should get a NOWRAP ['mask'] a string that is used by sprintf() to format field output ['datemask'] a string that is used by date() to format date fields see PHP's date() for valid formatting characters ['daterange'] a of numbers ['daterange']['start'] = 1996; ['daterange']['end'] = \$fdd['colname']['daterange']['start']+20; ['URL'] is used to make a field 'clickable' in the display, e.g.: ['URL'] = 'mailto:' or ['URL'] = 'http://'; ['URL'] = '\$page?stuff'; Note that the following are available as variables: \$key key field for record \$name name of the field \$value value of the field \$page this HTML page \$row mysql_fetch_assoc() for this row ['required'] = true will generate javascript to prevent null entries by users ['options'] is an optional parameter to control whether a field is displayed in the A(dd), C(hange), D(elete), view, or L(ist) views ['options']='R' indicates that a field is read only ['options']='P' indicates that a field is a password field ['options']='H' indicates that a field is to be hidden and marked as hidden ['textarea']['rows'] and/or ['textarea']['cols'] specifies a textarea is to be used to give multi-line input, e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10 ['values'] restricts user input to the specified constants, e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99); ['values']['table'] and ['values']['column'] restricts user input to the values found in the specified column of another table. The optional ['values']['description'] field allows the value(s) displayed to the user to be different to those in the ['values']['column'] field. This is useful for giving more meaning to column values. There are two main options when using the ['values']['description'] field. These are whether you want to use a single, or multiple field in your description. To apply single, you need to use: ['values']['description'] = 'desc_column' This may be used, with no other options, and will simply display the description for the corresponding value. For Multiple, use: ['values']['description']['columns']['1'] = 'desc_column_1' ['values']['description']['divs']['1'] = ' ' ['values']['description']['columns']['2'] = 'desc_column_2' The 'div' component is what will be used as a divider between the columns in the display. You don't need to define the last 'div' field if it isn't required. So, for example...if you have a series of people in a table, with a separate column for id, first name, and last name, you could use: ['values']['db']='mydb' *optional if table is in another database* ['values']['table']='mytable' ['values']['column']='id' ['values']['description']['columns']['1']='last_name' ['values']['description']['divs']['1'] =', ' ['values']['description']['columns']['2']='first_name' ['values']['filters']='idcolumn in (1,2,3)' *optional WHERE clause* ['values']['orderby']='last_name' *optional ORDER BY clause* if a column is either SET or ENUM type, then the values are put in by PME Setup. ['select'] = 'T/D/M' (text, drop-down, or multiple selection for filters) if a column is a SET type, then this is automatically 'M' Calculated Expressions example: \$fdd['other']['name']='Col Header'; \$fdd['other']['expression']='onHand-ordered'; \$fdd['other']['sort']='T:!'; \$fdd['other']['select']='T'; \$fdd['other']['type']='int'; 'other' can be anything, but needs to be unique within the list of \$fdd keys 'expression' can be any valid MySQL expression 'type' should reflect the results of the expression, e.g. 'int' or 'string' all other options work as with other, normal columns this kind of column is always read-only */"); mysql_select_db($db); $tb_desc = mysql_query("describe $tb"); $fds = mysql_list_fields($db, $tb, $dbl); $num_fds = mysql_num_fields($fds); for ($k=0 ; $k<$num_fds; $k++) { $fd = mysql_field_name($fds,$k); $fm = mysql_fetch_field($fds,$k); $fn = ucwords( strtr( $fd, "_-.", " " ) ); $row = mysql_fetch_array($tb_desc); echo_buffer('$fdd["'.$fd.'"] = array('); echo_buffer(" 'name'=>'".str_replace('\'','\\\'',$fn)."',"); if (substr($row[1],0,3) == 'set') { echo_buffer(" 'select'=>'M',"); echo_buffer(" 'type'=>'set',"); } else { echo_buffer(" 'select'=>'T',"); echo_buffer(" 'type'=>'".mysql_field_type($fds,$k)."',"); } echo_buffer(" 'maxlen'=>".mysql_field_len($fds,$k).','); echo_buffer(" 'nowrap'=>false,"); if (stristr(mysql_field_flags($fds,$k),'not_null')) { echo_buffer(" 'required'=>true,"); } # blobs -> textarea if (mysql_field_type($fds,$k)=='blob') { echo_buffer(" 'textarea'=>array("); echo_buffer(" 'rows'=>5,"); echo_buffer(" 'cols'=>50,"); echo_buffer(" 'wrap'=>'virtual'"); echo_buffer(" ),"); } # timestamps are read-only if (mysql_field_type($fds,$k)=='timestamp') { echo_buffer(" 'options'=>'R',"); } # SETs and ENUMs get special treatment if (substr($row[1],0,3) == 'set') { echo_buffer(" 'values'=>array".substr($row[1],3).','); } if (substr($row[1],0,4) == 'enum') { echo_buffer(" 'values'=>array".substr($row[1],4).','); } # automatic support for Default values if ($row[4] != '' && $row[4] != 'NULL') { echo_buffer(" 'default'=>'".$row[4]."',"); } echo_buffer(" 'sort'=>true"); echo_buffer(');'); echo_buffer(''); } echo_buffer(" \$opts['fdd'] = \$fdd; /* table-level filter capability if set, is included in the WHERE clause of any generated SELECT statement example: \$opts['filters'] = \"column1 like '%11%' AND column2<17\"; ); */ /* Triggers are files that are included (via require) that perform actions (before or after) X (inserts, updates, or deletes). 'before' triggers are usually used to verify conditions prior to executing the main operation. 'after' triggers are usually used to perform follow-on operations after the main operation. For example, to update secondary tables to enforce referential integrity or to update aggregate tables. The operation sequence is this: before, main, after. If any operation fails, not only should the next operation(s) not be executed, but the previous ones are 'rolled back' as if they never happened. If a database is not able to do this, it is not 'transaction-safe'. Triggers are risky in basic MySQL as there is no native transaction support--it is not transaction-safe by default. There are transaction-safe table types in MySQL that can be conditionally built (see MySQL-Max), but phpMyEdit is currently not set up to support real transactions. What that means is that if an operation fails, the database may be left in an intermediate and invalid state. The programmer must understand and accept these risks prior to using the phpMyEdit triggers mechanism. If the triggers are used, they execute within the namespace or scope of the phpMyEdit class. They _must_ return true or false to indicate success or failure. */ /* \$opts['triggers']['insert']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TIB.inc'; \$opts['triggers']['insert']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TIA.inc'; \$opts['triggers']['update']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TUB.inc'; \$opts['triggers']['update']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TUA.inc'; \$opts['triggers']['delete']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TDB.inc'; \$opts['triggers']['delete']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TDA.inc'; */ /* logtable schema CREATE TABLE changelog ( updated timestamp(14) NOT NULL, user varchar(50) default NULL, host varchar(255) NOT NULL default '', operation varchar(50) default NULL, tab varchar(50) default NULL, rowkey varchar(255) default NULL, col varchar(255) default NULL, oldval blob, newval blob ); \$opts['logtable']= 'changelog'; */ "); echo_buffer(" # get the user's default language and use it if possible \$opts['language']= \$HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']; // and now the all-important call to phpMyEdit // warning - beware of case-sensitive operating systems! require_once 'phpMyEdit.class.php'; \$MyForm = new phpMyEdit(\$opts); ?>
"); /* * Writting of two files makes only much more confusion on whole stuff. * Only real phpMyEdit content file is now written. Everybody can include * it from its own files to get the job (headers, footes, etc.). * * Nepto [29/7/2002] */ if (0) { // write the php file $phpFileContents = ''; echo 'Writing PHP file to: '.$destDir.'/'.$phpFile."
\n"; $filehandle = @fopen($destDir.'/'.$phpFile,'w+'); if ($filehandle) { fwrite($filehandle,$phpFileContents); flush($filehandle); fclose($filehandle); echo 'file written successfully
'; } echo '
PHP file:
';
	echo_html($phpFileContents);
	echo "

\n"; } // if (0) // write the content include file echo 'Trying to write content file to: '.$inclDir.'/'.$contentFile.'
'."\n"; $filehandle = @fopen($inclDir.'/'.$contentFile,'w+'); if ($filehandle) { fwrite($filehandle,$buffer); flush($filehandle); fclose($filehandle); echo 'phpMyEdit content file written successfully
'; } else { echo 'phpMyEdit content file was NOT written due to inssufficient privileges.
'; echo 'Please copy and paste content listed below to '.$inclDir.'/'.$contentFile.' file.'; } echo '

'; echo '

phpMyEdit content file follows

'."\n"; echo '
';
echo_html($buffer);
echo '

'."\n"; } } } } ?>