Mailkontakt von agon -- Empfänger über Link bestimmen

Gesperrt
acquire
Beiträge: 194
Registriert: So 13. Jun 2004, 13:24
Kontaktdaten:

Mailkontakt von agon -- Empfänger über Link bestimmen

Beitrag von acquire » So 30. Jan 2005, 13:06

Hallo!

Ich benutze das Modul Mailkontakt von agon etwas modifiziert:
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Mailkontakt
* Author : agon
* Copyright : Contenido - four for business
* Created : 05-11-2003
* Modified : 05-11-2003
* Modified again : Feb. 29th 2004 by Lars D. Forseth <lars@forseth.de>
************************************************/
Es funktioniert super.
Doch mittlerweile wäre es praktisch, wenn man mit einem Code im Link bestimmen könnte, welcher Adressat ausgewählt ist.
Auf einer Teamseite würde dann immer ein Link eines Teamitgliedes zum Kontaktformular.
Den link stelle ich mir so vor:
http://www.tkkg-site.de/cms/front_conte ... ecipient=1
http://www.tkkg-site.de/cms/front_content.php?idcat=129 ist der Pfad zum Modul
?recipient=1 die Angabe welcher Eintrag im Pulldown menü aktiviert sein soll. 1 ist der erste usw...

hat jemand sowas schon realisiert?
Oder abgeändert?
Hat einer eine Idee, wie das schnell und einfach zu realisieren wäre?

Danke im Voraus!

Gruß, acquire

emergence
Beiträge: 10643
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mo 31. Jan 2005, 00:50

wie ist denn der orginal link zum quellcode des moduls ?
*** make your own tools (wishlist :: thx)

Halchteranerin
Beiträge: 5478
Registriert: Di 2. Mär 2004, 21:11
Wohnort: Halchter, wo sonst? ;-)
Kontaktdaten:

Beitrag von Halchteranerin » Mo 31. Jan 2005, 08:22


acquire
Beiträge: 194
Registriert: So 13. Jun 2004, 13:24
Kontaktdaten:

Beitrag von acquire » Mo 31. Jan 2005, 10:41

Halchteranerin hat geschrieben:wahrscheinlich das hier: http://www.contenido.de/front_dev/uploa ... ontakt.txt
Nur im grundgerüst.
Das Modul wurde komplett überarbeitet:
* Modified again : Feb. 29th 2004 by Lars D. Forseth <lars@forseth.de>

Ich habe das Modul nun gefunden:
http://contenido.org/forum/viewtopic.ph ... &start=105
Unten ist der Link zum neuesten.
Ich gehe davon aus, das ich dieses auch verwende.
Der direkt DL geht aber nicht, er muss von der Homepage stammen...

http://www.forseth.de/cms/front_content ... 1&client=1


Danke schonmal im Voraus!
Beim erstellen des Themas habe ich wohl nicht die richtigen Suchbegriffe eingegeben.

emergence
Beiträge: 10643
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence » Mo 31. Jan 2005, 10:47

ich hab mich jetzt an den ersten link orientiert...

im output findet sich ja

Code: Alles auswählen

 for($x=0;$x<count($email_to_name);$x++){
  echo '<option value="'.$x.'">'.$email_to_name[$x].'</option>';
 }
sollte dann vielleicht so aussehen

Code: Alles auswählen

 for($x=0;$x<count($email_to_name);$x++){
  if ($recipient==$x) {
    echo '<option value="'.$x.'" selected>'.$email_to_name[$x].'</option>';
  } else {
    echo '<option value="'.$x.'">'.$email_to_name[$x].'</option>';  
  }
 }
ist nicht aber nicht getestet...

wenn recipient übergeben wird müsste die entsprechende email selektiert sein...
ist natürlich abhängig von der reihenfolge die vorher definiert ist... logisch...
im schlimmsten fall wird nichts selektiert...
*** make your own tools (wishlist :: thx)

acquire
Beiträge: 194
Registriert: So 13. Jun 2004, 13:24
Kontaktdaten:

Beitrag von acquire » Mo 31. Jan 2005, 12:21

Danke für deine Hilfe!
Leider finde ich die Stelle im Output gar nicht. Mein Output sieht so aus:

Code: Alles auswählen

<?php

/*******************************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname      :  Mailkontakt
* Author         :  agon
* Copyright      :  Contenido - four for business
* Created        :  05-11-2003
* Modified again :  Feb. 29th 2004 by Lars D. Forseth <lars@forseth.de>
********************************************************/

echo "
<!-- start Mailkontakt output -->
";
$db = new DB_Contenido;


