function ConnectToDB(){
// $db = mysql_connect("localhost", "web617", " ");
$db = mysql_connect("sqlkunden.de", "BA50", "zt770596");
if (!$db) {
die('keine Verbindung möglich: '.mysql_error());
}
//echo 'Verbindung erfolgreich';
return $db;
$dbName = "ba50";
//$dbName = "hemiptera";
}
function makeSQLFromLink($res)
{
$sSQL="";
$nAnzahl=count($res);
$sTemp2="";
$sTemp="";
for($count = 0; $count < $nAnzahl; $count++)
{
//echo $res[$count]."
";
$sTemp=explode("=",$res[$count]);
//echo $sTemp[0]." ".$sTemp[1]."
";
if (isset($sTemp[1]))
{
//echo $sTemp[0]." ".$sTemp[1]."
";
//echo $sTemp[0]."--->".$sTemp[1]."
";
switch ($sTemp[0])
{
case "cboAuthor":
break;
case "cboSearch":
if ($sTemp[1]!="All") {
//echo "User nicht hat All gew�hlt
";
$sTemp2="TYPE = '".$sTemp[1]."'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "refid":
if ($sTemp[1]!="") {
//$sTemp2="ID = '".$sTemp[1]."'";
$sTemp2="ID = ".$sTemp[1]."";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "author":
if ($sTemp[1]!="") {
$sTemp2="";
$sFindInWhat=explode("=",$res[2]);
//echo $sFindInWhat[1]."
";
switch ($sFindInWhat[1]) {
case "ED":
$sTemp2=" Editors LIKE '%".$sTemp[1]."%'";
break;
case "AUTH":
$sTemp2=" Authors LIKE '%".$sTemp[1]."%'";
break;
case "AUTHED":
$sTemp2=" (Authors LIKE '%".$sTemp[1]."%' OR Editors LIKE '%".$sTemp[1]."%')";
break;
}
if ($sSQL=="") {
$sSQL=$sTemp2;
//echo "
-1 ".$sSQL."
";
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
//echo "
-2 ".$sSQL."
";
}
}
break;
case "title":
if ($sTemp[1]!="") {
$sTemp2=" TITLE_1 LIKE '".$sTemp[1]."%'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "periodical":
if ($sTemp[1]!="") {
$sTemp2=" PERIODICAL LIKE '".$sTemp[1]."%'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "keywords":
if ($sTemp[1]!="") {
$sTemp2=" KEYWORDS LIKE '%".$sTemp[1]."%'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "ISBN":
if ($sTemp[1]!="") {
$sTemp2=" ISBN LIKE '%". $sTemp[1]. "%' OR ISSN LIKE '%".$sTemp[1]."%'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "language":
if ($sTemp[1]!="") {
$sTemp2=" LANGUAGE LIKE '%".$sTemp[1]."%'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "congress":
if ($sTemp[1]!="") {
$sTemp2=" CONGRESS LIKE '%".$sTemp[1]."%'";
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
}
break;
case "pubyear":
if ($sTemp[1]!="") {
$sFieldValue=explode("-",$sTemp[1]);
if (count($sFieldValue)==2){
$sTemp2=" (PUB_YEAR >= ".$sFieldValue[0]." AND PUB_YEAR <= ".$sFieldValue[1].")";
}
else {
$sTemp2=" PUB_YEAR = ".$sTemp[1];
}
if ($sSQL=="") {
$sSQL=$sTemp2;
}
else {
$sSQL=$sSQL." AND ".$sTemp2;
}
break;
}
}
}
//else {
//echo "ich bin hier";
//}
//else
//{
// echo $sTemp[0]."---> leer
";
//}
}
//echo "
RESULT: ".$sSQL;
//echo $sSQL."
";
if ($sSQL=="") {
$sSQL="";
}
return $sSQL;
}
function getUser($sUserName,$sPassWord,$sSQL)
{
$db=ConnectToDB();
//$dbName="usr_web617_1";
$dbName="ba50";
//$dbName="hemiptera";
$sSQL="select * from customer where username = '" . $sUserName . "' and userpwd = '" . $sPassWord & "';";
$res = mysql_db_query($dbName, $sSQL);
if (!$res)
{
return $sSQL;
exit;
}
else
{
return "OK";
exit;
}
}
function makeSQLNew($sFieldName,$sFieldValue ,$myCriteria, $nDataType)
{
$sRetVal="";
switch ($sFieldName){
case "ID":
if ($myCriteria!=""){
$sRetVal=$sFieldName."=".$sFieldValue;
}
else
{
$sRetVal=$myCriteria." AND ".$sFieldName."=".$sFieldValue;
}
case "Author":
if ($myCriteria!=""){
}
}
return $sRetVal;
}
function umlaute($text)
{
//$search = array ('�', '�', '�', '�');
//$replace = array ('ä', 'ö', 'ü', 'ss');
$search = array ('-','�','�','�','+','�','+','�','+','�','-','�','�','�','�','�','�','�','+','�','-','�','+','�','�','�','�','-','�','�','�','-','�','+','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','=','�','�','i','�','�','�','�','�','�','�','�','�','�','�','+','�','�','�','+','�','_','�','�','�','�','�','�');
$replace = array ('Â','â','Æ','æ','À','à','Å','å','Ã','ã','Ä','ä','Ç','ç','¸','¢','ˆ','©','É','é','Ê','ê','È','è','∅','Ð','ð','Ë','ë','€','ƒ','Í','í','Î','î','¡','Ì','ì','Ï','ï','Ñ','ñ','Ó','ó','Ô','ô','Œ','œ','Ò','ò','Ø','ø','Õ','õ','Ö','ö','¶','‰','£','®','Š','š','§','ß','Ú','ú','Û','û','Ù','ù','Ü','ü','Ý','ý','¥','Ÿ','ÿ');
$str = str_replace($search, $replace, $text);
return $str;
}
function makeSQL($sFieldName,$sFieldValue ,$myCriteria, $nDataType,$nSearchWhat)
{
/*echo $sFieldName;
echo "
";
echo $sFieldValue;
echo "
";
echo $myCriteria;
echo "
";
echo $nDataType;
echo "
";
echo $nDataType;
echo "
";
echo $nSearchWhat;
echo "
";*/
if ($sFieldValue !=""){
if ($myCriteria !=""){
if ($sFieldValue == "Editors" and $nSearchWhat==1) {
$myCriteria = $myCriteria." OR ";
} else {
$myCriteria = $myCriteria." AND ";
}
}
}
switch ($nDataType){
case "0" :
$myCriteria = $myCriteria.$sFieldName." LIKE '".$sFieldValue."%'";
case "1" :
//myCriteria = $myCriteria.$sFieldName." LIKE '".$sFieldValue."%'"
$teile = explode(" ", $sFieldValue);
//echo $schluesselwoerter;
case "2" :
$myCriteria = $myCriteria.$sFieldName." = ".$sFieldValue;
//echo "
bin jetzt hier".$myCriteria."
";
}
return $myCriteria;
}
function data_output($result)
{
$anz=mysql_num_fields($result);
$breit=100/$anz."%";
$num = mysql_num_rows($result);
echo "
";
echo "
Ref. ID | "; echo "Authors | "; echo "Year | "; echo "Title | "; echo "|||
$row[$fn] | "; echo "$row[$fn2] | "; echo "$row[$fn3] | "; echo "$row[$fn4] | "; //// | // | echo " |
";
//echo " $row[$fn] $row[$fn2] $row[$fn3] $row[$fn4] | ";
//echo "";
//echo " EMail: $row[$fn] | |
";
//echo " $row[$fn] |