hi all,
ich erhalte immer folgende Fehlermeldung:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/web1/html/newsletter/newsletter.php on line 38
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/web1/html/newsletter/newsletter.php on line 42
Ihnen wurde soeben eine E-Mail mit näheren Informationen gesendet
hier der Quelltext dazu:
<?php
function verifyemail ($email) {
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$", $email, $check)) {
return TRUE;
} else {
return FALSE;
}
}
$error="";
function error($err) {
GLOBAL $error;
if($error=="") {
$error=$err;
}
}
include("include.php");
include($other."/config.php");
include($other."/mysql.php");
include($cfg[includeDir]."/lang/".$cfg[lang].".php");
include($cfg[tplDir]."/header.php");
switch($action) {
case sub:
mt_srand((double)microtime()*1000000);
$id1 = mt_rand(0,100000);
mt_srand((double)microtime()*1000000);
$id2 = mt_rand(0,100000);
$id=substr(md5($id1*$id2),0,14);
$erg=mysql_query("select count(email) as num from ".$cfg[dbpre]."user where email LIKE '$email'");
if($cat != "all") {
$erg2=mysql_fetch_array(mysql_query("select id from ".$cfg[dbpre]."cat where name LIKE '$cat'"),MYSQL_ASSOC);
$cat=$erg2[id];
}
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
$erg=$erg[num];
$endreglink=$cfg[scriptUri]."/newsletter.php?action=endreg&email=$email&id=$id";
$fp=fopen($cfg[tplDir]."/sub.php","r");
$file=fread($fp,filesize($cfg[tplDir]."/sub.php"));
fclose($fp);
$file=str_replace("<!endreglink!>",$endreglink,$file);
$filep=explode("[break]",$file);
$cat=($cat != "")? "|".$cat."|" : "all";
if($erg<1 && verifyemail($email) && isset($name)) {
mysql_query("insert into ".$cfg[dbpre]."user (email,acceptid,cat, name) values ('$email','$id','$cat','$name')");
mail($email,$filep[0],str_replace("\r\n","\n",$filep[1]),"From: $cfg[absendername] <$cfg[absendermail]>\r\nReturn-Path: $cfg[absendermail]");
echo $lang[submailScompl];
} else {
echo $lang[submailSincompl];
}
break;
case uns:
$erg=mysql_query("select email as email from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
if($erg[email]==$email && $email != "") {
mysql_query("delete from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
echo $lang["austrcompl"];
} else {
echo $lang["austrincompl"];
}
break;
case endreg:
$erg=mysql_query("select acceptid as acceptid from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
if($erg[acceptid]==$id) {
mysql_query("update ".$cfg[dbpre]."user SET acc='yes' WHERE email='$email'");
echo $lang[endreg];
} else {
echo $lang[errEndreg];
}
break;
case "and":
$erg=mysql_query("select acceptid as acceptid from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
if($ident=$erg[acceptid]) {
switch($act) {
default:
$res=mysql_query("SELECT * FROM ".$cfg[dbpre]."user WHERE acceptid='$ident' LIMIT 1") or die(mysql_error());
//mysql_free_result($res);
$r=mysql_fetch_array($res,MYSQL_ASSOC) or die(mysql_error());
$dbres=mysql_query("select * from ".$cfg[dbpre]."cat") or error(mysql_error());
echo '<form action="'.$PHP_SELF.'" method="post"><input type="hidden" name="email" value="'.$email.'"><input type="hidden" name="action" value="and"><input type="hidden" name="ident" value="'.$ident.'"><input type="hidden" name="act" value="chgcat">';
?><input type="checkbox" name="cat[]" value="all" <?echo ($r[cat]=="all") ? "checked" : "" ?>> Alle<br><?
while($row=mysql_fetch_array($dbres,MYSQL_ASSOC)) {
if(ereg("\|".$row[id]."\|",$r[cat])) {
echo "<input type=\"checkbox\" name=\"cat[]\" value=\"$row[id]\" checked> ".stripslashes($row[name])."<br>";
} else {
echo "<input type=\"checkbox\" name=\"cat[]\" value=\"$row[id]\"> ".stripslashes($row[name])."<br>";
}
}
echo '<br><input type="submit" value="Ändern">';
break;
case "chgcat":
if(is_array($cat)) {
if($cat[0]!="all") {
$kat="|".implode("|",$cat)."|";
} else {
$kat=$cat[0];
}
$dbres=mysql_query("update ".$cfg[dbpre]."user SET cat='$kat' WHERE acceptid='$ident'") or mysql_error();
echo "Änderung erfolgreich ausgeführt";
} else {
echo "Bitte eine Kategorie auswählen";
}
break;
}
} else {
echo 'Zugriff verweigert';
}
break;
default:
echo "Fehler!!! Bitte verwenden Sie die dafür vorgesehenen Formulare zum editieren & mehr";
break;
}
if($action=="") echo "Fehler!!! Bitte verwenden Sie die dafür vorgesehenen Formulare zum editieren & mehr";
include($cfg[tplDir]."/footer.php");
mysql_close($conn);
?>
Hat jemand eine Idee?
Gruß
Jörn
ich erhalte immer folgende Fehlermeldung:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/web1/html/newsletter/newsletter.php on line 38
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/web1/html/newsletter/newsletter.php on line 42
Ihnen wurde soeben eine E-Mail mit näheren Informationen gesendet
hier der Quelltext dazu:
<?php
function verifyemail ($email) {
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$", $email, $check)) {
return TRUE;
} else {
return FALSE;
}
}
$error="";
function error($err) {
GLOBAL $error;
if($error=="") {
$error=$err;
}
}
include("include.php");
include($other."/config.php");
include($other."/mysql.php");
include($cfg[includeDir]."/lang/".$cfg[lang].".php");
include($cfg[tplDir]."/header.php");
switch($action) {
case sub:
mt_srand((double)microtime()*1000000);
$id1 = mt_rand(0,100000);
mt_srand((double)microtime()*1000000);
$id2 = mt_rand(0,100000);
$id=substr(md5($id1*$id2),0,14);
$erg=mysql_query("select count(email) as num from ".$cfg[dbpre]."user where email LIKE '$email'");
if($cat != "all") {
$erg2=mysql_fetch_array(mysql_query("select id from ".$cfg[dbpre]."cat where name LIKE '$cat'"),MYSQL_ASSOC);
$cat=$erg2[id];
}
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
$erg=$erg[num];
$endreglink=$cfg[scriptUri]."/newsletter.php?action=endreg&email=$email&id=$id";
$fp=fopen($cfg[tplDir]."/sub.php","r");
$file=fread($fp,filesize($cfg[tplDir]."/sub.php"));
fclose($fp);
$file=str_replace("<!endreglink!>",$endreglink,$file);
$filep=explode("[break]",$file);
$cat=($cat != "")? "|".$cat."|" : "all";
if($erg<1 && verifyemail($email) && isset($name)) {
mysql_query("insert into ".$cfg[dbpre]."user (email,acceptid,cat, name) values ('$email','$id','$cat','$name')");
mail($email,$filep[0],str_replace("\r\n","\n",$filep[1]),"From: $cfg[absendername] <$cfg[absendermail]>\r\nReturn-Path: $cfg[absendermail]");
echo $lang[submailScompl];
} else {
echo $lang[submailSincompl];
}
break;
case uns:
$erg=mysql_query("select email as email from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
if($erg[email]==$email && $email != "") {
mysql_query("delete from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
echo $lang["austrcompl"];
} else {
echo $lang["austrincompl"];
}
break;
case endreg:
$erg=mysql_query("select acceptid as acceptid from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
if($erg[acceptid]==$id) {
mysql_query("update ".$cfg[dbpre]."user SET acc='yes' WHERE email='$email'");
echo $lang[endreg];
} else {
echo $lang[errEndreg];
}
break;
case "and":
$erg=mysql_query("select acceptid as acceptid from ".$cfg[dbpre]."user WHERE email='$email' LIMIT 1");
$erg=mysql_fetch_array($erg,MYSQL_ASSOC);
if($ident=$erg[acceptid]) {
switch($act) {
default:
$res=mysql_query("SELECT * FROM ".$cfg[dbpre]."user WHERE acceptid='$ident' LIMIT 1") or die(mysql_error());
//mysql_free_result($res);
$r=mysql_fetch_array($res,MYSQL_ASSOC) or die(mysql_error());
$dbres=mysql_query("select * from ".$cfg[dbpre]."cat") or error(mysql_error());
echo '<form action="'.$PHP_SELF.'" method="post"><input type="hidden" name="email" value="'.$email.'"><input type="hidden" name="action" value="and"><input type="hidden" name="ident" value="'.$ident.'"><input type="hidden" name="act" value="chgcat">';
?><input type="checkbox" name="cat[]" value="all" <?echo ($r[cat]=="all") ? "checked" : "" ?>> Alle<br><?
while($row=mysql_fetch_array($dbres,MYSQL_ASSOC)) {
if(ereg("\|".$row[id]."\|",$r[cat])) {
echo "<input type=\"checkbox\" name=\"cat[]\" value=\"$row[id]\" checked> ".stripslashes($row[name])."<br>";
} else {
echo "<input type=\"checkbox\" name=\"cat[]\" value=\"$row[id]\"> ".stripslashes($row[name])."<br>";
}
}
echo '<br><input type="submit" value="Ändern">';
break;
case "chgcat":
if(is_array($cat)) {
if($cat[0]!="all") {
$kat="|".implode("|",$cat)."|";
} else {
$kat=$cat[0];
}
$dbres=mysql_query("update ".$cfg[dbpre]."user SET cat='$kat' WHERE acceptid='$ident'") or mysql_error();
echo "Änderung erfolgreich ausgeführt";
} else {
echo "Bitte eine Kategorie auswählen";
}
break;
}
} else {
echo 'Zugriff verweigert';
}
break;
default:
echo "Fehler!!! Bitte verwenden Sie die dafür vorgesehenen Formulare zum editieren & mehr";
break;
}
if($action=="") echo "Fehler!!! Bitte verwenden Sie die dafür vorgesehenen Formulare zum editieren & mehr";
include($cfg[tplDir]."/footer.php");
mysql_close($conn);
?>
Hat jemand eine Idee?
Gruß
Jörn
Kommentar