/* data was given */
if (($mail == "yes") and (strlen($from_name)>1) and
    (strlen($from_mail)>5) and (strlen($mailkontaktid)>0) and (strlen($comment)>2)) {


  // if invalid mailkontaktid given
  if (!(eregi("([0-9]{1,11})",$mailkontaktid))) {
    $error = "
         <!-- error: invalid mailkontaktid given -->
         <br><br><br>
         <center><font color=\"darkred\"><b>
         Diesen Empf&auml;nger gibt es nicht (mehr)!
         <br>
         Versuch' es sp&auml;ter bitte nochmal.
         </b></font></center>
         <br><br><br>
         ";
    break;
  } // end if invalid mailkontaktid given

  $sql = "SELECT * FROM mailkontakt WHERE mailkontaktid=$mailkontaktid ".
         "OR mailkontakt_spd=\"Y\" ORDER BY mailkontaktid";
  $db->query($sql);
  $db->next_record();
  $nr = $db->num_rows();

  $mailto = "";
  $spd = "";
  $mailkontakt_name = "";
  $header="From:".$from_name."<".$from_mail.">";

  // no data in DB
  if ($nr < 1) {
    $error = "
         <!-- error: no data in DB -->
         <br><br><br>
         <center><font color=\"darkred\"><b>
         Diesen Empf&auml;nger gibt es nicht (mehr)!
         <br>
         Versuch' es sp&auml;ter bitte nochmal.
         </b></font></center>
         <br><br><br>
         ";
    break;
  } // end no data in DB

  // get recipients from DB
  for ($i=0; $i<$nr; $i++) {
    if ($mailkontaktid == ($db->f("mailkontaktid"))) {
      $mailto = ($db->f("mailkontakt_email"));
      $mailkontakt_name = $db->f("mailkontakt_name");
    } // end if
    if (!($mailkontaktid == ($db->f("mailkontaktid"))) and (($db->f("mailkontakt_spd"))=="Y")) {
      $spd .= ",".($db->f("mailkontakt_email"));
    } // end if
    $db->next_record();
  } // end "get recipients from DB"

  if (strlen($mailto) < 5) {
    $tmp = explode(",",$spd,2);
    $mailto = $tmp[1];
  } else {$mailto .= $spd;}

  // check if email-adress from user is correct
  $length = (int) (strlen($from_mail));
  if ($length > 100 or $length < 5) {$length_err = 1;}
  else {$length_err = 0;}
  $valid = (eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]+$",$from_mail));

  if (strlen($error)>3) {echo $error;}

  else { // no error occured
    if (!($valid==1) or ($length_err==1)) {
      $links        = explode('?',$PHP_SELF);
      $link         = $links[0];
      $link         = $link."?idcat=".$idcat; // back-link
      echo "
<br><br><br>
<font color=\"red\"><b>
 <u>ACHTUNG:</u><br>
 Die angegebene eMail-Adresse ist ung&uuml;ltig!<br>
 Bitte&nbsp;&uuml;berpr&uuml;fen...<br><br>
 <center>
  <form action=\"$link\" method=\"post\">
   <input type=\"hidden\" name=\"mailkontaktid\" value=\"$mailkontaktid\">
   <input type=\"hidden\" name=\"from_name\" value=\"$from_name\">
   <input type=\"hidden\" name=\"from_mail\" value=\"$from_mail\">
   <input type=\"hidden\" name=\"comment\" value=\"$comment\">
   <input type=\"submit\" value=\"&laquo;&nbsp;zur&uuml;ck\">
  </form>
 </center>
</b></font>
<br><br>";
    } // end check user email-address
    else {
      /* for security reasons in case of spam and the kind */
      $now = date("l dS of F Y \@ G:i:s"); // Example: Wednesday 15th of January 2004 15:51:38
      $ip = getenv("REMOTE_ADDR");
      $comment .= "\n\n\n\nThis mail was sent from the IP-address ".$ip." on ".$now." .\n";

      /* finally mail message */
      mail($mailto,"Kontaktformular: tkkg-site.de",$comment,$header);

      // give confirmation to user:
      if (strlen($mailkontakt_name) < 1) $mailkontakt_name = "uns";
      echo "
<br><br><br><br>
<font color=\"red\"><i>Folgende Nachricht ging eben an&nbsp;&nbsp;<b>".$mailkontakt_name."</b>&nbsp;raus:</i></font>
<br><br><br>
<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">
 <tr>
  <td class=\"text\"><b>Absender:</b></td>
  <td>&nbsp;&nbsp;</td>
  <td width=\"90%\" class=\"text\">";
      echo $from_name." <".$from_mail.">";
      echo "</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td class=\"text\"><b>Empf&auml;nger:</b></td>
  <td>&nbsp;&nbsp;</td>
  <td width=\"90%\" class=\"text\">".$mailkontakt_name."</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr valign=\"top\">
  <td class=\"text\"><b>Nachricht:</b></td>
  <td>&nbsp;&nbsp;</td>
  <td class=\"text\">".nl2br($comment)."</td>
 </tr>
</table>
<br><br><br>";
    } // end else ("user's email-addres is ok")
  } // end else ("no error occured")


} // end "data was given"








