version 1.19, 2003/03/25 21:48:10 |
version 1.20, 2003/03/26 18:41:18 |
|
|
* http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
*/ |
*/ |
|
|
/* $Platon: phpMyEdit/phpMyEditSetup.php,v 1.18 2003/03/06 23:19:47 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEditSetup.php,v 1.19 2003/03/25 21:48:10 nepto Exp $ */ |
|
|
?> |
?> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
Line 100 if ((!$dbl) or empty($submit)) { |
|
Line 100 if ((!$dbl) or empty($submit)) { |
|
} |
} |
echo ' |
echo ' |
<form action="'.htmlspecialchars($self).'" method="POST"> |
<form action="'.htmlspecialchars($self).'" method="POST"> |
<table border="1" cellpadding="1" cellspacing="0" summary="Log in"> |
<table border="1" cellpadding="1" cellspacing="0" summary="Login form"> |
<tr> |
<tr> |
<td>Hostname:</td> |
<td>Hostname:</td> |
<td><input type="text" name="hn" value="'.htmlspecialchars($hn).'"></td> |
<td><input type="text" name="hn" value="'.htmlspecialchars($hn).'"></td> |
Line 122 if ((!$dbl) or empty($submit)) { |
|
Line 122 if ((!$dbl) or empty($submit)) { |
|
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
<input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
<input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
<table border="1" cellpadding="1" cellspacing="1" summary="Choose Database">'."\n"; |
<table border="1" cellpadding="1" cellspacing="1" summary="Database selection">'."\n"; |
for ($i = 0; $i < $num_dbs; $i++) { |
for ($i = 0; $i < $num_dbs; $i++) { |
$db = @mysql_db_name($dbs, $i); |
$db = @mysql_db_name($dbs, $i); |
$checked = ! strcasecmp($un, $db) ? ' checked' : ''; |
$checked = ! strcasecmp($un, $db) ? ' checked' : ''; |
Line 140 if ((!$dbl) or empty($submit)) { |
|
Line 140 if ((!$dbl) or empty($submit)) { |
|
<input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
<input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
<input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
<input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
<table border="1" cellpadding="1" cellspacing="1" summary="Choose Table">'."\n"; |
<table border="1" cellpadding="1" cellspacing="1" summary="Table selection">'."\n"; |
$tbs = @mysql_list_tables($db, $dbl); |
$tbs = @mysql_list_tables($db, $dbl); |
$num_tbs = @mysql_num_rows($tbs); |
$num_tbs = @mysql_num_rows($tbs); |
for ($j = 0; $j < $num_tbs; $j++) { |
for ($j = 0; $j < $num_tbs; $j++) { |
Line 157 if ((!$dbl) or empty($submit)) { |
|
Line 157 if ((!$dbl) or empty($submit)) { |
|
echo ' <h1>Please choose an identifier from table: '.htmlspecialchars($tb).'</h1> |
echo ' <h1>Please choose an identifier from table: '.htmlspecialchars($tb).'</h1> |
<p> |
<p> |
This field will be used in change, view, copy and deletes operation.<br> |
This field will be used in change, view, copy and deletes operation.<br> |
It should be numeric and must uniquely identify a record.<br> |
It should be numeric and must uniquely identify a record. |
|
</p> |
|
<p> |
|
Please note, that there were problems reported by phpMyEdit users |
|
regarding using MySQL reserved word as unique key name (the example for |
|
this is "key" name). Thus we recommend you to use another name |
|
of unique key. Usage of "id" or "ID" should be safe and good idea. |
</p> |
</p> |
<form action="'.htmlspecialchars($self).'" method="POST"> |
<form action="'.htmlspecialchars($self).'" method="POST"> |
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
Line 165 if ((!$dbl) or empty($submit)) { |
|
Line 171 if ((!$dbl) or empty($submit)) { |
|
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
<input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
<input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
<input type="hidden" name="tb" value="'.htmlspecialchars($tb).'"> |
<input type="hidden" name="tb" value="'.htmlspecialchars($tb).'"> |
<table border="1" cellpadding="1" cellspacing="1" summary="Choose Key">'."\n"; |
<table border="1" cellpadding="1" cellspacing="1" summary="Key selection">'."\n"; |
// <tr><td><input type="radio" name="id" value=""> |
// <tr><td><input type="radio" name="id" value=""> |
// <td><i>None</i></td><td><i>No id field required</i></td></tr> |
// <td><i>None</i></td><td><i>No id field required</i></td></tr> |
@mysql_select_db($db); |
@mysql_select_db($db); |
$tb_desc = @mysql_query("DESCRIBE $tb"); |
$tb_desc = @mysql_query("DESCRIBE $tb"); |
$fds = @mysql_list_fields($db,$tb,$dbl); |
$fds = @mysql_list_fields($db,$tb,$dbl); |
for ($j = 0; ($fd = @mysql_field_name($fds, $j)) != ''; $j++) { |
for ($j = 0; ($fd = @mysql_field_name($fds, $j)) != false; $j++) { |
$ff = @mysql_field_flags($fds, $j); |
$ff = @mysql_field_flags($fds, $j); |
|
strlen($ff) <= 0 && $ff = '---'; |
$checked = stristr($ff, 'primary_key') ? ' checked' : ''; |
$checked = stristr($ff, 'primary_key') ? ' checked' : ''; |
echo '<tr><td><input',$checked,' type="radio" name="id" value="',htmlspecialchars($fd),'"></td>'; |
echo '<tr><td><input',$checked,' type="radio" name="id" value="',htmlspecialchars($fd),'"></td>'; |
echo '<td>',htmlspecialchars($fd),'</td>'; |
echo '<td>',htmlspecialchars($fd),'</td>'; |
Line 181 if ((!$dbl) or empty($submit)) { |
|
Line 188 if ((!$dbl) or empty($submit)) { |
|
} |
} |
echo '</table><br> |
echo '</table><br> |
<table border="1" cellpadding="1" cellspacing="1" summary="Additional options"> |
<table border="1" cellpadding="1" cellspacing="1" summary="Additional options"> |
<tr><td>Page title</td><td><input type="text" name=pageTitle value ="'.htmlspecialchars($tb).'"></td></tr> |
<tr><td>Page title</td><td><input type="text" name=pageTitle value =""></td></tr> |
<tr><td>Base filename</td><td><input type="text" name=baseFilename value ="'.htmlspecialchars($tb).'"></td></tr> |
<tr><td>Base filename</td><td><input type="text" name=baseFilename value ="'.htmlspecialchars($tb).'"></td></tr> |
</table><br> |
</table><br> |
<input type="submit" name="submit" value="Submit"> |
<input type="submit" name="submit" value="Submit"> |
Line 191 if ((!$dbl) or empty($submit)) { |
|
Line 198 if ((!$dbl) or empty($submit)) { |
|
} else { |
} else { |
echo '<h1>Here is your phpMyEdit calling program</h1>'."\n"; |
echo '<h1>Here is your phpMyEdit calling program</h1>'."\n"; |
echo '<h2>You may now copy and paste it into your PHP editor</h2>'."\n"; |
echo '<h2>You may now copy and paste it into your PHP editor</h2>'."\n"; |
echo_buffer('<h3>'.$pageTitle.'</h3>'); |
echo_buffer('<style type="text/css"> |
|
table { border: #004d9c 1px solid; border-collapse: "collapse"; border-spacing: 0px; width: 100%; } |
|
th { border: #004d9c 1px solid; padding: 4px; background: #add8e6; } |
|
td { border: #004d9c 1px solid; padding: 3px; } |
|
hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; } |
|
</style>'); |
|
strlen($pageTitle) > 0 && echo_buffer('<h3>'.$pageTitle.'</h3>'); |
echo_buffer("<?php |
echo_buffer("<?php |
|
|
/* |
/* |
Line 203 if ((!$dbl) or empty($submit)) { |
|
Line 216 if ((!$dbl) or empty($submit)) { |
|
* http://www.platon.sk/projects/main_page.php?project_id=5 |
* http://www.platon.sk/projects/main_page.php?project_id=5 |
*/ |
*/ |
|
|
// MySQL host name, user name, password, database, and table to edit |
// MySQL host name, user name, password, database, and table |
\$opts['hn'] = '$hn'; |
\$opts['hn'] = '$hn'; |
\$opts['un'] = '$un'; |
\$opts['un'] = '$un'; |
\$opts['pw'] = '$pw'; |
\$opts['pw'] = '$pw'; |
Line 228 if ((!$dbl) or empty($submit)) { |
|
Line 241 if ((!$dbl) or empty($submit)) { |
|
} |
} |
echo_buffer(" |
echo_buffer(" |
// Sorting field(s) |
// Sorting field(s) |
\$opts['sort_field'] = '$id'; |
\$opts['sort_field'] = array('$id'); |
|
|
// Number of records to display on the screen |
// Number of records to display on the screen |
// Value of -1 lists all records in a table |
// Value of -1 lists all records in a table |
Line 363 appear in generated list. Here are some |
|
Line 376 appear in generated list. Here are some |
|
} |
} |
|
|
echo_buffer(" |
echo_buffer(" |
// Now important call to phpMyEdit |
// Now important call to phpMyEdit |
require_once 'phpMyEdit.class.php'; |
require_once 'phpMyEdit.class.php'; |
new phpMyEdit(\$opts); |
new phpMyEdit(\$opts); |
|
|