Source of sql_convert.php
<? // script to trim and replace spaces, returns, etc to commas
require("Sajax.php");
session_start();
session_register("fromHere");
sajax_init();
sajax_export("convert");
sajax_handle_client_request();
function isFromHere() {
if ( $_SESSION["fromHere"] != 1 ) {
echo ":P";
}
}
function convert($itemList="") {
if ( $itemList=="" ) {
return "";
}
$newList = "";
$nArray = preg_split("/[\s]+/",$itemList);
$numItems = count($nArray);
for($x = 0; $x < $numItems; $x++) {
if ( $newList == "" ) {
$newList = addslashes($nArray[$x]);
} else {
$newList .= "','" . addslashes($nArray[$x]);
}
}
return $newList;
}
$_SESSION["fromHere"] = 1;
?>
<html>
<head>
<title>SQL Helper</title>
<script language="javascript">
<!-- // hide from older browsers
<? sajax_show_javascript(); ?>
function getElem(id) {
return document.getElementById(id);
}
function convert_cb(result) {
getElem('tOutput').value = result;
}
//-->
</script>
</head>
<body>
<center><h2>Convert Data to SQL</h2></center>
<b>1. Data Goes Here: </b><br />
<textarea id="tInput" rows="4" cols="40"></textarea><br />
<b>2. Click to convert: </b><button onClick="x_convert(getElem('tInput').value,convert_cb);">Convert...</button><br />
<b>3. Output Here: </b><br />
<textarea id="tOutput" readonly rows="4" cols="40"></textarea><br />
</body>
</html>