/* no data was given (yet), so give back form */
else {

  $db1 = new DB_Contenido;
  $sql1 = "SELECT * FROM mailkontakt WHERE mailkontakt_sil=\"Y\" ORDER BY mailkontakt_name";
  $db1->query($sql1);
  $db1->next_record();
  $nr1 = $db1->num_rows();
  if ($nr1 > 0) $show_list = "yes";


  $sql = "SELECT * FROM mailkontakt ORDER BY mailkontaktid";
  $db->query($sql);
  $db->next_record();
  $nr = $db->num_rows();

  /* there are recipients in DB */
  if ($nr > 0) {

    echo "<br><br><br>";

    // not all fields were filled during last submission!
    if ($mail == "yes") {
      echo "
  <font class=\"text\"><font color=\"red\">
   <u>ACHTUNG:</u>&nbsp;<i>Bitte alle Felder <b>korrekt</b> ausf&uuml;llen!</i>
  </font></font><br><br>";
    } // end if "not all fields filled"

    echo "
  <form name=\"mail\" action=\"".$auth->url()."\" method=\"post\" class=\"text\">
  <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
  ";

    /* if there are any recipients with sil=="Y" */
    if ($show_list == "yes") {
      echo"
   <tr>
    <td  valign=\"middle\" class=\"text\">Empf&auml;nger:</td>
    <td>&nbsp;</td>";

      echo "
    <td>
     <select name=\"mailkontaktid\" style=\"width: 251px;\">";

      for($x=0; $x<$nr1; $x++){
        echo "
      <option value=\"".($db1->f("mailkontaktid"))."\"";
        if (($db1->f("mailkontaktid")) == $mailkontaktid) echo " selected";
        echo ">".($db1->f("mailkontakt_name"));
        $db1->next_record();
      } // end for
      echo "
     </select>
    </td>
    ";
      // end drop-down-menu


      echo "
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   </tr>";
   } // end if($show_list == "yes")
   else {echo "<tr><td colspan=\"4\"><input type=\"hidden\" name=\"mailkontaktid\" value=\"0\"</td></tr>";}

   echo "
   <tr>
    <td class=\"text\" valign=\"middle\"><!--Dein--> Name:</td>
    <td>&nbsp;</td>
    <td><input type=\"text\" name=\"from_name\" size=\"38\" value=\"".$from_name."\" maxlength=\"100\"></td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   </tr>
   <tr>
    <td class=\"text\" valign=\"middle\"><!--Deine--> eMail:</td>
    <td>&nbsp;</td>
    <td><input type=\"text\" name=\"from_mail\" size=\"38\" value=\"".$from_mail."\" maxlength=\"100\"></td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   </tr>
   <tr>
    <td valign=\"top\" class=\"text\" valign=\"middle\"><!--Deine--> Nachricht:</td>
    <td>&nbsp;</td>
    <td>
     <text"."area cols=\"45\" rows=\"10\" name=\"comment\" style=\"width:250px\" wrap=\"physical\">".
      $comment.
    "</text"."area></td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   </tr>
   <tr>
    <td colspan=\"4\" align=\"center\">
     <br>
     <input type=\"hidden\" name=\"mail\" value=\"yes\">
     <input type=\"submit\" value=\"Mail senden &raquo;\">
    </td>
   </tr>
  </table>
 </fo"; echo "rm>
 <br><br>";

  } // end "there are recipients in DB"


  /* there are no recipients in DB */
  else {
    echo "
    <br><br><br>
    <center><font color=\"darkred\"><b>
     Momentan sind leider keine Empf&auml;nger in der Datenbank eingetragen,
     bitte versuch' es sp&auml;ter nocheinmal.
    </b></font></center>
    <br><br><br>
    ";
  } // end "there are no recipients in DB"



} // end "no data was given (yet)"

echo "
<!-- end Mailkontakt output -->
";

?>

Gesperrt