<
div id="DBPLUGIN_PARAMS_PDO">
<
p>PDO DSN
(<
a href="https://www.php.net/manual/de/pdo.drivers.php" target="_blank">more information<
/a>
):<
br><
input id="pdo_dsn" type="text" value="mysql:dbname=oidplus;host=localhost" onkeypress="rebuild()" onkeyup="rebuild()" style="width:600px"> <
span id="pdo_dsn_warn"><
/p>
<
p>PDO Username:<
br><
input id="pdo_username" type="text" value="root" onkeypress="rebuild()" onkeyup="rebuild()"> <
span id="pdo_username_warn"><
/p>
<
p>PDO Password:<
br><
input id="pdo_password" type="password" value="" onkeypress="rebuild()" onkeyup="rebuild()"> <
span id="pdo_password_warn"><
/p>
<
p><
i>Attention: OIDplus currently only implements the SQL dialect of MySQL. Other DBMS might not work.<
/i><
/p>
plugin_combobox_change_callbacks.push(function(strPlugin) {
document.getElementById('DBPLUGIN_PARAMS_PDO').style.display = (strPlugin == 'PDO') ? "Block" : "None";
});
rebuild_callbacks.push(function() {
var e = document.getElementById("db_plugin");
var strPlugin = e.options[e.selectedIndex].value;
if (strPlugin != 'PDO') return true;
document.getElementById('struct_cli_1').innerHTML = '';
document.getElementById('struct_cli_2').innerHTML = '';
document.getElementById('struct_1').href = 'struct_empty.sql.php';
document.getElementById('struct_2').href = 'struct_with_examples.sql.php';
error = false;
// Check 1: dsn must not be empty
if (document.getElementById('pdo_dsn').value.length == 0)
{
document.getElementById('pdo_dsn_warn').innerHTML = '<font color="red">Please specify a DSN!</font>';
document.getElementById('config').innerHTML = '<b><?php</b><br><br><i>// ERROR: Please specify a DSN!</i>';
error = true;
} else {
document.getElementById('pdo_dsn_warn').innerHTML = '';
}
// Check 2: Username must not be empty
if (document.getElementById('pdo_username').value.length == 0)
{
document.getElementById('pdo_username_warn').innerHTML = '<font color="red">Please specify a username!</font>';
document.getElementById('config').innerHTML = '<b><?php</b><br><br><i>// ERROR: Please specify a username!</i>';
error = true;
} else {
document.getElementById('pdo_username_warn').innerHTML = '';
}
document.getElementById('struct_1').href = setupdir+'struct_empty.sql.php?plugin=pdo&prefix='+encodeURI(document.getElementById('tablename_prefix').value);
document.getElementById('struct_2').href = setupdir+'struct_with_examples.sql.php?plugin=pdo&prefix='+encodeURI(document.getElementById('tablename_prefix').value);
document.getElementById('struct_cli_1').innerHTML = '<br>or via command line:<br><code>curl -s "'+document.getElementById('struct_1').href+'" | mysql -u '+document.getElementById('mysql_username').value+' -p</code>';
document.getElementById('struct_cli_2').innerHTML = '<br>or via command line:<br><code>curl -s "'+document.getElementById('struct_2').href+'" | mysql -u '+document.getElementById('mysql_username').value+' -p</code>';
return !error;
});
rebuild_config_callbacks.push(function() {
var e = document.getElementById("db_plugin");
var strPlugin = e.options[e.selectedIndex].value;
if (strPlugin != 'PDO') return '';
return '<b>define</b>(\'OIDPLUS_PDO_DSN\', \''+document.getElementById('pdo_dsn').value+'\');<br>' +
'<b>define</b>(\'OIDPLUS_PDO_USERNAME\', \''+document.getElementById('pdo_username').value+'\');<br>' +
'<b>define</b>(\'OIDPLUS_PDO_PASSWORD\', \''+b64EncodeUnicode(document.getElementById('pdo_password').value)+'\'); // base64 encoded<br>';
});